How to apply password prompt javascript on acrobat pdf - javascript

I have a pdf which needs a javascript prompt that would asks for a username and password or just one of these. I have tried the native javascript way inside the javascript editor of acrobat. Alerts work fine but prompts are not working for me.
var customerName = prompt("Please enter your name", "");
have also tried
var customerName = app.prompt("Please enter your name", "");
EDIT:
WEll i tried to remove the complex parts of the process so that you guys can understand better. but i guess i owe you guys some explanation on what i am trying to achieve.
Well i have an empty pdf which i am going to send to my users and when it is opened it will ask for a username/password which is then submitted to my website through an api. I already have an api in place which would check for the correct credentials and on success would print the desired pdf content on a php page, which could be grabbed as a curl request through the javascript inside the empty pdf. And when i want to revoke the access to the user i would just delete the user from the database on my server. So the next time he wants to read the pdf he wont be able to pass through the api security.
Well i know there are some drawbacks on applying so many restrictions like pdf reader compatibility etc. but even if it only works on acrobat that would be fine. Later on will try to remove the print and save options etc.
Most of the parts are done the only thing i am stuck at the moment is on how to send a form GET request to a url. I think js prompt doesn't work in acrobat so i guess i have to send the data through an acrobat form. Any one knows how can i send a get request through the forms or get the values of input boxes in javascript?

Thank you everyone, i just found out on how to post data to a webpage. Here is the link,
Can a PDF fillable form post itself to an HTTPS URL?
Instead of choosing "PDF the complete document" from the format options, choose html.

Related

How to access free hand signature added by user to PDF using Javascript?

I have a PDF document that is signed by user as described here (scroll to "Sign or Initial your form" section): https://helpx.adobe.com/reader/using/fill-and-sign.html
This PDF has Javascript attached that submits form data contained in the PDF to an URL. I would like to submit the user signature image but I don't know how to access it. I have tried "this.getAnnots()" and "this.dataObjects" but they are both empty. I see no other places I could look for the data. The PDF Javascript API is described here: http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf
Please help
You can't. At least not through the Acrobat JS API. The image data for that type of signature is stored in a dictionary specific to Adobe Sign and there is no public JS API to it.

Getting email headers from within an HTML email for tracking purpose

Posting question in StackExchange for first time. Apologies if this has issues...
Need to track email open.
This is something not very new and the approach generally used is to have a pixel in the HTML which calls a server URL asynchronously. By using this we get the number of opens for an email.
Now the issue is the email is send to a Distribution List (DL) and we have a requirement to track email open and also clearly state who has opened it..
Basically when a hit to server comes, it should says xxxx#mail.com has opened this email.
In my HTML if i have a way by whcih to capture the email headers, my requirement would be sorted... I would use Javascript to get the email headers and then when i call the server URL i will send across the details...
When i searched i found a POST which was doing something similar...
Read email headers in Outlook Web Access (OWA)
But this was for office application...
Also, i am not sure whether this would even work...
Any pointers is well appreciated....
I am specifically at the moment looking for exchange server...
In my HTML if i have a way by whcih to capture the email headers
You don't.
I would use Javascript to get the email headers
You can't run JavaScript in an HTML formatted email
The only identifying information you can get back from the email is the information you put it in it in the first place.
You can put a unique ID in a tracking pixel (increasing the chances of it being marked as spam) but that ID will be given to anyone who gets a copy of the email (including if it is forwarded automatically by a mailing list or manually by a reader). The tracking will also fire only if the image is loaded from the server (plenty of people keep email image loading turned off).
There is no way to find out who your email actually ended up with.

how to save changes on website with textbox

Im new at web developing.
I want something like:
A website, that everyone can enter. on the website u have 2 parts: one is filled with textbox so any user can write something in it and click button 'save comment'. He other side is filled with the execution of that button(it displays added text comment -but not just for a moment but that text is saved on that website). Simple as that...
Do i use java script?
Ive been looking for the answers but kinda didnt know how to ask gooogle bout that
scheme on that website:
----------------------/----------------
-textbox--------------/--constant text-
--add comment button--/--wrote by user-
----------------------/----------------
You have many possible ways to do that. One of the ways is to use html with jquery and send the result via web service (.asmx for instance) and save that result in a database (MSSQL for instance). So everytime you load the page you can get those saved results and display it on the relevant page. Another way is to use php with mysql or to use java...
If you don't want to use databases and server side code you can save the results in a cookie and then display those results in the page.

Fill PDF form with javascript

This is what I have:
User fills very long html form
User gets link to download different pdfs (this are fillable forms), links are generated using javascript
User clicks link, url is generated (with the data the user submitted before), data is processed in the form and fields are completed *this is done using javascript inside the form).
User get pdf back with fields completed.
The problem I'm running is that in some cases the data needed to send to the form is around 8000 characters, when IE only allows 2083 character in the url.
As requested by client, we need to do everything client side, that means no access to php, c#, java. Also I'm using Acrobat Pro X, to work with the pdfs.
Is there a way to submit a post request, process that request in the pdf, fill the form and return the filled form to the user? Is there another way to go around the 2083 character limit of IE?
Why do you need to send 8000 characters of data to the server if you want to fill out the form on the client side? Seems like all you need to do is to establish communication between the JavaScript in the HTML page and the JavaScript in the PDF. This is explained here: PDF hostContainer callback
PS: I'm the author of the book from which this excerpt was taken: http://www.javabeat.net/2011/04/javascript-communication-between-html-and-pdf-in-itext/

Popping up a window for the user to show some data?

I have a webapp where my users might want to get some data from me in xml format. The flow I was thinking of:
User clicks a button named "export"
I generate a long xml string using javascript.
Pop up a new window and just paste the xml string into it.
I would prefer saving the xml string into a text file for the user, but I don't think this is possible with javascript (security reasons).
Are there any other best practices for doing something like this? I guess this will work fine,
Thanks
You can add a hovering text field to the page and paste the XML into that. To make things more simple for the user, set the focus to the field and select everything (so they only have to press Ctrl+C).
If you can access server-side pages, you can generate the XML string using javascript, make an ajax call to give the server your string, then make the user download the generated file.

Categories

Resources