passing parameters in to pdf

How do I set up a pdf form to input a parameters passed as part of a URL. I have a Moodle LMS site where I want the course name to be passed into a pdf file. Moodle's parameters section its URL module setting allows you to pass internal information as part of the URL.

Thanks

Ralph


Ralph Blakeslee


3 Answers

Voted Best Answer

The "doc.URL" property contains the complete URL used to open the PDF. If it contains regular URL query parameters you can parse them with ordinay string and array operations. Like this.

// Split out query parameters from end of URL
var strQuery = this.URL.split("?")[1];
// Split Query into array of parameters
var aParams = strQuery.split(";");
// Split parameters into name/value paires
var oNameVals = {};
for(var i=0;i<aParams.length;i++)
{
var aItem = oParams[i].split("=");
NameVals[aItem[0]] = aItem[1];
}

Thom Parker
The source for PDF Scripting Info pdfscripting.com
All About PDF Stamps in Acrobat and Paperless Workflows - THE BOOK !!

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work


By Thom Parker   

Passing parameters via URL is very limited with PDF. You may be able to pass the page to open, but that's about it.

However, you can pass whatever you need using an FDF with the link to its base PDF. You would assemble an according FDFand open it in Acrobat/Reader, and it will pull in the base PDF and add the information into their according fields as well as run the specified JavaScripts.

Hope this can help.

Max Wyss.


Max Wyss   

I have developed a script that allows you to populate form data in a PDF directly from the URL, without the need to use an FDF file. Have a look here for more info about it: http://try67.blogspot.com/2011/09/acrobat-populate-form-data-from-url.html

-------------------------------------
Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com


Gilad D (try67)   


Please specify a reason: