parallax/jsPDF
View on GitHubMissing several line of text when using html() with autopaging: text
Open
#3393 opened on Mar 18, 2022
Bugdifficulty:mediumhelp wanted
Description
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

When I set autoPaging = text
The output pdf will be:
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 :(
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