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.

Error when converting HTML string to PDF

See original GitHub issue

I’m trying to generate a PDF from a simple HTML string:

doc.html('<html>Hello <b>world</b></html>', {
	callback: function (doc) {
		doc.save();
	},
	x: 10,
	y: 10
});

But I got the following error:

Uncaught (in promise) TypeError: Failed to execute 'createNodeIterator' on 'Document': parameter 1 is not of type 'Node'.

I’m using following libraries:

  • jspdf 2.3.1
  • html2canvas 0.4.1
  • dompurify 2.3.0

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
bendsitocommented, Jun 15, 2022

@bendsito Did you ever resolve this issue for yourself? I’m seeing the same error.

Unfortunately I didn’t. There seems to be some compatibility issues with the Salesforce framework (which I was using).

0reactions
bendsitocommented, Oct 4, 2022

@bendsito Did you ever resolve this issue for yourself? I’m seeing the same error.

Unfortunately I didn’t. There seems to be some compatibility issues with the Salesforce framework (which I was using).

@bendsito I’m trying to do the same thing on Salesforce and getting the same error. Did you find a workaround?

I didn’t…

It doesn’t seem possible to use this functionality on Salesforce, according to this recent post: https://salesforcecodex.com/salesforce/generate-pdf-using-jspdf-in-lightning-web-component/amp/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solving formatting issues when converting HTML to PDF
To solve this problem roll back to Internet Explorer 8 or, if you have control over the content of the web page, skip...
Read more >
Problem with conversion from html to pdf | WPF Forums
We have created a sample and convert the HTML string to a PDF document, it generates a PDF document without any exception. We...
Read more >
Authentication fail error on convert Html to Pdf - Stack Overflow
It sounds like you just need to authenticate the request being made by the PDF library. For example, if it's using Basic HTTP...
Read more >
Error converting HTML to PDF · Issue #4415 - GitHub
Hi, I am trying to convert html to pdf using wkhtmltopdf, below is the HTML code.
Read more >
Convert HTML string to PDF file in C# and VB.NET - SautinSoft
Get HTML content from file htmlString = ReadFromFile(htmlPath); // 2. Converting HTML to PDF ... WriteLine("An error occurred during converting HTML to PDF!...
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