Activity Forums Salesforce® Discussions How to generate pdf of my data table (wrapper)? Reply To: How to generate pdf of my data table (wrapper)?

  • Prakhar

    Member
    May 26, 2016 at 7:10 am

    I don't belive we can do that as 'renderAs' is the attribute of the apex:page so you cannot make a different section of a page render as pdf.
    In such a case you can make 2 different page out of which one page will be your main page and other page you can render as pdf based on your
    requirement.
    Example based on the solution suggested is given below:-

    // Controller for the 2 pages which can be same or different according to your requirement.

    public with sharing class pdfPageExampleContrl{

    public pdfPageExampleContrl(ApexPages.StandardController controller){
    }

    public pdfPageExampleContrl(){
    }

    // Method which will be called on button click and will redirect to the pdf page.
    public PageReference redirect(){

    PageReference pgRef = new PageReference('/apex/pdfNextPage');
    pgRef.setRedirect(true);
    return pgRef;
    }
    }

    Here You will write Your code which will be converted in to pdf ...

    Hope that will resolve your problem.
    Thanks.