question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

document output function gives blank pdf file

See original GitHub issue

i am trying to output an jspdf document but it gives blank pdf file :

    <script>
        var doc = new jsPDF();
        var img = new Image();
        img.src = 'studentpdf.png';
        var canvas = document.createElement('canvas');
        canvas.width = "210";
        canvas.height = "297";
        canvas.getContext('2d').drawImage(img, 0, 0, 210, 297);
        doc.addImage(canvas.toDataURL('image/png'), 'png',0,0,210,297);
        doc.output('datauri');
    </script>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
TheGreenJaguarcommented, Aug 1, 2019

change the hook line to:

img.addEventListener('load', myFunction, false);
0reactions
brmodacommented, Aug 1, 2019

actually it worked after recode it without the brackets , and i figured out that the png image ( without background ) was the error , when i filled the background with white color it worked !

thank you @TheGreenJaguar for help

Read more comments on GitHub >

github_iconTop Results From Across the Web

document output function gives blank pdf file #2544 - GitHub
i am trying to output an jspdf document but it gives blank pdf file :
Read more >
How to fix a fillable PDF that shows blank fields.
On the bar at the top of the PDF, click the print icon. 4. On the print menu, make sure the destination is...
Read more >
jsPDF outputs blank document - javascript - Stack Overflow
outputs some html code from the div, but how come the PDF is always empty? UPDATE: I added some delay ( I found...
Read more >
Solved: PDF Returned from HTTP Response is Blank
I have created a flow that acts like a web service. There is an HTTP Request to trigger the flow. The body of...
Read more >
Acrobat shows blank PDF in Print Preview
Opening a PDF in Acrobat DC works fine. When printing in Acrobat, though, the print preview (and the actual print) are blank.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found