This topic is locked

PDF Filename Using Field Values

7/19/2021 11:20:08 PM
PHPRunner General questions
J
JoeB7774 author

If a user is clicking a "PDF View", is it possible to change the name of the filename to incorperate fields on that record? For example, there is a field called FullName. I tried changing the "PDF filename" to {%FullName} but it just shows up as exactly that {%FullName}.pdf (instead of putting the persons name in). Is this possible?

mbintex 7/20/2021

programmatically yes with the PDF API

https://xlinesoft.com/phprunner/docs/pdf_parameters.htm

J
JoeB7774 author 7/21/2021

I tried programming with the following code but it seems to get stuck on the second line. I created a custom button and put this code on 'Client Before'. Do you see anything out of place with the following code (shown below)? The only thing I can think of at this point is that valueEmp will have a comma in it as the 'Employee' field is LASTNAME, FIRSTNAME. I tried putting the "valueEmp2" line in with my code (I've shown it way below) but that didnt seem to make a difference.

If I simply use the line "Runner.PDF.download( {}, 'file.pdf', pageObj );" and ommit everything else, it works just fine.... it just doesnt use the field to name the pdf (whcih is what Im trying to do).

var ctlEmp = Runner.getControl(pageid, 'Employee');
var valueEmp = ctlEmp.getValue();
Runner.PDF.download( {}, valueEmp, pageObj );
return false;

//var valueEmp2 = valueEmp.replace(/,/g," ");