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
Vadivel MuruganVadivel Murugan 

Save as pdf in salesforce standard page

Hi All,
          I have create a button in Account standard page as "Save as PDF". When i have to click that button to save the current Account standard page save as pdf. If any know how to save Standard page as PDF.
Keyur  ModiKeyur Modi
Hi,
For this you need to create VF page same as standard page and you need to use renderedAs= "PDF" , and onclick on the button you can cal that VF page.

please letme know, if this will help.

Thanks,
Keyur Modi
Vadivel MuruganVadivel Murugan
Can i save without using page
 
Keyur  ModiKeyur Modi
Hi,
I don't think withough creating the VF page you can achieve this.


Thanks,
Keyur Modi
Jitendra RawatJitendra Rawat
Hi Vadivel,

You can use such like code for save standard detail page render as PDF
<apex:page standardController="Account" renderAs="PDF">
  <apex:detail/>
</apex:page>
From the button on detial page redirect to this page will save the detail page as pdf.

If you think this will help you please select this as best answer.

Thanks
Jitendra
Rajbarath GovindanRajbarath Govindan
Yes you can do with hitting a save button. Things you would have to do is,

1. Create an Apex Page.
2. Create an Apex controller (which will read the Salesforce Force standardPage) which is referenced from Apex Page. Here is some sample code
 
<apex:page Controller="RenderKT" renderAs="pdf"   applyHtmlTag="true"  applyBodyTag="true" sideBar="false">

<apex:outputtext value="{!KnowledgeURL}" escape="false"/>
</apex:page>
 
public class RenderKT
    {
    public String getKnowledgeURL()
        {
        String KAId = ApexPages.currentPage().getParameters().get('KAId');
        String KAVerNum = ApexPages.currentPage().getParameters().get('KAVerNum');
        String URL = '/knowledge/articlePrintableView.apexp?id='+KAId+'&kavVersion='+KAVerNum;
        return (new PageReference(URL).getContent().toString());
        }
    }

NOTE: our objective was to download the knowledge article as PDF. Hope this helps.
Rajbarath GovindanRajbarath Govindan
A small correction - mean to say without hitting the button. All you need to do is - invoke the custom Apex Page created, by passing the page URL you wanted to invoke as URL parameter to this custom apex page.