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.

No text in PDF, only images

See original GitHub issue

Thank you for submitting an issue to jsPDF. Please read carefully.

Are you using the latest version of jsPDF?

yes,

https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.min.js

Have you tried using jspdf.debug.js?

Yes

Steps to reproduce

I am using jsPDF to save my tables made with dataTables plugin.

Here is my code:

    var doc = new jsPDF();
    var specialElementHandlers = {
        '#editor': function (element, renderer) {
            return true;
        }
    };

    $('#Save_as_pdf').click(function () {
        doc.fromHTML($('#inventory_table').html(), 15, 15, {
            'width': 170,
                'elementHandlers': specialElementHandlers
        });
        doc.save('Inventory.pdf');
    });

What I saw

In Chrome:

Error and an empty PDF:

error_v2

In IE 11:

Only large images instead of what should have been icons but still no text:

generated_pdf

What I expected

PDF with my dataTables, containing text and images.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Uzlopakcommented, Jan 3, 2018

Can you try to give fromHTML the elementHandler? Instead of $(‘#inventory_table’).html() writing $(‘#inventory_table’)[0]

0reactions
Uzlopakcommented, Jan 11, 2018

I gave you the solution based on your code. If your code is faulty in another place, I cant fix that. Provide an jsfiddle or so, to have collaborated help. If not, I am not able to guess your problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No text, only logos & graphics print - Adobe Support Community
When attempting to print a pdf file, no text is printed however, logos and any graphics, regardless of color or B&W, print fine....
Read more >
Microsoft Word - Save as PDF - No Text Appearing, Only Images
pdf, no words are in the PDF, only the images appear in the document. I've tried "Save a Copy" and selected PDF. I've...
Read more >
Fixing Image-only PDFS: Text/Character Recognition in ...
Often you will inherit a PDF file that was scanned as an image of text. This means that a sighted person can read...
Read more >
How to Create a non-searchable (image only) PDF file?
To create a PDF Image Only document: •Open a document from a Windows application (Word, Excel, Edge, etc.) •Print the document and select...
Read more >
Why is my pdf printing with missing text?
A PDF form that is garbled or missing text after printing could be due to a system font inconsistency. To fix this issue...
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