0

I am trying to save table as pdf with all columns but it is only taking few columns in pdf, I also tried with different table width sizes but not getting, How to achieve this?screen shot Page 1

<apex:page controller="ReportPageCon" id="MainPage"
showHeader="false" 
cache="true"
contentType="application/x-pdf#Here-is-your-filename.pdf">
<apex:include pageName="PageThatGeneratesPdf"/>
<table width="100%" class="table-bordered">
    <thead>
        <tr>
            <th>Coloumn name2</th>
            <th>Coloumn name3</th>
            <th>Coloumn name4</th>
            <th>Coloumn name5</th>
            <th>Coloumn name6</th>
            <th>Coloumn name7</th>
            <th>Coloumn name8</th>
            <th>Coloumn name9</th>
            <th>Coloumn name10</th>
            <th>Coloumn name11</th>
            <th>Coloumn name12</th>
            <th>Coloumn name13</th>
            <th>Coloumn name14</th>
            <th>Coloumn name15</th>
            <th>Coloumn name16</th>
        </tr>
    </thead>
    <tbody>
        <apex:repeat value="{!objList}" var="item">
        <tr>
            <td>{!item.Field1__c}</td>
            <td>{!item.Field2__c}</td>
            <td>{!item.Field3__c}</td>
            <td>{!item.Field4__c}</td>
            <td>{!item.Field5__c}</td>
            <td>{!item.Field6__c}</td>
            <td>{!item.Field7__c}</td>
            <td>{!item.Field8__c}</td>
            <td>{!item.Field9__c}</td>
            <td>{!item.Field10__c}</td>
            <td>{!item.Field11__c}</td>
            <td>{!item.Field12__c}</td>
            <td>{!item.Field13__c}</td>
            <td>{!item.Field14__c}</td>
            <td>{!item.Field15__c}</td>
            <td>{!item.Field16__c}</td>
        </tr>
        </apex:repeat>
    </tbody>
</table>
</apex:page>

Page 2: PageThatGeneratesPdf

     <apex:page showHeader="false"
               renderAs="PDF"
               cache="true">

    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

    <style type="text/css">
    @page{
        size:A4 portrait;

        @bottom-right {
            content: "Page " counter(page) " - " counter(pages);
            font-family: 'Arial', 'Helvetica', sans-serif;
            font-size:10px;
        }
    }
    </style>
    </head>

    Here is your main content ...

</apex:page>
  • Change size:A4 portrait; to landscape, this will allow you to have more columns. – Santanu Halder May 3 '17 at 9:37
  • @Santanu Halder. not getting. – Ravindar Admin May 3 '17 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.