function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nextdoornextdoor 

Include Page & parameter

Hi,

 

I can generate some PDF files from different records one by one but I want to generate them all from one button for example.
I was planning to create a Visual force page and add several include page like this:

 

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx1" rendered="true"  />

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx2" rendered="true"  />

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx3" rendered="true"  />

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx4" rendered="true"  />

 

But it is not working. It is really not possible to pass parameters to an include Page like ? Is there some workarounds or something ?


Thanks

 

Best Answer chosen by Admin (Salesforce Developers) 
lrw7572lrw7572

In order to save the file as a pdf the page needs to redirect. One way i have found of getting around this is to use Salesforce Documents (although it won't be downloaded straight to your computer). To do this, create a new pagereference in your controller without redirecting, create a Document record, and set the Document body to the PDF using the "getContentAsPDF" function on the pagereference. I have done this for up to 50 PDFs at a time, but you do have to be aware of view state size limits.

All Answers

lrw7572lrw7572

In order to save the file as a pdf the page needs to redirect. One way i have found of getting around this is to use Salesforce Documents (although it won't be downloaded straight to your computer). To do this, create a new pagereference in your controller without redirecting, create a Document record, and set the Document body to the PDF using the "getContentAsPDF" function on the pagereference. I have done this for up to 50 PDFs at a time, but you do have to be aware of view state size limits.

This was selected as the best answer
nextdoornextdoor
I also have done something similar, I think it is the only way to do this.

Thanks.