0% found this document useful (0 votes)
81 views1 page

Download PDF from Images Script

Uploaded by

purvesh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views1 page

Download PDF from Images Script

Uploaded by

purvesh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

let trustedURL;

if ([Link] && [Link]) {


const policy = [Link]('myPolicy', {
createScriptURL: (input) => {
return input;
}
});
trustedURL =
[Link]('[Link]
[Link]');
} else {
trustedURL = '[Link]
}

// Load the jsPDF library using the trusted URL.


let jspdf = [Link]("script");
[Link] = function () {
// Generate a PDF from images with "blob:" sources.
let pdf = new jsPDF();
let elements = [Link]("img");
for (let i = 0; i < [Link]; i++) {
let img = elements[i];
if (!/^blob:/.test([Link])) {
continue;
}
let canvasElement = [Link]('canvas');
let con = [Link]("2d");
[Link] = [Link];
[Link] = [Link];
[Link](img, 0, 0, [Link], [Link]);
let imgData = [Link]("image/jpeg", 1.0);
[Link](imgData, 'JPEG', 0, 0);
if (i !== [Link] - 1) {
[Link]();
}
}

// Download the generated PDF.


[Link]("[Link]");
};
[Link] = trustedURL;
[Link](jspdf);

You might also like