-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
Description
I have read and understood the contribution guidelines.
jsPDF version is 2.5.1
I'm just performing a simple jspdf.html()
call but the rendered PDF does not match the rendered HTML. I am using Tailwind CSS in the HTML but I have also converted the Tailwind code into inlined styles which produces the exact same results.
Here is the HTML to be rendered
<div id="appGenPdfText" class="flex flex-col w-full h-full space-y-1">
<div class="flex flex-row bg-blue-200 justify-center">
<p class="m-1 text-primary text-xl">APPLICANT GENERAL INFORMATION</p>
</div>
<div class="flex bg-primary justify-center">
<p class="text-white">Primary Information</p>
</div>
</div>
here is the JS which uses jsPDF to render as PDF.
let pdf = await new jsPDF({
orientation: 'p',
unit: 'pt',
format: 'letter',
putOnlyUsedFonts: true,
compress: true
})
const source = await document.getElementById('appGenPdfText')
await pdf.html(source, {
width: 580,
windowWidth: 580,
margin: 15
})
await pdf.save()
As you can see the first like of text for some reason has no spaces, and is not centered in the light blue box. The second line does have the space between words but also is not centered.
kuda1992, ningyuv, Chikanz, maksym-slinchenko, akbarism and 4 more