You can set the resolution of the generated PDF document in jsPDF()
constructor method using the putUserUnit
and setRatiotUserUnit
methods. Here is an example of how to create a PDF with resolution of 300ppi:
index.tsx475 chars19 lines
In this example, we used the putUserUnit method to set the page unit to points where 1pt = 1/72 inch. We also used setRatiotUserUnit method to set ratio to 1/72, so that we can calculate our page size units more easily.
This example creates a PDF with dimensions (in inches) of 8.5 by 11 in portrait format. We converted the inch dimensions to points and then multiplied by 72 to get the size of the PDF page. Finally, we rendered some text on the PDF and saved the output.
gistlibby LogSnag