Downloading/Saving HTML embedded PDF with JavaScript - 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.

Related

Save Changes and Email PDF (Chrome)

I have PDF form hosted on a local server
I created a web page where this form is embedded via iFrame
I have a submit button on that page said page
What I need to figure out:
If submitBtn is clicked > save the PDF with the user's changes to a
predetermined location on our network with a unique name (could be a
simple numeric iteration) > generate a link to that file for the user
to copy
If this possible? I'm very new to JS.
Thanks!

Password protect a generated PDF from page

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

Print PDF Created in iTextSharp and then Return Control to Browser

This is somewhat of a return to my 2012 question - Is it possible to fire a keypress event for an iframe that has been used to load a PDF file, I think I may have been mistaken accepting the answer there.
The current situation is this -
The document of the main page has an onkeypress event attached to it which will load a PDF into an object when the user scans a particular barcode.
The PDF is created using iTextSharp and has the open action set - writer.SetOpenAction(new PdfAction(PdfAction.PRINTDIALOG)) (writer is a PdfWriter).
So a user will scan the barcode which automatically loads a PDF file which opens it's print dialog. The user will then choose the printer and print the PDF. The problem comes when the user wants to scan the next unit they need to click somewhere within the html body (but outside of the PDF object) and then scan the barcode for the new PDF to be loaded.
I had a look at this and saw that it is possible to setup some kind of communication between the PDF plugin and the browser but is is possible to tell the plugin to surrender control to the browser/javascript
EDIT
Some extra background information -
I've tried using both objects and and iframes.
Using the debugger, if I type document.activeElement.id gives the ID of an element an appropriate element however (in the case of text inputs) any key presses do not appear.
Using the debugger I can use blur the active element bring focus to another element even change the value of an input but no user input is seen by the HTML/javascript when the user types/scans.
This is a legacy application runs in Internet Explorer compatibility mode.
Just to sum up - I want to scan a barcode which will open a PDF (already done) which opens it's print dialog automatically (already done) the user prints the PDF and then without any further human interaction with the page (i.e. the user does not need to use the mouse or keyboard after clicking the print button in the print dialog) the user should be able to scan another barcode which will open a new PDF.
Rather than render the PDF inside an iframe/object, why not take advantage of modern HTML5 and Mozilla's hard work and render it using https://github.com/mozilla/pdf.js/ - it is a fully HTML5/javascript PDF renderer and does not require any plugins.
There is a nice online demo at http://mozilla.github.io/pdf.js/web/viewer.html
Then you would be on the same page with JavaScript all the way down and could avoid having to pass focus/events etc between the two environments, so you could catch events anywhere on the page easily enough.

How to display a java script window in adobe acrobat

In adobe acrobat I want to make a pdf file in which when the user is going to open it,it shows some content and asks user to click on agree or disagree button.When user click on agree button it shows original content of file and when click on disagree button the file automatically be closed without showing the original content.
Please tell me how I do the same by using adobe acrobat tool.
In the PageOpen event of the page where the document opens, initiate an alert with Yes and No as answer. Evaluate the response, and in the case of No, close the document without saving.
You might have a look at the Acrobat JavaScript documentation (which is part of the Acrobat SDK, downloadable from the Adobe website), in particular the entries about app.alert().
And that should do it…

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.

Categories

Resources