You need to sign in to do that
Don't have an account?
Kent Manning
How to control page size when rendering a Visualforce Page as PDF
I'm creating a service report from a visual force page and rendering it as a PDF. My problem is the report is for our Germany office and their standard paper size is A4, not 8.5" x 11". How do I control the page size when rendering my visualforce page as a PDF?
Where does the generated PDF get its parameters to know wheather to format to 8.5" x 11" or some other page size? Does this information come from the browser, the printer, or is it hard coded by Salesforce in the rendering engine?
Any help ASAP would be appreciated.
You can use page property to get the size of pdf changed in potrait or auto mode.
This is sample code to get style property for page :
<apex:page controller="Pdfgeneration" renderAs="pdf" sidebar="false" standardStylesheets="false" showHeader="false">
<head>
<style>
@page:first
{
size:landscape;
}
@bottom-right
{
content: "Page: " counter(page) " / " counter(pages);font-size: 80%;
}
</style>
<apex:outputText value="{!Content}"></apex:outputText>
</head>
</apex:page>
To know more visit the link: http://www.pageresource.com/dhtml/cssprops.htm#classification_properties
All Answers
You can use page property to get the size of pdf changed in potrait or auto mode.
This is sample code to get style property for page :
<apex:page controller="Pdfgeneration" renderAs="pdf" sidebar="false" standardStylesheets="false" showHeader="false">
<head>
<style>
@page:first
{
size:landscape;
}
@bottom-right
{
content: "Page: " counter(page) " / " counter(pages);font-size: 80%;
}
</style>
<apex:outputText value="{!Content}"></apex:outputText>
</head>
</apex:page>
To know more visit the link: http://www.pageresource.com/dhtml/cssprops.htm#classification_properties
Thanks Pradeep!
This works beautifully. Thanks for sharing your expertise on this and helping me out.
Kent Manning