This topic is locked

PDF filename - can be dynamic?

6/14/2022 4:16:04 PM
PHPRunner General questions
P
ppradhan@live.com author

Hi sir, Is it applicable to have PDF filename dynamic that takes one of the filed value? Please find below the preview of list page, and the create PDF button.

img alt

mbintex 6/15/2022

with the PDF API and a custom button you can:

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

Document appearance options

filename {string}

Sets the PDF file name. Default value: 'file.pdf'.

Sergey Kornilov admin 6/15/2022

Yes, use PDF API for this purpose.

P
ppradhan@live.com author 6/15/2022

I created custom button and added below code but no luck. Please help me where I've done mistake?

Client before:
var params = {
table: 'bills',
page: 'print',
pageType: 'print',
selection: pageObj.getSelectedRecordKeys()
}
Runner.PDF.download( params, {bill_id}, pageObj );

{bill_id} is the dynamic key I want to use as pdf Name while downloading. Please help.
mbintex 6/16/2022

I don“t see the

filename {string}

parameter in your code

P
ppradhan@live.com author 6/16/2022

I inserted custom button in the grid (list page) and code as below. Now, I can get the file name correctly from the field I choose, but one problem appeared, that is it downloads all the data and not just one. How can I get this fixed? please help.

Preview:
img alt

Custom Buttom: Client Before:

var ctrlID = row.getFieldValue("id");
var ctrlINV = row.getFieldValue("inv_no");

var params = {
selection: ctrlID
}
Runner.PDF.download( params, ctrlINV, pageObj );