Question T21977
Visible to All Users

PDF Export - format question title

created a month ago

Hi there

I am wondering if there is a way for our question titles to export as regular text and not bold - we have set as regular in the survey theme.
Sometimes the questions wrap in odd places e.g. 6.7 and 6.8 in the image below - is there a way to prevent this?
The spacing between questions is quite large, are we able to reduce space?

Thanks in advance.
Question titles.jpg

Answers approved by surveyjs Support

created a month ago

Hi Miriam,
Thank you for reaching out to us. The SurveyJS PDF uses its own styling. If you wish to reset the Bold appearance for question titles, you would require to implement the onRenderQuestion function as follows: View Demo.

JavaScript
surveyPDF.onRenderQuestion.add(function (survey, options) { const titleBrick = options.bricks[0].bricks[0]; const titleBricks = titleBrick.unfold(); const titleString = titleBricks.reduce((a, b) => a + b.text, ""); const point = options.module.SurveyHelper.createPoint( titleBrick, true, true ); options.bricks[0].bricks[0] = options.module.SurveyHelper.createPlainTextFlat( point, options.question, options.controller, titleString, options.module.TextBrick ); });

To process your additional inquiries in the most efficient manner, I created separate tickets on your behalf.

Please refer to them for further details.

    Comments (3)

      Hi jane.

      this did work however i has caused various other issues in regard to formatting around the generated pdf.

      we have incorperated a third party react component to do rich text editing which is tied to the question title, so when we apply html markup to questions it is no longer a title brick but converted to html bricks.

      the developer i have helping me has an idea as to how to fix it but what would be a decent solution?

      he says there is very little documentation regarding the SurveyHelper class in the SurveyJs documentation so if you could provide some insight as to where he could go to find more information about SurveyHelper that would be great

        Hi Miriam,
        Thank you for the update. The SurveyHelper API is not currently documented. Would you please share more details about your usage scenario? Do you use Markdown formatting to format question titles? Would you share an example of the current and expected behavior so that we can be in a better position to suggest a suitable option?

        Thank you

          will work on an getting an example to you