Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

download pdf from drive js

let jspdf = document.createElement("script");
jspdf.onload = function () {
let pdf = new jsPDF();
let elements = document.getElementsByTagName("img");
for (let i in elements) {
let img = elements[i];
console.log("add img ", img);
if (!/^blob:/.test(img.src)) {
console.log("invalid src");
continue;
}
let can = document.createElement('canvas');
let con = can.getContext("2d");
can.width = img.width;
can.height = img.height;
con.drawImage(img, 0, 0, img.width, img.height);
let imgData = can.toDataURL("image/jpeg", 1.0);
pdf.addImage(imgData, 'JPEG', 0, 0);
pdf.addPage();
}
pdf.save("download.pdf");
};
jspdf.src = 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js';
document.body.appendChild(jspdf);
Comment

PREVIOUS NEXT
Code Example
Javascript :: react effect hook 
Javascript :: check when input number value goes up or down 
Javascript :: present value formula js 
Javascript :: JQuery UI Saving Sortable List 
Javascript :: pdf.js get current page number 
Javascript :: write an array that invokes the alter function in to the array 
Javascript :: jquery slick drag goes back 
Javascript :: sequelize check if exists 
Javascript :: display:flex 
Javascript :: export socket io connection in react 
Javascript :: document.cookie 
Javascript :: image loading in Compose display image 
Javascript :: last row bold datatable 
Javascript :: ionicActionSheet decorator example 
Javascript :: js show element 
Javascript :: JS function typeof 
Javascript :: react native on refresh change color flat list 
Javascript :: how to check invalid control angular formcontrol name 
Javascript :: js jquery class ending with string 
Javascript :: javascript iterable 
Javascript :: null is not an object clipboard rn 
Javascript :: simbu react1 
Javascript :: input mask 9 number add 
Javascript :: Highlight current nav link in react 
Javascript :: shadow generator react native 
Javascript :: kaboom.js 
Javascript :: search an array with regex javascript find 
Javascript :: check if all array elements are equal 
Javascript :: date difference without weekends using moment js 
Javascript :: jquery public function 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =