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
Newbie2013Newbie2013 

Auto Populate PDF with Fields from Custom Object??

Is there a way to auto-populate a PDF with fields from Custom Objects

ryanjuptonryanjupton

The easiest native way is to create a custom Visualforce page with the renderAs attribute set to PDF. Include the fields you want in the pdf in the custom page. As an example, here's a page that prints a list view of accounts with name and annual revenue. You can use also cusom objects and standard or custom controllers.

 

<apex:page standardController="Account" recordSetVar="accounts" renderAs="PDF">
    <apex:form >
        <apex:pageBlock >
          <apex:pageBlockTable value="{!accounts}" var="account">
                <apex:column >
                    <apex:facet name="Header">Account Name:</apex:facet> 
                    <apex:outputField value="{!account.Name}"/>
               </apex:column>
              <apex:column >
                    <apex:facet name="Header">Annual Revenue:</apex:facet> 
                    <apex:outputField value="{!account.annualrevenue}"/>
               </apex:column>
          </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 Please clarify if you had something else in mind.

sandeep@Salesforcesandeep@Salesforce

There is only one way to generate PDF out of any VF page where you are showing custom field of any custom object. 

<apex:page  standardController="Account" rendeAs="pdf" >

<apex:pageBlock>

<apex:outputfield value="{!Account.Name} />

</apex:pageBlock>

</apex:page>

Newbie2013Newbie2013

I already have a PDF form , I want to populate some of the fields in the PDF form with the Salesforce custom object info either with a button or other option. Is there a way to do this?