This topic is locked
[SOLVED]

Create PDF on the list view

2/29/2024 7:22:02 PM
PHPRunner General questions
Y
Yoann author

Hi,

I've created a view page that I'm using for PDF generation. I'm satisfied about the layout and it's working good if I'm using the Create PDF button on my record view page. But I would like to have this button on the list view as well. I added a column and added the button. The problem, on the list view the generated PDF is on the first record of my list and not the record where is the button.

Do you know if it's possible to have this PDF button on my list page generating the PDF for the matching record ?

Thanks

Y
Yoann author 3/1/2024

Hi,

So it's working but I've 2 view pages. The normal one so view the record on the web and another one that I design for PDF. I called it "pdf"

img alt

I tried to change "view" by "pdf" in the code but I have a blank page "about:blank" any idea about that ?

Best regards

D
DRCR Dev 3/1/2024

I havent tested it, but I would make the PDF the default view page, and then link all views that you want to see the non-pdf to that exact page in the settings (usually on the right when linking, and in the top menus and menu.php)

Y
Yoann author 3/1/2024

Ok so the code offered to generate the pdf on the view page is :

var params = {
pageType: 'view',
keys: row.getKeys()
};
Runner.PDF.open( params, pageObj );
return false;

if you want to use a specific page you can custom like that :

var params = {
page: 'pdf',
pageType: 'view',
keys: row.getKeys()
};
Runner.PDF.open( params, pageObj );
return false;

In this case it will use the page pdf instead of the default view page.

Thank you for your help :)

D
DRCR Dev 3/1/2024

I'm so glad it worked out and thank you for sharing your final code. I've saved it to my "Good Code" repo.