You need to sign in to do that
Don't have an account?
How do I open a new PDF window from a VF Page
Hi ,
I have a VisualForce page that allows you to enter text in fields and then display them in a formatted PDF page by clicking a preview button. This is done by using a second VisualForce page to display the rendered PDF. I want the rendered PDF page to appear in a separate windows page.
First VF Page - Enter PDF Text
<apex:commandButton id="previewButton" action="{!previewPDF}" value="Preview"/>
the action !previewPDF is then called in an apex class
Apex Class
The class contains processing to calculate and format fields on the final rendered page and finally
creates a new page reference
public pagereference previewPDF () {
// Direct to the PDF page
PageReference pageRef = new PageReference('/apex/vfNCDLetterBF?id=' + Policy__c.Id);
return pageRef;
}
Second VF Page - Render PDF Text
This VF page should then render the text as a PDF in a separate window but it appears in the original window which forces the user to use the back button to return to the first VF Page.
I have tried adding the onClick.Window javascript to the first VF page but this does not work.
I have found similiar answers to this question but they dont work with my pages and classes
I have already tried this solution which did not work for me as a need to call the apex class before I
execute the onclick command.
Any insights or help would be appreciated
Many Thanks
Brian
You can try this,
All Answers
Hi,
try this it might be help you
You can try this,
Many Thanks UK1925 this works perfectly