4

I have used the following code but the page shows as teh blank. but if we remove the render as pdf. the page shows the webpage.

Code:

<apex:page renderAs="pdf">
  <apex:iframe height="300" width="180" src="https:www.google.com"  scrolling="true"  /> 
</apex:page>

2 Answers 2

0

We cant render as PDFs the webpage. so just render as content and load into the outputpannel with the css style.

2

You had a slight error on your apex page declaration (you originally had render prior to editing your question), it should actually be:

<apex:page renderAs="pdf">

Having said that, <apex:iframe/> is on the unsafe list when rendering as a PDF, so the content of the iFrame will not be displayed when displayed as PDF - hence the blank page.

Check here for best practices for rendering as PDF.

EDIT: Since you've edited your original question again to show the real page you're using (rather than google.com), why don't you modify QOTD__QuoteMiniViewer to render as PDF, say if you pass in a parameter? For example:

<apex:page renderAs="{!if($CurrentPage.parameters.p == null, null, 'pdf')}">
<!--page content-->
</apex:page>

Or, you could use <apex:include/>

6
  • You've edited your question now to show renderAs, it did show render. However, as I've stated <apex:iframe/> is on the unsafe list. Sep 1, 2014 at 9:30
  • Yes. I have edited due to the spelling mistake. Can you help for the show the website as pdf? Sep 1, 2014 at 10:03
  • I don't think you'll be able to do that because of the <img>'s in the page you're trying to display which is not supported when rendering as PDF. Sep 1, 2014 at 10:22
  • @phil i dont want to render the content. i want to render the what exact shows in the vf page. can you help?
    – Lemon
    Sep 2, 2014 at 10:53
  • @Lemon, can you clarify the difference for you between render the page content vs. rendering the vf page exactly? The renderAs attribute will display the vf page's rendered content as PDF (salesforce.com/us/developer/docs/pages/Content/…).
    – Doug Ayers
    Sep 9, 2014 at 5:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .