Uncategorized

How to create a PDF page

Hello everyone!

Today we will learn how to create a PDF page in Salesforce!
Imagine for a minute that, after choosing Salesforce to better manage your business, your HR  Dpt needs to extract a candidate’s information as a PDF. Knowing it is not part of the standard functionality of Salesforce, how will you do?
We will proceed in two steps
1) Creation of a Visualforce page
2) Creation of static resource page

This is your Applicant detail page

PDF3

Here your PDF page you wish to have!

1) Creation of a Visualforce page

<apex:page standardController = ″Applicant__c″ RENDerAs = ″PDF″ >

<apex:image id=″popo″ value = ″{!$Resource.toto}″ width = ″100″ /><br/><br/>

<apex:stylesheet value = ″{!$Resource.logo}″/>

<apex:form >

<apex:pageBlock >

<!– Fields –>
<h2> Détails Applicant</h2>

<h1>PROFILE</h1>

<apex:pageBlockSection columns =″1″ >
{!Applicant__c.Profile__c} &nbsp;&nbsp; <br/><br/>
<b>Address:</b> {!Applicant__c.Address__c} &nbsp;&nbsp; <br/><br/>
<b>Phone:</b> {!Applicant__c.Phone__c} &nbsp;&nbsp;<br/><br/>

<b>Nom:</b> {!Applicant__c.Name} &nbsp;&nbsp; <br/><br/>

<b>Salary Requirements:</b> {!Applicant__c.Salary_Requirements__c} &nbsp;&nbsp; <br/>

<h1>PROFESSIONAL EXPERIENCE</h1>
<table>
<tr>
<th>Product Manager </th>
<th> Consultant </th>
</tr>
<tr>
<td>{!Applicant__c.second_experience__c }</td>

<td> {!Applicant__c.First_Experience__c }</td>
</tr>

</table>

</Apex:pageBlockSection>

<apex:pageBlockSection columns = ″1″ showHeader = ″true″ >
<h1>EDUCATION</h1>

<b> Previous Experience: </b> {!Applicant__c.Previous_Experience__c }<br/>
<b> Education: </b> {!Applicant__c.Education__c}&nbsp;&nbsp;<br/>
</apex:pageBlockSection>
<apex:pageBlockSection columns = ″4″ showHeader = ″true″ >
<h1>OTHER INFORMATION</h1>
<b>Languages:</b> {!Applicant__c.Languages__c} <br/>
<b>Interests:</b> {!Applicant__c.Interests__c}
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

**********************************************************

2) Creation of static resource page

For the beautiful look at your page PDF, create resource static!

<style>
body { font-family: Arial Unicode MS;background-color:Aqua;}

h1 { color:Maroon;}
h2 {text-align: center; margin: 0; font-size: 1.5em; font-weight: normal;background-color:Maroon; color:white;}
</style>

After do the two steps, you will obtain your PDF page and add your visualforce page in bouton impression.

Leave a Reply

Your email address will not be published. Required fields are marked *