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
yoyoyoyo 

Overriding style in pdf file

Hi there

 

I'm trying to hide pageblock buttons in my visual force page using my custom <style></style>. But when I`m rendering it as a pdf, button still appears on the pdf.

 

Could anyone have any idea?

 

I appreciate any comment.

Best Answer chosen by Admin (Salesforce Developers) 
prageethprageeth

Hello YoYo;

Wrap your <style> tags with <head> tags as below and retry.

 

<apex:page controller="MyController" tabstyle="contact">

<head>

<style>

.btn { display:none; }

</style>

</head> 

<apex:detail subject="{!contactid}" relatedList="false" title="false"/>

</apex:page> 

 

 

 

 

All Answers

stephanstephan
Could you post your VF page source?
yoyoyoyo

<apex:page controller="MyController" tabstyle="contact"> <style> .btn { display:none; } </style> <apex:detail subject="{!contactid}" relatedList="false" title="false"/> </apex:page>

 

where contactid is a public property that returns a contact id in MyController.

 

prageethprageeth

Hello YoYo;

Wrap your <style> tags with <head> tags as below and retry.

 

<apex:page controller="MyController" tabstyle="contact">

<head>

<style>

.btn { display:none; }

</style>

</head> 

<apex:detail subject="{!contactid}" relatedList="false" title="false"/>

</apex:page> 

 

 

 

 

This was selected as the best answer
yoyoyoyo
Awesome. It works. Thanks a lot.
JarrettKJarrettK

Helped me as well!  Should have gone back to the basics.  is there any advanced documentation specifying the limitation of rendering HTML as PDF content?