Password protect a generated PDF from page - javascript

I'm currently using PHP for retrieving data and the JavaScript print function for my inventory reports and my staff saves it in pdf form. This is the sample output:
Everything works perfectly but I have a security issue. I want my staff to not be able to open the pdf, thus securing it with a password.
Is there, by any chance, a way to do this? Like whenever they click a button, instead of the print dialog box (ctrl+ P) opening, it will directly open a save to dialog box and it will automatically have a password so that I can be the only one who can view and print it.
Or is there a PDF library for this?
Any help would be much appreciated.

Found a library and it works as expected.
http://www.html2pdf.fr/en/download

Related

Downloading/Saving HTML embedded PDF with JavaScript

I have a page with embedded PDF.
<object data="/files/documents/somepdf.pdf" type="application/pdf"></object>
The embedded PDF has a form that user can edit.
This PDF view has a button (top right save/print icon) that allows user to download edited document.
Question - is there a way to manually download or save edited PDF with JavaScript?
My goal is for user to be able to click on "Submit" button and it takes the filled out form and sends it to some API end point in my system.
Question - is there a way to manually download or save edited PDF with JavaScript?
That's a loaded question, As with ALL PDFs the Form has been downloaded into the users browser or external pdf viewer, so no your JavaScript cannot touch it, see the downloaded address at the top.
The other implied question is can the file be saved after edit by the user clicking the icon, and that answer is perhaps. See the Adobe banner when a user attempts to edit the restricted form.
Thus the user must print the form with handwritten entries and signature, then mail it using their choice of US snail mail or web mail provider.
It also depends very much on which Browser and form they are using since here the user Fred has printed some entries and thus can continue another time after going bowling
Note the forms layout has changed overtime. :-) and the wrong surname that needs re-edit later.

Settings for Javascript window print

I would like to print my webpage as an pdf with the window.print(). Right now I just get the dialog box up as default. I was wondering if I could make it select print to pdf and then proceed by it self.
I have tried classes like dompdf etc., but this print to pdf is really what I need here. So if it is possible to set some default printing settings and maybe make it automatically, then let me know.
As mentioned in the comment no you cannot do this. Also not sure if you have custom print button or you are using Ctrl+P shortcut.
In cases you may see a PDF is opened in a new tab and you can download from there.
Otherwise in operations like bank account summary download , generally handled by a kind of form submit , and the pdf is created by controller/service layer by using PDF Generator like iText.
HERE is a link for information on PDF open source library.

Image button - print a document from my webpage

I have a website, but I need a button which I want to print a specific .pdf file from my webpage database.
As an example, this site
has a print button, which gives you option to print some pdf files
Any idea how can I do that?
I've tried this one, but it's not working:
<a href="../Documents/ScrittoGraffito/Scritto_Customers/Nicolaides_Optical/Nicolaides_webpage/Shop1_Banner.pdf"
onclick="window.print()"/><p class="test">link</p></a>
That code will tell the browser to open the print dialog for the current page.
If you want to force the browser to print the linked pdf then that is not possible, as it will be completely controlled by the application or plugin that handles pdf documents.
EDIT;
Apparently it is possible, but you have to make use of a pdf toolkit.

print a pdf via javascript

I have a HTML page that has a link to a PDF. This PDF opens in a new window.
The parent HTML page has a File->Print menu item. When the user clicks Print I want to be able to automatically open the PDF and print it. The printing part is where I am stuck.
Any help would be much appreciated.
Thanks.
If you open that window with a specific name (e.g. target="nameofwin") in the link pointing at the PDF, you might get away with nameofwin.print(). However, I'm not sure if that'd work since the PDF will be shown using a plugin, and not be a native part of the page. There may be some API that allows you to interface with the PDF display plugin, but then you're stuck wondering if you've got Acrobat or FoxIt or WhateverElse running in there.
You can probably use PDF.js to render the PDF in a hidden div. Then, on your "print" button, register a click in which you add a new print stylesheet to the document, show that div, print the window and then remove the print stylesheet.

Print/save full webpage as PDF

I need a method to be able to print/save the current full webpage as a PDF.
I know it can be done if I download a PDF printer and print to that; but I need it to be done without the user having to do anything other than click a button in a webpage.
I can't do it via PHP as the page is all client side content, so I'm guessing an ActiveX component?
Any ideas would be greatly appreciated!
Many thanks
Try www.freepdfconvert.com - they also have a javascript one click PDF download from any page.

Categories

Resources