Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is pixel width and length for jspdf's default 'a4' format?

What is the size in pixels for jspdf's 'a4' format? I want to add an image to pdf so it will take full width of the document.

new jsPDF('p', 'pt', 'a4');
like image 477
Yevhenii Bahmutskyi Avatar asked Jun 26 '17 10:06

Yevhenii Bahmutskyi


People also ask

How do I set height and width in jsPDF?

You can get the width and height of PDF document like below, var doc = new jsPDF("p", "mm", "a4"); var width = doc. internal. pageSize.

What is P jsPDF?

jsPDF(orientation, unit, format) Creates new jsPDF document object. instance Parameters: orientation One of "portrait" or "landscape" (or shortcuts "p" (Default), "l") unit Measurement unit to be used when coordinates are specified.


Video Answer


1 Answers

new jsPDF('p', 'pt', [ 595.28,  841.89])

In the sourcecode on GitHub you can see the supported units (relative proportions to pt), and you can also see the default page formats (with their sizes in pt).

Hope this could help,

Laura.

like image 200
L. Merlo Avatar answered Sep 21 '22 20:09

L. Merlo