Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

None of your Print to PDF example are working #2325

Closed
jbrou015 opened this issue Aug 11, 2020 · 6 comments
Closed

None of your Print to PDF example are working #2325

jbrou015 opened this issue Aug 11, 2020 · 6 comments
Labels
Milestone

Comments

@jbrou015
Copy link

Are you requesting a feature, reporting a bug or asking a question?

Bug

What is the current behavior?

In you documentation, none of your examples are working.

Try:

On load we have:
Uncaught TypeError: Cannot read property 'API' of undefined

Then...
ReferenceError: SurveyPDF is not defined

What is the expected behavior?

Examples are working

How would you reproduce the current behavior (if this is a bug)?

Provide the test code and the tested page URL (if applicable)

Tested page URL:

Test code

your_code_here

Specify your

  • browser: chrome, edge
  • browser version:
  • surveyjs platform (angular or react or jquery or knockout or vue): Vue, jQuery
  • surveyjs version:
@adolfopeccin
Copy link

Most probably its the changes in jsPDF

@jbrou015
Copy link
Author

jbrou015 commented Aug 11, 2020

Ok, I am now using jsPDF version 1.5.3 for now. I am making progress but there is still issues with it.

@adolfopeccin
Copy link

adolfopeccin commented Aug 11, 2020

You can use the https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js old version before 2.x released today by jsPDF. It's working.

@dmitry-kurmanov
Copy link
Member

We've updated our site and fixed the problem.

@jbrou015
Copy link
Author

jbrou015 commented Aug 11, 2020

Your examples are working fine now thank you.

Using jsPDF 1.5.3 is causing those exceptions below in my code. It's coming from jsPDF. Any idea why? Something to do with the Fonts.

jsPDF PubSub Error this.addFileToVFS is not a function TypeError: this.addFileToVFS is not a function
at Object.callAddFont (doc_controller.ts:146)
at PubSub.publish (jspdf.js:78)
at addFonts (jspdf.js:1028)
at new jsPDF (jspdf.js:3352)
at new DocController (doc_controller.ts:131)
at SurveyPDF. (survey.ts:142)
at step (helpers.ts:90)
at Object.next (helpers.ts:71)
at helpers.ts:64
at new Promise ()

And...
Uncaught (in promise) TypeError: controller.doc.splitTextToSize is not a function
at Function.SurveyHelper.createPlainTextFlat (helper_survey.ts:175)
at Function. (helper_survey.ts:191)
at step (helpers.ts:90)
at Object.next (helpers.ts:71)
at helpers.ts:64
at new Promise ()
at Object.__awaiter (helpers.ts:60)
at Function.SurveyHelper.createTextFlat (helper_survey.ts:189)
at Function. (helper_survey.ts:354)
at step (helpers.ts:90)

@jbrou015
Copy link
Author

jbrou015 commented Aug 11, 2020

I have fixed this one: jsPDF PubSub Error this.addFileToVFS is not a function TypeError: this.addFileToVFS is not a function by adding

fontName: 'times',
fontStyle: 'normal',

to my options.

However, this one: Uncaught (in promise) TypeError: controller.doc.splitTextToSize is not a function I can't figure out. Anything could help.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants