+ Start a Discussion
SFDC 18SFDC 18 

How to get printable view when clicked on Custom Button for a VF page which renders as PDF.

My VF Page:
 
<apex:page controller="MyController" renderAs="{!isPDF}" applyBodyTag="false" >

<head>
    <style> 
    body { font-family: 'Arial Unicode MS'; }

@page{
        size: letter;
        margin:20%;
        @top-center{
            content: "My Content";
            font-family: Helvetica, Arial, sans-serif;
            font-size: 24px;
            font-weight: bolder;
        }
        @bottom-right{
            content: "Yours Sincerely,";
            font-family: Helvetica, Arial, sans-serif;
            font-size: 10px;
        }
   }
body {
        font-family: Helvetica, Arial, sans-serif;
        font-size: 14px;
}
    </style>
</head>
    <div align="right"><strong>Date</strong>: {!DAY(Today())} {!CASE(MONTH(Today()), 1, 'January', 2, 'February', 3, 'March', 4, 'April', 5, 'May', 6, 'June', 7, 'July', 8, 'August', 9, 'September', 10, 'October', 11, 'November', 12, 'December', 'Unknown')} {!YEAR(Today())}</div>
    <div align="left">Dear,</div>
 <p>My Text</p>

    <p>My Text</p>    

</apex:page>


The above VF page renders as PDF, a custom button PDF is created for it.

window.open("apex/Letter?Id={!Letter__c.Id}","_blank"); 

This shoes a PDF of the VF page req when the button is clicked. Now I need the same pdf in print view (CTRL+P) when the pdf button is clicked.
So I have changed window.open to window.print("apex/Letter?Id={!Letter__c.Id}","_blank"); , but the print view which i got is of the current page not the pdf rendered.
 

Can anyone just help or guide me on how to generate print view when my pdf button is clicked

Raj VakatiRaj Vakati
I dnt think so you can able to do it with the same page .. 

Refer this link 

https://techman97.wordpress.com/2013/07/22/visualforce-page-printable-view/
sd asssd ass
What is the best way to integrate the whole script in dynamic website (https://www.footwearguider.com/best-basketball-shoes-for-wide-feet/)?