https://www.savemyexams.co.ukjavascript
蜜汁刷題網站,會員簡直就是在搶錢
好不容易搞了個教師折扣,試卷資源還不能下載…
本方法適用於 Google Drive 被設置爲 Read Only 的 PDF 文件的下載導出css
/* Via https://codingcat.codes/2019/01/09/download-view-protected-pdf-google-drive-js-code/ If the images are not complete, try zooming the page to get the full image. 1. Open Developer Tools on separate window and choose the Console tab 2. Paste the code below (and hit enter) */ 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]; if (!/^blob:/.test(img.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); let imgData = can.toDataURL("image/jpeg", 1.0); pdf.addImage(imgData, 'JPEG', 0, 0); pdf.addPage(); } pdf.save(document.title.split('.pdf - ')[0]+".pdf"); }; jspdf.src = 'https://cdn.bootcss.com/jspdf/1.5.3/jspdf.debug.js'; document.body.appendChild(jspdf);
↑ JavaScript 代碼java
原代碼來自 https://codingcat.codes/2019/...
打開瀏覽器開發者工具(單窗口打開)選擇 Console / 控制檯
複製代碼,回車執行
若是圖片繪製不完整,嘗試縮放瀏覽器頁面canvas