Is it possible to render a VF page as a PDF inside the same page in specific section ? for example I have page with the following hierarchy, And the PDF will display in the second pageblock, is there iframe or something can use ? or using VF components ? or including VF page ?

     <apex:pageBlock title="Select Account">
          // here the select options for available accounts.
     <apex:pageBlock title="Account Information">
          // reRenderAs PDF here with account info, according to the selected Account.

I just tested this and it's some what possible, but very limited. It will involve you separating the components you want to render to different visualforce pages. The code is shown below, but please keep in mind, this is very limited. For example, if you are running any sort of logic after your constructor, rerender, etc, it will not display the changes. This will only display what ever is done at the time your page loads / constructor runs.

Apex VF page Test1:

<apex:page standardController="Account" >
    <apex:detail relatedList="false" title="false"/>
    <iframe src="/apex/Test2?id={!Account.Id}" height="800px" width="800px"/>

Apex VF page Test2:

<apex:page standardController="Account" renderAs="pdf" >
            <apex:outputField value="{!Account.Name}" />

  • But, I'm using reRender ! I'll try to set id as a parameter in the url – user3003810 Mar 3 '14 at 17:38

It work only with :

If we used <

apex:pageBlock> and <apex:pagesection>
It will not show desired output.The entire page load as pdf and content of two pages will show in pdf format.

<iframe src="/apex/Test2?id={!Account.Id}" height="800px" width="800px"/>

just pass the id of any account on URL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.