renderAs PDF in the same page

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.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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}" />

Method 2

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

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x