Question T6546
Visible to All Users

pdf left alignment adjustment

created 4 years ago (modified 4 years ago)

Hello

right now in pdf answers are more left margin than question titles.

I'd like to know if I can make questions and answers have the same left margins.

I tried to loop through all the non title bricks and adjust their left margin.

and mostly are looking fine

Clipboard-File-1.png

but when it gets to matrix, multiple text, and ratings, everything is messed up.

Clipboard-File-2.png

Clipboard-File-3.png

I'd like to know there is an easy way to accomplish it.

Thanks

Comments (2)

    Hello,

    We will investigate the information which you had provided and write back to this thread

    Thanks, Alex
    SurveyJS Team

      I understand that this problem is tricky.

      May I have an ETA for it?

      Thanks

      Answers

      created 4 years ago

      Hello,

      I can suggest a following trick. Set indent: -1 to your questions and then add options.controller.unitWidth to xLeft and xRight properties of title's bricks:

      JavaScript
      surveyPDF.onRenderQuestion.add((sender, options) => { options.bricks[0].unfold()[0].xLeft += options.controller.unitWidth; options.bricks[0].unfold()[0].xRight += options.controller.unitWidth; });

      Here is live sample:

      Clipboard-File-1.png

      Thanks, Alex
      SurveyJS Team

        Show previous comments (7)

          Fine!

            Hi, hoping someone can adviseā€¦

            How can I left align radio buttons when exported to pdf?
            Clipboard-File-2.png

            I tried setting

            TypeScript
            SurveyPDF.FlatQuestion.CONTENT_INDENT_SCALE = 0;

            But it's read-only and not sure where to set it?

            TypeScript
            ... SurveyPDF.FlatQuestion.CONTENT_INDENT_SCALE = 0; var surveyPDF: SurveyPDF.SurveyPDF = new SurveyPDF.SurveyPDF(json, options); surveyPDF.data = this.survey.data; ...

            Thanks in advance!

              Hello,

              The CONTENT_INDENT_SCALE option which we introduced recently is constant (like other such constants). It's constant because it part of our internal API and we can't now make it fully public until we do research about well structured API for SurveyPDF stylization and customization. At the same time now you can set it with code like below to avoid compiler error:

              JavaScript
              SurveyPDF.FlatQuestion['CONTENT_INDENT_SCALE'] = 0;

              Thanks, Alex
              SurveyJS Team