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
vasu takasivasu takasi 

Not getting exact alignments in PDF page

How render a page as PDF without effecting its styles

 

kiranmutturukiranmutturu
sorry didn't get you ... do u want to turn the vf page as pdf right? then use renderas="pdf" attribute in apex:page component...
Adam HowarthAdam Howarth

Hey,

 

By default, the default styles arent applied. So i suppose you have two options

 

1. Manually include the standard stylesheets:

 

 <apex:page renderas="pdf">
 <head>
<apex:stylesheet value="/sCSS/20.0/sprites/1290470434000/Theme3/default/sf/common.css"/> 
<apex:stylesheet value="/sCSS/20.0/sprites/1290470434000/Theme3/default/sf/extended.css"/>
 </head>
</apex:page>

 Which would be ok, but not sure how the versions hold up through updates.

 

Or...

 

2. You can do something similar, but copy the styles into a new css file and upload it as a static resource:

 

<apex:page renderas="pdf">
 <head>
<apex:stylesheet value="{!$Resource.CustomStyleSheet}"/>
 <style> 
 </head>
</apex:page>

 Up to you though dude.

 

I'd recommend number 2 so you can control the styles regardless of any Salesforce Platform changes.

 

Cheers