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
HTANIRSHTANIRS 

How to add Multiple visualforce pages and combine as single.

Hi Experts,
I have a requirement to add Multiple visualforce pages to combine as single page. This Visualforce pages are render as PDF. 
I want to create a new page like wizard where I need to display some vf pages and provide users to select the page and save. Once saved I need to attach them to record.

Kindly need inputs how can I approach.

Thanks.
Raj VakatiRaj Vakati
You can do it like below  using  apex:include or apex:composition

<apex:include> is used when you want to insert that page as it is in your current page. The entire contents of that page is copied in your current page.
<apex:component> is defining a component before using it. In simple words, lets say you define that ‘myValue’ component is a string type but the value to that string will be assigned in the destination page.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_include.htm
https://blogs.perficient.com/2015/03/16/how-to-embed-visualforce-pages-in-visualforce-pages-issues-and-solution/
<apex:page>
    <p>Test Before</p>
    <apex:include pageName="MainPage"/>
 <apex:include pageName="MainPage1"/> 
    <p>Test After</p>
</apex:page>

 
HTANIRSHTANIRS
Hi Raj,

Thanks for your reply. The above will make all VF pages which mentioned in include Tag as single PDF.
But I want user to select visualforcepages and renderas PDF and attach to record.
For Eg: I have 3 VF pages and user select 1 and 3 page and clicking save. Then I want to attach that 2 pages alone as a pdf in attachment object.

Kindly need your inputs.

Thanks.