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
DS777DS777 

Printable View

How to include Printable view in VF pages? - so as to look like SFDC page
ESES
Components like apex:detail and apex:listView automatically show you printable view link (pointing to the standard salesforce printable views for that detail and list view component respectively) based on the org's settings.

You can create your own (html or pdf based) printable views using visualforce.
mwengleinmwenglein

Hi Emad,

 

I've tried your solution, but it doesn't solve the problem. The printable view does not display MY visualforce page but only the standard account page. Here's my example code:

 

 

<apex:page standardController="Account" showHeader="true" sidebar="false">
    <apex:detail relatedList="false" title="true" />
    <apex:relatedList list="ActivityHistories" pageSize="1000"/>
    <apex:relatedList list="Transaction__r" pageSize="1000"/>
</apex:page>

 

The standard Printable View link, however, displays ALL related lists (as in the standard page layout of the user) and NOT the content as defined in the Visualforce code above.

 

Alternatively, I have tried to change the stylesheet to your PrintableView CSS (uploaded as a static resource):

 

<apex:page standardController="Account" showHeader="false" sidebar="false" standardStylesheets="false">
   
<apex:styleSheet value="{!$Resource.StylesheetPrintableView}"/>
    <apex:detail relatedList="false" title="false" />
    <apex:relatedList list="ActivityHistories" pageSize="1000"/>
    <apex:relatedList list="Transaction__r" pageSize="1000"/>
</apex:page> 

 

But that doesn't help either. This time I get the correct content, but without ANY styling, i.e. plain HTML with no formatting whatsoever.

 

So the question remains: how can I make my Visualforce page LOOK like a Printable View without changing its content?

 

Thank you so much!

mike