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.

Missing several line of text when using html() with autopaging: text

See original GitHub issue

I’m facing an issue when using html() function to print out a html element.

This is my code:

await doc.html(contentRef.current, {
  margin: [MARGIN_TOP, 0, MARGIN_BOTTOM, 0],
  autoPaging: 'text', // I think this property is the cause
  y: 30, // distance metadata to header (84pt) - margin top (54pt)
  html2canvas: {
    scale: 1.0,
    ignoreElements: element => element.id === autoTableConfig?.elementId,
  },
})

/// pdf save....

This is content displaying the my DOM MY TREES, AND BUT A FEW STRAY GLEAMS STEAL INTO THE INNER SANCTUARY, I THROW MYSELF DOWN

When I set autoPaging = text The output pdf will be: image As you see, we miss the text line EU PEDE MOLLIS PRETIUM. INTEGER TINCIDUNT. CRAS DAPIBUS. VIVAMUS ELEMENTUM SEMPER NISI.

Then I tried switching to slice mode, now the text line is rendered, but it’s sliced and put on 2 different pages. This is not our expectation 😦 image

I’m wondering if it is a problem when calculating the possition to render the next line of Context2D when a text line is cut off. I don’t have any idea to fix it so far.

Hope to see your help soon

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
PLP-Caseycommented, Mar 18, 2022

From what have figured out, it appears to be an issue between autopagin text and margin bottom. For me, its seems to have fixed by removing setting margin-bottom 0px and removing autopaging. Although my margins were previously all set to 10.

0reactions
valueerrorxcommented, May 3, 2022

in my case all of the formatting problems start when autopaging is set to true and i have more than 2 pages … the more pages i have the bigger are the formatting errors…

Read more comments on GitHub >

github_iconTop Results From Across the Web

autoPaging in jsPdf .html() method - Stack Overflow
I tried using it but didnt see anything different on the generated pdf. I am guessing it might be related to paging like...
Read more >
Outlook 2013 Random Missing Lines of Text
There are miscellaneous lines of text missing from within the body of email messages. This phenomenon appears to only be present in HTML...
Read more >
Convert HTML to PDF using JavaScript - CodexWorld
HTML to PDF with JavaScript - Convert HTML content to PDF using jsPDF and jQuery. ... Specify the content in text() method of...
Read more >
Exporting table to multipage PDF file using kendo exportPDF
I need to export large table to pdf file using kendo pdfExport. This code I have so far: html: <div style="position:relative;" ...
Read more >
APL Standard Commands (APL 1.2) | Alexa Skills Kit
This document provides a reference to the commands in APL 1.2.
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