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
fredkafredka 

add printable screen functionality to vf page

Is there a way to add the "printable screen" functionality to a vf page... I have the following page.. thanks!!

 

<apex:page standardController="Opportunity" extensions="QuoteBrokerandRepList"> <apex:sectionHeader title="Edit Opportunity" subtitle="{!opportunity.name}"/> <apex:detail title="false"/> <apex:pageBlock mode="edit" title="All Brokers/Reps Quoting on this opportunity"> <apex:pageblockSection id="key" title=""> <apex:pageblockTable value="{!quote}" var="qt"> <apex:column headervalue="Broker"> <apex:outputField value="{!qt.Broker__c}"/> </apex:column> <apex:column headervalue="Sales Rep"> <apex:outputField value="{!qt.ownerid}"/> </apex:column> <apex:column headervalue="Stage"> <apex:outputField value="{!qt.Stage__c}"/> </apex:column> <apex:column headervalue="Date Recd"> <apex:outputField value="{!qt.Date_Received__c}"/> </apex:column> </apex:pageblocktable> </apex:pageblockSection> </apex:pageblock> </apex:page>

 

Best Answer chosen by Admin (Salesforce Developers) 
fredkafredka

I got it (with both of your help)  ... I had that detail header as false which was my main problem... then I had to move the

 

<apex:detail title="true"/>  above the section header... its good now ... thanks for the help!!!!!

<apex:page standardController="Opportunity" showheader="true" extensions="QuoteBrokerandRepList"> <apex:detail title="true"/> <apex:sectionHeader title="Edit Opportunity" subtitle="{!opportunity.name}"/> <apex:pageBlock mode="edit" title="All Brokers/Reps Quoting on this opportunity"> <apex:pageblockSection id="key" title=""> <apex:pageblockTable value="{!quote}" var="qt"> <apex:column headervalue="Broker"> <apex:outputField value="{!qt.Broker__c}"/> </apex:column> <apex:column headervalue="Sales Rep"> <apex:outputField value="{!qt.ownerid}"/> </apex:column> <apex:column headervalue="Stage"> <apex:outputField value="{!qt.Stage__c}"/> </apex:column> <apex:column headervalue="Date Recd"> <apex:outputField value="{!qt.Date_Received__c}"/> </apex:column> </apex:pageblocktable> </apex:pageblockSection> </apex:pageblock> </apex:page>

 

All Answers

kaulsaksoftkaulsaksoft

put this code before the <apex:pageblock>

 

<table> 

<td align="right"><a href="javascript:window.print();">Print</a></td></tr>
    <tr><td align="right"><a href="javascript:window.close();">Close</a></td></tr>

</table>

 

it opens the print window .

 

I hope it works for u too

fredkafredka
Thanks for responding, unfortunately, that is not working for me.... the printer friendly is still not appearing... thanks!!
Edwin VijayEdwin Vijay

I just felt you might have unknowingly copy pasted the code provided by kaulsaksoft without replacing &colon with :

 

 

<A href="javascript:window.print()">Click to Print This Page</A>

 

 

 

fredkafredka

Thanks for your help!!! so I tried this: but it did not work....

 

<table> <tr><td align="right<A href="javascript;window.print()">Click to Print This Page</A></td></tr> <tr><td align="right"><a href="javascript;window.close();">Close</a></td></tr> </table>

 

Edwin VijayEdwin Vijay
Can you paste your VF page code with the print functionality included.. It may help to identify the cause quickly
fredkafredka

yes, thanks again... here you go:

 

<apex:page standardController="Opportunity" showheader="true" extensions="QuoteBrokerandRepList"> <apex:sectionHeader title="Edit Opportunity" subtitle="{!opportunity.name}"/> <apex:detail title="false"/> <table> <tr><td align="right"><a href="javascript:window.print();">Print</a></td></tr> </table> <apex:pageBlock mode="edit" title="All Brokers/Reps Quoting on this opportunity"> <apex:pageblockSection id="key" title=""> <apex:pageblockTable value="{!quote}" var="qt"> <apex:column headervalue="Broker"> <apex:outputField value="{!qt.Broker__c}"/> </apex:column> <apex:column headervalue="Sales Rep"> <apex:outputField value="{!qt.ownerid}"/> </apex:column> <apex:column headervalue="Stage"> <apex:outputField value="{!qt.Stage__c}"/> </apex:column> <apex:column headervalue="Date Recd"> <apex:outputField value="{!qt.Date_Received__c}"/> </apex:column> </apex:pageblocktable> </apex:pageblockSection> </apex:pageblock> </apex:page>

 

fredkafredka

Its this:

 

apex:detail title="false"/>

 

isn't it?  but when I make that true, I get two detail headers...I just have to figure out how I get rid of the duplicate header... thanks!!!

fredkafredka

I got it (with both of your help)  ... I had that detail header as false which was my main problem... then I had to move the

 

<apex:detail title="true"/>  above the section header... its good now ... thanks for the help!!!!!

<apex:page standardController="Opportunity" showheader="true" extensions="QuoteBrokerandRepList"> <apex:detail title="true"/> <apex:sectionHeader title="Edit Opportunity" subtitle="{!opportunity.name}"/> <apex:pageBlock mode="edit" title="All Brokers/Reps Quoting on this opportunity"> <apex:pageblockSection id="key" title=""> <apex:pageblockTable value="{!quote}" var="qt"> <apex:column headervalue="Broker"> <apex:outputField value="{!qt.Broker__c}"/> </apex:column> <apex:column headervalue="Sales Rep"> <apex:outputField value="{!qt.ownerid}"/> </apex:column> <apex:column headervalue="Stage"> <apex:outputField value="{!qt.Stage__c}"/> </apex:column> <apex:column headervalue="Date Recd"> <apex:outputField value="{!qt.Date_Received__c}"/> </apex:column> </apex:pageblocktable> </apex:pageblockSection> </apex:pageblock> </apex:page>

 

This was selected as the best answer