{"id":12161,"date":"2022-04-06T01:21:35","date_gmt":"2022-04-06T05:21:35","guid":{"rendered":"http:\/\/nycphantom.com\/journal\/?p=12161"},"modified":"2022-04-06T01:52:56","modified_gmt":"2022-04-06T05:52:56","slug":"is-google-drive-view-only-pdf-really-protected-from-being-copied","status":"publish","type":"post","link":"http:\/\/nycphantom.com\/journal\/?p=12161","title":{"rendered":"Is Google Drive View-Only PDF really protected from being copied?"},"content":{"rendered":"\n<p>Of course, nothing can escape Snipping Tool screenshot.<\/p>\n\n\n\n<p>But what about the shortest way to convert to a pdf document file? Because Google Drive somehow, giving the ability to restrict viewers from downloading if the owner so chooses, convert the pdf into some partly encoded html format such that the printing will be blank.<\/p>\n\n\n\n<p>The solution I've seen so far is from <a rel=\"noreferrer noopener\" href=\"https:\/\/bytesbin.com\/download-view-only-pdf-google-drive\/\" target=\"_blank\">this site<\/a>. Using JavaScript, we can play with rendering picture\/text.<\/p>\n\n\n\n<p>Basically injecting a JS code (ctrl+shift+c) in console, which I will paste below. After hitting Enter and closing the console window, the Save As dialog box shows up and the pdf file saved is not bad.<\/p>\n\n\n\n<p>JS Code:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">let jspdf = document.createElement(\"script\");<br>jspdf.onload = function () {<br>let pdf = new jsPDF();<br>let elements = document.getElementsByTagName(\"img\");<br>for (let i in elements) {<br>let img = elements[i];<br>console.log(\"add img \", img);<br>if (!\/^blob:\/.test(img.src)) {<br>console.log(\"invalid src\");<br>continue;<br>}<br>let can = document.createElement('canvas');<br>let con = can.getContext(\"2d\");<br>can.width = img.width;<br>can.height = img.height;<br>con.drawImage(img, 0, 0, img.width, img.height);<br>let imgData = can.toDataURL(\"image\/jpeg\", 1.0);<br>pdf.addImage(imgData, 'JPEG', 0, 0);<br>pdf.addPage();<br>}<br>pdf.save(\"download.pdf\");<br>};<br>jspdf.src = '<a href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jspdf\/1.5.3\/jspdf.debug.js\">https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jspdf\/1.5.3\/jspdf.debug.js<\/a>';<br>document.body.appendChild(jspdf);<\/pre>\n\n\n\n<p>This is another solution: <a href=\"https:\/\/github.com\/zeltox\/Google-Drive-PDF-Downloader\">https:\/\/github.com\/zeltox\/Google-Drive-PDF-Downloader<\/a><\/p>\n\n\n\n<p>And another, but very similar with the above two:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How to download protected\/view only pdf\/video\/docs files from google drive ?\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/WzQz0oB3R8s?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Of course, nothing can escape Snipping Tool screenshot. But what about the shortest way to convert to a pdf document file? Because Google Drive somehow, giving the ability to restrict viewers from downloading if the owner so chooses, convert the &hellip; <a href=\"http:\/\/nycphantom.com\/journal\/?p=12161\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-12161","post","type-post","status-publish","format-standard","hentry","category-technical"],"_links":{"self":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/12161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12161"}],"version-history":[{"count":4,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/12161\/revisions"}],"predecessor-version":[{"id":12166,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/12161\/revisions\/12166"}],"wp:attachment":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12161"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}