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
AnshulJainAnshulJain 

Custom Printable View using Visualforce

Hello,

 

I have a requirement for creating custom printable view for account detail page. using all the fields as well as the related list. Can anyone help me achieving this. Thanks in advance.

HariDineshHariDinesh

Hi,

 

Here what do you mean by Custom Printable View?

You mean to show as PDF format like that.

Then below code will be useful to you which will show all detail page of account in VFP and In PDF format also.

 

<apex:page standardController="Account" renderAs="pdf" >
<apex:detail relatedList="true"/>
</apex:page>

 

Here if you don’t want PDF format, Remove the Attribute rendereAs

 

here after saving the page you need to pass Acount id in URL like below

https://c.ap1.visual.force.com/apex/detail?id=a0090000004TX66

here detail is the VFP name.

 

AnshulJainAnshulJain

Hey Dinesh, Thanks for the response.

 

What I mean by custom printable view is a page which is sort of a print preview. If u go to detail page of any object there is a link on the top right corner 'Printable View' It gives u a print preview of the detail page. I want similar kind of page. I am trying to customize account page using visualforce page. In that I am allowing user to select what all fields and related list they want to view. Now I want a print preview sort of think for this page, where the related list user has chosen specific to him will come up and all the records will come up for that related list, without links and buttons..

 

I hope u understood what I want.

Thanks in advance.

 

Anshul Jain

HariDineshHariDinesh

Hi,

 

Yes I understood what you are looking for. Thanks for the explanation.

Did you start working on this?

AnshulJainAnshulJain

Hey,

 

I started working on that, but there are few issues i still dont have an answer for. I am trying to create a new visualforce page with no style sheets.

All of them are related to related Lists.

 

First, Since users can change the columns they want to view for the related list. So how to keep track of that on the printable view since salesforce has not exposed that API to us.

 

Secondly, Since i am using related list how to get rid of the buttons and links for related list.

 

Thirdly, How to get all the records related to related list on the print preview page.

 

for second and third questions i am thinking of not using the related list tags and query everything using SQL but still for the first question i have no answer yet.

 

If you can suggest me anything better, that would be of great help.

 

Thanks,

Anshul Jain