function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
<apex:page standardController="Account" extensions="ControllerPDFAccountPage" renderAs="pdf"> <apex:form > <apex:pageBlock mode="maindetail"> <apex:pageBlockSection columns="3" > <apex:pageBlockSectionItem > {!$Organization.Name} <br/> {!$Organization.Street} <br/> {!$Organization.City} <br/> {!$Organization.State} <br/> {!$Organization.PostalCode} <br/> {!$Organization.Country} <br/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <h1 style="width:400px;"> </h1> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:image url="{!URLFOR($Resource.cloud, 'cloud.jpg')}" width="200" /> </apex:pageBlockSectionItem> </apex:pageBlockSection> <hr/> <apex:pageBlockSection columns="3"> <apex:pageBlockSectionItem dataStyle="color:red;" > <!-- Account Name : --> <apex:outputField value="{!accObj.name}" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <h1 style="width:400px;"> </h1> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem labelStyle="float:right;" > {!accObj.BillingCity }<br/> {!accObj.BillingState}<br/> {!accObj.BillingPostalCode}<br/> {!accObj.BillingCountry} </apex:pageBlockSectionItem> <br/><br/> </apex:pageBlockSection> <apex:pageBlockTable value="{!conList}" var="con" border="1" > <apex:column value="{!con.Name}" style="width:300px;"/> <apex:column value="{!con.Email}" style="width:300px;"/> <apex:column value="{!con.Phone}" style="width:300px;"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page> *******************Controller************************************ public class ControllerPDFAccountPage { public Account accObj{get;set;} public List<Contact> conList{get;set;} public ControllerPDFAccountPage(ApexPages.StandardController controller) { conList = new List<Contact>(); conList = [SELECT Name, Email, Phone FROM Contact WHERE AccountId =:ApexPages.currentPage().getParameters().get('id')]; accObj = new Account(); accObj = [SELECT Name, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry FROM Account WHERE id =: ApexPages.currentPage().getParameters().get('id')]; } }
<apex:page renderAs="pdf">
<apex:page standardController="Account" renderAs="pdf" applyBodyTag="false"> <head> <style> body { font-family: 'Arial Unicode MS'; } .companyName { font: bold 30px; color: red; } </style> </head> <body> <center> <h1>New Account Name!</h1> <apex:panelGrid columns="1" width="100%"> <apex:outputText value="{!account.Name}" styleClass="companyName"/> <apex:outputText value="{!NOW()}"></apex:outputText> </apex:panelGrid> </center> </body> </apex:page>
Please try the below code:
Please mark as best answer if it helps you.
Thank You
Akshay
All Answers
You can render any page as a PDF by adding the renderAs attribute to the <apex:page> component, and specifying “pdf” as the rendering service. For example:
Example
You can use renderAs in your apex tag.
Ex:
RenderAs: providing extension of page to create output like pdf, doc, excel.
<apex:page standardController=”Account” renderAs=”pdf”>
<apex:pageBlock >
<apex:outputField value=”{!Account.name}”/>
<apex:outputField value=”{!Account.AccountNumber}”/>
</apex:pageBlock>
</apex:page>
Try this and mark ur ans if it works for you.
Thanks
Niraj
Please try the below code:
Please mark as best answer if it helps you.
Thank You
Akshay