Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Open pdf file with parameters

Avatar

Former Community Member
Hi



I want open PDF file with a parameter (For example: I want open a invoice with the id number of this invoice and load automatically the data), how can I do?



I have thought about it and I believe that I can open the pdf file and fill a special field with this parameter, but I believe that this is not the best way.



Any suggestion?



Thanks



Rubén
5 Replies

Avatar

Level 6
Hi,



I think you can call the pdf passing in a parameter using query string parameters like this:



link_to_the_pdf?parametername=value



Try this link:



http://www.peakforms.com/pdfs/get2pdf2.pdf?First=Neptuno&Last=&Whisky=



Regards

Avatar

Former Community Member
Hello Neptuno!



I downloaded your example but can not find any script that fills the field named "Fist" with the parameter value on rendering, and where is the script that sets "text1" to contain the full URL on rendering?



I opened the PDF in Designer 7.1 but got warnings which I guess has to do with the fact that the PDF is not created in Designer 7.1? Where is it in that case created?



Thanks!

/Annika

Avatar

Former Community Member
Hi Annika

If I understand you, you whant to open a form an fill it with data.

It is posible but not with a command line.

I have don it with an MS Access app, some programming is needed.

ulf.a@dtp-tjanst.se

Avatar

Former Community Member
Annika,



it is in the parse_routines script object.



see:



if (this.external) {

// Display URL in text field

getField("text1").value = this.path;



// returns an array of name/value pairs, eg the names from the url

// and their values.

var a = getPairs(unescape2(getQueryString(this.path)));



// fill the fields with values from the url

for (i in a) {

var f = getField(i);

if (f != null && typeof a[i] != "undefined") f.value = a[i];

}

}



This script is run automatically on start up because it is not inside of a function name.



I am doing something similar and it does work as a method of passing information to the pdf.

Avatar

Level 6
Hi,



You can also use a xdp file, for instance (but you will not able to merge the data without seeing the form).