I have used the following cod to render as PDF, but website is not render when using the render as PDF/ but if I remove the PDF, the webpage is loading.


   <apex:page render="pdf">
// external webstie link (ex: bing.com)

please refer the following.


We cant render as pdf. we can render only when using the third party tool.


You can't put iFrames, Javascript and that sort of stuff in a PDF. The PDF render engine only looks at the DOM as it is when the page is loaded (HTML/CSS/VF).

You can get the content of the website (the source code) but there is no way to render that as a PDF in your visualforce page. Below is a code how to get the content if that helps:


public with sharing class MyClass
    public String content {get; set;}

    public void init()
        PageReference pageRef = new PageReference('https://google.com');
        content = pageRef.getContent().toString();


<apex:page controller="bbtest" action="{!init}" renderAs="PDF">
    <apex:outputText value="{!content}" />

You need to add the external website's domain name in Remote Sites.

You can probably use a headless browser and some fancy screen capture method, then add that as an image into your VF PDF, but that's a challenge that I'm leaving with you and good luck :)

  • I don't know what you're trying to achieve here. But if you're about to load another website and generate PDF out of it, you won't be able to do that unfortunately. Aug 7 '14 at 7:38
  • You can't do that. You can get the source code of the page but you won't be able to render "as is" on your page. I've updated the answer of how to get the content of the page if that helps. Aug 7 '14 at 7:55
  • Because the PDF renderer does not support that. It only looks what is on the page at that given moment when the page loads. The PDF renderer is not capable to interpret Javascript or to load an iFrame etc. salesforce.com/us/developer/docs/pages/Content/… Aug 7 '14 at 8:14
  • Let us continue this discussion in chat.
    – Lemon
    Aug 7 '14 at 8:23
  • You are give useless answer. pelasee provide the answer or else please allow some other person.
    – Lemon
    Aug 8 '14 at 5:26

I just found one work around for this. We can use third party API to convert any URL into PDF.

Here is site that provide this service

Please note that this is paid service.

They also have Rest API that we can call from SFDC.

Here is sample PDF that i generated for testing.

enter image description here

  • Hi please look the question and provide the solution. how to load the external website with in the vf page and show as the pdf?
    – Lemon
    Aug 8 '14 at 5:30
  • For including page just use Iframe and for generating PDF use the solution provided above. Aug 8 '14 at 5:40
  • Ok I will use the IFrame but how to make the pdf, I dont see the code in your answer. but that is paid verson so please help easiest way.
    – Lemon
    Aug 8 '14 at 5:58
  • This is the easiest way i know my friend. Call Rest API and get the PDF! I do not have code ready but you should be able to figure that out. Aug 8 '14 at 6:02
  • Call Rest API and get the PDF! is too may stuff so can you guide anyother way?
    – Lemon
    Aug 8 '14 at 6:09

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.