Is there any way to prevent PDF download and printing option from browser ?
I am using PHP codeigniter for uploading the PDF file from admin side. I want to restrict the download access, inspect access, page source access from user side. Users only need to read the PDF.
So is there any way to do this using PHP or Javascript?
Users can take screenshots, which is not a problem. I only wan't to prevent the pdf url and download access in all aspects.
Do we have to convert PDF to any other format for this?
Related
I am writing a Chrome extension that manipulates PDF files and am looking to get all the text of a PDF file that's currently open in Chrome's PDF viewer.
I learned from
How can I get selected text in pdf in Javascript?
how to get selected text, but I couldn't find in the API a function that extracts the entire text (or better yet the PDF itself, and then send it to a server). Is it possible?
I am aware of the solution of sending the URL and downloading it on the server side, but sometimes it is problematic (e.g. PDFs from password-protected websites).
Thanks.
I have tried looking in the API, https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/resources/pdf/pdf_scripting_api.ts
I have also tried "downloading" the PDF on client side and sending it as Blob to a server, but it's a problematic solution (sometimes blocked for example, requires extra permission).
1) I am currently downloading pdf of web-page using function window.print()
2)but now i want to send that downloaded pdf in email as a attachment.
3)I am not able to access that pdf in my code
how i will be able to send that email with pdf in just one click?
You can try get a screenshot of your window then put it on a pdf.
see this two plugins
http://html2canvas.hertzen.com
https://parall.ax/products/jspdf
I have a URL http://test.com/test.pdf this link opens the PDF in browser fine. Now I have a form inside this PDF like first name, last name etc.
The user fills in this form and I want to upload it to server. The Save button inside PDF would save the file locally. Instead I need a separate Save button that can convert the PDF and it's data to byte array and submit to my server.
Is this possible?
Unless you limit which PDF viewers can be used, you won't be able to do this. Most modern browsers will display the PDF with their built-in viewer but most of them can't deal with forms and when they do, they get it wrong. However, if you can force the PDF to download and open in Adobe Reader, you can add a button to the PDF that will submit the entire filled form to your server as the body of an HTTP post (not a file in a multi-part form submission). When creating the submit button, use a fully qualified URL to your script that saves the file to your server. It's super easy.
I want to store pdf files client side in one of the HTML5 storages (indexedDB or localstorage) and then open them later with the adobe reader.
The scenario is as follows:
The user visites my site and downloads a bunch of pdf's into a storage
Later the user revisits the site and wants to view one of the pre downloaded pdf's.
He chooses one of the stored pdf's and it gets rendered with the adobe reader (or the
default pdf renderer).
Is this possible with pure html5/js or do i have to write a firefox extension?
You can use the data URI scheme (http://en.wikipedia.org/wiki/Data_URI_scheme).
Something like this, but with a PDF:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKBJREFUeNpiYBjpgBFd4P///wJAaj0QO9DEQiAg5ID9tLIcmwMYsDgABhqoaTHMUHRxpsGYBv5TGqTIZsDkYWLo6gc8BEYdMOqAUQeMOoAqDgAWcgZAfB9EU63SIAGALH8PZb+H8v+jVz64KiOK6wIg+ADEArj4hOoCajiAqMpqtDIadcCoA0YdQIoDDtCqQ4KtBY3NAYG0csQowAYAAgwAgSqbls5coPEAAAAASUVORK5CYII=
You can see this example at its original page: http://iconhandbook.co.uk/reference/examples/data/
Create links with PDF type and base64 encoded data (representing the PDF binary)
PDF name
The base64 encoded content can be stored in HTML5 storage.
Warning: does not work for IE (excuses for security reasons).
I am automataing a webbased application using Selenium Webdriver.
A report is generated in PDF format is opened Acrobat reader. I have to save that PDF to a specific location and then close the pdf. So how can it be done thru automation. I tried searching on net and found this can be done using VB script but then need Adobe professional version for the same. Also the report that is generated doesnot have a specific title. That keeps changing.
Can this be done using javascript ?
Thanks
It's possible to generate some PDF in JS, try http://snapshotmedia.co.uk/blog/jspdf
It will return you an base64 string or an URI. Then you can redirect your visitor to the PDF (with this URI) or write down the base64 in a file.