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
MohanaGopalMohanaGopal 

PDF styleclass problem

Hi..
    
       Here I am using styleclass in my PDF.. I have two issues..
 
1. I got my expected output while I am using outputtext instead of outputfield.. If I am using outputfield in VF page
    my styleclass doesnt work..
 
                If I am using inline style with outputfield  my PDF is rendered correctly...
 
                What is the problem here...
 
2.I got one blank first page in my PDF.... How to avoid it...
 
Here is my code
Code:
<apex:page standardcontroller="Account"  renderas="pdf"
<style>
.centerHeader1
{
font-size:130%;
font-weight:bold;
text-align:center;
}
.leftHeader
{
font-size:50%;
text-align:right;
}
.centerHeader2
{
font-size:50%;
text-align:center;
}
.imageHeader
{
width:90px;
height:50px;
}
</style>
<apex:form >
<div style="page-break-before:always">
<table width="100%"><tr>
<td align="left" width="33%">
<apex:outputtext styleclass="leftHeader" value="leftHeader class"/><br/>
</td>
<td align="center" width="33%">
<i>
<apex:outputtext styleclass="centerHeader1" value="centerHeader1 class"/></i><br/>
<apex:outputtext styleclass="centerHeader2" value="centerHeader2 class"/>
</td>
<td align="right" width="33%">
<!-- <apex:image value="{!$Resource.Logo_PDF}" styleclass="imageHeader"/> -->
</td>
</tr>
</table>
<br/><br/>
<!-- <apex:outputfield value="{!Account.Name}" styleclass="centerHeader1"/> -->
<apex:outputtext value="{!Account.Name}" styleclass="centerHeader1"/>
</div>
</apex:form>
</apex:page>

 
gregsgregs

I can't get this to work either, and it doesn't seem to matter if the page is rendered as pdf or not... Did you ever find out why the style or styleClass tags don't work for an outputField?

 

<apex:outputField value="{!myObject.Field_To_Highlight_In_Red__c}" style="font-weight:bold;color:#FF0000;"/>

 

when this renders, the text from the field is NOT rendered with the color red (#FF)... Does anyone know why?