You need to sign in to do that
Don't have an account?
Shirish Dwivedi
Visual Page: Print as Pdf
Hi everyone,
Suppose I have a "print this" hyperlink at the end of the visual force page on clicking it I want the Visual force page to open in a new window as pdf giving users direct option to print. I know with chrome we can print by right clicking mouse and so on.. but I need this print hyperlink to work.
I have tried Render as="pdf" method but since the page has complex coding structure its not working.
is there anyway I can use jsPdf library or Pdf.js library and execute the above as function. I need a way to know how can I export all the data on the visual form page to the new window as pdf?
Suppose I have a "print this" hyperlink at the end of the visual force page on clicking it I want the Visual force page to open in a new window as pdf giving users direct option to print. I know with chrome we can print by right clicking mouse and so on.. but I need this print hyperlink to work.
I have tried Render as="pdf" method but since the page has complex coding structure its not working.
is there anyway I can use jsPdf library or Pdf.js library and execute the above as function. I need a way to know how can I export all the data on the visual form page to the new window as pdf?
You can create new vf page on which all of data will render as below :
<apex:page controller="pdfReport" renderAs="pdf" showHeader="true">
Event Date,Your Column Name
<apex:repeat value="{!List}" var="varriable">
<apex:repeat value="{!List[ID]}" var="eve">
{!eve.your Filed}
</apex:repeat>
</apex:repeat>
</apex:page>
On Button from your current page you need to call a function in controller to redirect to above page :
public PageReference exportToPDF() {
return Page.PDFPage;
}
Hope this helps you!
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution.Let me know if any issue.
Best Regards
Narveer
<apex:commandButton value="Download Report" action="{!exportToPDF}"/>