You need to sign in to do that
Don't have an account?

Questions regarding Printing a Visualforce Page
I'm in the process of converting an s-control to a Visualforce page, and the only stumbling block I've ran into is sending the page to the printer.
As a background, in the s-control, I had added the following code to the top and bottom of the s-control to provide "Print Screen" buttons that allowed for printing.
The above code worked nicely by bringing up the standard print dialog and the output generated nicely. In addition, it only printed the s-control frame and did not print the top tabs nor the sidebar.
When I placed the above code into Visualforce page, it continues to work, but it does not exclude the top tabs and the sidebar. I'm assuming visualforce pages are not rendering in the same sort of a frame as s-controls did.
In addition, as you can see in the screenshots below, I've got a bit of basic formatting to do on the visualforce pages so that they print nicely with grids, etc.
My initial question is what is the best way to print a Visualforce page to exclude the top bar and the side bar?
Secondly, for the formatting, based on what I found on the discussion boards, I was considering using "media" stylesheets to try to cleanup the look and feel for printing. Visually on the page, the Visualforce page looks great, but when printed without gridlines, it doesn't read as well as the old s-control page. Below is a snippet of what I found elsewhere in the discussion forum that I was going to try and use? Does this seem to be the best approach to doing this?
I did review the solutions regarding displaying a Visualforce page as a PDF, and although I like that functionality, I don't know if it would help in this instance. When I display this page, It contains a lot of historical actiivities. By default the descriptions for these activities are hidden, but "Show"/"Hide" functionality exists so that a user can unhide the descriptions they want to print prior to printing. What I can tell about the PDF functionality, it redraws the Visualforce page from scratch, so if I used some of the current methods discussed, if I had the button generate a PDF version, it would be a brand new page of the Visualforce page, not one where the user has made a number of changes upon. If I'm incorrect on this one, let me know, because this would be a nice way of handling it. (I know when calling the PDF version of the page, I could try to pass parameters, but this would get pretty complex with hundreds of activities...)
Thanks for any ideas!
Jon Keener
jhkeener@ashland.com

As a background, in the s-control, I had added the following code to the top and bottom of the s-control to provide "Print Screen" buttons that allowed for printing.
Code:
<form name="PrintInformationTop"> <input type="button" name="PrintInformationTop" value=" Print Screen " onClick = "window.print()"> </form>
The above code worked nicely by bringing up the standard print dialog and the output generated nicely. In addition, it only printed the s-control frame and did not print the top tabs nor the sidebar.
When I placed the above code into Visualforce page, it continues to work, but it does not exclude the top tabs and the sidebar. I'm assuming visualforce pages are not rendering in the same sort of a frame as s-controls did.
In addition, as you can see in the screenshots below, I've got a bit of basic formatting to do on the visualforce pages so that they print nicely with grids, etc.
My initial question is what is the best way to print a Visualforce page to exclude the top bar and the side bar?
Secondly, for the formatting, based on what I found on the discussion boards, I was considering using "media" stylesheets to try to cleanup the look and feel for printing. Visually on the page, the Visualforce page looks great, but when printed without gridlines, it doesn't read as well as the old s-control page. Below is a snippet of what I found elsewhere in the discussion forum that I was going to try and use? Does this seem to be the best approach to doing this?
Code:
style type="text/css" media="print"> ...
</style>
Thanks for any ideas!
Jon Keener
jhkeener@ashland.com

http://wiki.apexdevnet.com/index.php/Visualforce_CaseHistoryTimeline
shows how to build a print optimized page
see CaseHistoryPring
you can also change
How to handle pagination in PDF ? i.e printing the headers and footers.
It looks like when using the datatable the
any examples would be quite helpful. I have tried using W3C page rules but with not much sucess.
i think i saw someone report that flowing div's into the header and footer is not yet supported.
something like this in a style tag
We needed to do pagination based on a variable number of fixed-height page sections. Here's the link to the solution I came up with. It's not ideal, but it works. Hope this helps someone looking for the solution like I was.
Jeremy Kraybill
Austin, TX
I just came across this post .. I am also facing the same issue that J Keener had faced. I saw your response :