Question T9287
Visible to All Users

Upgrading to Survey V2 has caused my PDF export to be blank

created 3 years ago

Hi,

I have recently upgrade to V2 of SurveyJS, which looks and feels great.

However, now my export for SurveyPDF seems to be broken. The result I am getting is always blank and no questions. Here is the function (directly from the docs) and screen shot:

JavaScript
export const saveSurveyToPdf = ( json: any, filename: string, surveyModel: any, answers?: boolean ) => { const pdfOptions = { fontSize: 14, margins: { left: 10, right: 10, top: 10, bot: 10 }, fontName: 'Courier' }; const surveyPDF = new SurveyPDF.SurveyPDF(json, pdfOptions); if (answers) surveyPDF.data = surveyModel.data; surveyPDF.save(filename); };

Screenshot:
Clipboard-File-1.png

I am very confused, I took the function directly from the docs and also have tried this on Plunker and it worked fine. My JSON is perfectly correct and when console logging it is showing the correct information, all pages and questions etc.

Thank you look forward to hearing from you guys :)

Answers approved by surveyjs Support

created 3 years ago

Hello,
I believe you are using several instance of our libraries in your app. What libraries/packages do you use?

Thank you,
Andrew
SurveyJS Team

    Show previous comments (23)

      Thanks Andrew, I appreciate your help :)

        Hi good morning,

        looking forward hearing from you guys today.

        Just to summerise my issue i have a rich text editor which i have created as a custom widget, however upon export the question is not passed into the SurveyPDF model and is blank. However the sandbox is working.

        also, on Pdf render i would like it to work exactly like the "comment" widget where its just a larger input field, is there a way i can render this using the pdfRender callback?

        I can send over my email and contact details if we can go through a call or meeting as I am using commercial license.

        Thanks again!

          Hello,

          This is the example in the plunker. I changed rendered question by onRenderQuestion event.

          If survey mode is display then editor question will render as html with border around.

          Clipboard-File-1.png

          In other case it will render as comment question and you can change its value. Note that text is just html

          Clipboard-File-2.png

          You can render border around question using EmptyBrick. The constructor takes border sizes and boolean argument (show / don't show border)

          Thank you,
          Yaroslav
          SurveyJS Team