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

ShowHeader="true" ... page print .. issue
Hello folks,
Today I am challenged with this problem .. I have my page's showHeader attribute set to true as I wanted to display the sideBar & the header .. at the same time, while printing the page using JS window.print(), my side bar and the header also get printed .. but I wanted only the VF tab(page) to be printed.
Any hints folks ? your help with be greatly appreciated !
Thanks
A B
Message Edited by Arun Bala on 12-23-2008 10:40 AM
Today I am challenged with this problem .. I have my page's showHeader attribute set to true as I wanted to display the sideBar & the header .. at the same time, while printing the page using JS window.print(), my side bar and the header also get printed .. but I wanted only the VF tab(page) to be printed.
Any hints folks ? your help with be greatly appreciated !
Thanks
A B
Message Edited by Arun Bala on 12-23-2008 10:40 AM
showHeader="{!showHeaderVar}"
Then you can tie it to a POST param or something... like /apex/page?printView=true
Try using property definition for showHeader attribute of the Page tag.
Then you can use a link or button view the same page in a pop window with javascript window.print added as well.
Thanks a ton for your responses.
I am hitting a road block again. Now when I use a property for showHeader and then on click of the print button if I reload the page, I lose all the unsaved data on the page. The unsaved data should also be printable ...
Did my point make sense ?
Message Edited by Arun Bala on 12-23-2008 03:09 PM
I guess developers need to be given better control over the showHeader attribute.
Message Edited by Arun Bala on 12-23-2008 07:04 PM
<apex:page controller="PrintDemo" showHeader="{! !print}">
<h1>PrintDemo [{!created}]</h1><br/>
<em>Printing view: {!print}</em><br/>
<apex:form id="theForm">
<c:printMe value="{!print}"/>
</apex:form>
</apex:page>
public class PrintDemo {
public PrintDemo() {
created = System.now();
}
public DateTime created { get; private set; }
public boolean print { get; set; }
}
and here is c:printMe:
Message Edited by dchasman on 12-27-2008 05:35 PM
Thanks for your detailed response. This approach is awesome except that one of my scenario is not getting covered if I use this approach. i.e., I have a pageBlockTable and inside that I have styles of certain panelGrids set to display:none on page load. On performing some action X on the page, the style of the panelGrids will be changed ti display:block. But when the form is printing after performing the above mentioned action X , the form is still getting posted with the default style, i.e., display:none and hence these panelGrids are not getting printed. Any advise Doug ?
Thanks.
An approach I like to use for dynamically controlling visibility client side of a group of elements is to tag them with a specific style that I can then use style manipulation to change everything as a set instantly - see this post for a concrete example of this.
Thanks again for your response. I moved the logic for displaying the styles to the extension class and made a work around.
I sincerely appreciate your thoughts and help on this issue. Visualforce rocks :-)
Thanks.