We are creating a node.js service to generate Survey PDFs
Everything works so far apart from some formatting issues with HTML questions.
HTML that normally would not create a line break such as <b></b> are creating a line break.
JSON{
"type": "html",
"name": "GP connect description",
"html": "<p style=\"font-size:16px\"> For many patients your Consultant Dermatologist can access your GP record to obtain the full picture surrounding your skin problem, but they require your consent to do so. Your record is only visible at the time your consultant reviews your case. No information is saved or shared more widely.<br><br></p>\nUnfortunately not all GP records are connected, so please complete <b>both the assessment below and the general health questions </b> so that we have all the background information needed to make a diagnosis."
}
It also seems to be ignoring styling. In the following example the font for "IMPORTANT NOTE" should be red:
Code{
"type": "html",
"name": "questionE2a",
"visibleIf": "{questionG2} anyof ['item1', 'item2', 'item4']",
"html": "<h4><b style=\"\"><font color=\"#ff0000\">IMPORTANT NOTE: </font></b></h4><h4><font color=\"#636363\">If the problem is in a sensitive area, it is your choice if you wish to upload photo(s). Your photos will only be visible to clinicians involved with your case. If you are uncomfortable with this, please do not upload a photo. </font></h4>"
}
Hello,
Thank you for sharing these HTML questions. I tested them with the latest version of SurveyJS PDF Generator and got the following output:
View Demo
It seems that both issues do not appear on the provided demo. Would you please test it on your side and let me know whether you get the satisfactory result?
If you haven't yet updated the SurveyJS PDF library version, I would definitely recommend this.
I look forward to your reply.
Hi Jane,
Thank you for your response.
We're already running the latest version of SurveyJS PDF Generator so I don't think that's it
Did you try running it in Node.js?
I have a feeling that the issue is because we want to run it outside of the browser
Hi Ben,
Thank you for the update. Unfortunately, the Survey PDF Generator cannot operate on a server-side environment.
As an option, consider using a third-party library (link 1, link 2) to generate a PDF on the server side.
Thank you
Hi Ben,
Just want to inform you that we published an example on how to export a sample survey on Node.js environment: Create PDF Forms in Node.js.
Please take note of a limitation regarding the question types unsupported on Node.js.
We hope this example may help. Should you have any questions or require further assistance, we are here to help.
Hi Jane,
Thank you for the update.
Are there plans to support HTML questions in future versions?
Or any known work around's?
Hi Ben,
You're always welcome.
Regarding HTML: would you please clarify which type/kind of HTML you would display in a SurveyJS PDF document? If possible, share some illustration/example.
I look forward to your reply.