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
sksfdc221sksfdc221 

Save visualforce as pdf or screenshot

I have a VF page (standard controller) with an iframe URL and I want the page to be downloaded as pdf or a screenshot on button click.

The issue is that, when i render the page as pdf or when i update my code to capture the screenshot, all i'm seeing is the plain/blank screen instead of page content.

So, as a workaround i am using print option so that i can save the record as pdf.

Below is my VF Page:
 
<apex:page standardController="Account" showheader="false" sidebar="false">
       <apex:form >
            <apex:commandButton value="Print" onclick="window.print();"/>
        </apex:form>
  <apex:iframe src="https://app.powerbi.com/view?r=<custom-url>'" height="540" width="100%" frameborder="0">
  </apex:iframe>
</apex:page>

 Can anyone please suggest the changes to the above code so that I can download the vf page as pdf or screenshot instead of printing and saving it as pdf
Abhishek BansalAbhishek Bansal
sksfdc221sksfdc221
Hi @Abhishek,

Thanks for your reply. I have already tried the solution mentioned in the given link and i am getting plain screen as output. I could only see the button which i have clicked in the screenshot instead of page content.
Abhishek BansalAbhishek Bansal
Hi,

If you just want the screenshot, then you can use the getContent method of the PageReference and stored the return values as a Blob for the attachment. In this way you will get the exact data of the VF page in file or attachment.

Let me know if you need more help on this. For any immediate assisstance you can also reach out to me dircetly:
Gmail: abhibansal2790@gmail.com
Skype: abhishek.bansal2790

Thanks,
Abhishek Bansal.
Golden ClydeGolden Clyde
Businesses often need webpage data to be converted into a PDF so they can see a snapshot of business critical pages. If you need to display a Visualforce page as a PDF, all you have to do is set “Render As” equal to PDF, and voila, it works https://mcdvoice.me/
Tisha MickTisha Mick
Many companies require the data from their webpages to be turned into a PDF format so that they may quickly view a snapshot of their most important website pages. If you want to display a Visualforce page as a PDF, all you have to do is make sure that the "Render As" setting is set to PDF, and then everything will work properly. https://mykohlscards.online/
 
Mary John 6Mary John 6
Frequently, organizations require webpage data to be converted to PDF format in order to obtain a snapshot of critical business pages. To render a Visualforce page as a PDF, simply assign the value "PDF" to the "Render As" property. The conversion will be seamless.https://marykayintouch.online/