You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {FontFace[]} [options.fontFaces] A list of font-faces to match when resolving fonts. Fonts will be added to the PDF based on the specified URL. If omitted, the font match algorithm falls back to old algorithm.
1013
1027
* @param {jsPDF} [options.jsPDF] jsPDF instance
1014
-
* @param {number} [options.x] x position on the PDF document
1015
-
* @param {number} [options.y] y position on the PDF document
1028
+
* @param {number=} [options.x] x position on the PDF document in jsPDF units.
1029
+
* @param {number=} [options.y] y position on the PDF document in jsPDF units.
1030
+
* @param {number=} [options.width] The target width in the PDF document in jsPDF units. The rendered element will be
1031
+
* scaled such that it fits into the specified width. Has no effect if either the <code>html2canvas.scale<code> is
1032
+
* specified or the <code>windowWidth</code> option is NOT specified.
1033
+
* @param {number=} [options.windowWidth] The window width in CSS pixels. In contrast to the
1034
+
* <code>html2canvas.windowWidth</code> option, this option affects the actual container size while rendering and
1035
+
* does NOT affect CSS media queries. This option only has an effect, if the <code>width<code> option is also specified.
it("respects width and windowWidth options",async()=>{
45
+
constmarkup=
46
+
"<div>"+
47
+
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Eveniet reprehenderit nihil natus magnam doloremque voluptate ab, laborum officiis corrupti eius voluptatibus quisquam illum esse corporis quod fugit quibusdam minima provident."+
it("width should not overwrite user-provided html2canvas.scale option",async()=>{
87
+
constmarkup=
88
+
"<div>"+
89
+
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Eveniet reprehenderit nihil natus magnam doloremque voluptate ab, laborum officiis corrupti eius voluptatibus quisquam illum esse corporis quod fugit quibusdam minima provident."+
90
+
"</div>";
91
+
constdoc=awaitrender(markup,{
92
+
width: 300,
93
+
windowWidth: 500,
94
+
html2canvas: {scale: 2}
95
+
});
96
+
comparePdf(
97
+
doc.output(),
98
+
"html-width-300-windowWidth-500-scale-2.pdf",
99
+
"html"
100
+
);
101
+
});
102
+
103
+
it("width and windowWidth should only have an effect if both are supplied",async()=>{
104
+
constmarkup=
105
+
"<div>"+
106
+
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Eveniet reprehenderit nihil natus magnam doloremque voluptate ab, laborum officiis corrupti eius voluptatibus quisquam illum esse corporis quod fugit quibusdam minima provident."+
0 commit comments