0

I am trying to save my page as pdf, My page having Pageblocktable with 16 coloumns, When i try to save using code, it is just displaying only some columns in pdf.

How to save all cloumns in pdf? please check the code

<apex:page controller="ReportPageCon"
           showHeader="false" 
           renderAs="pdf">

<apex:form >
<apex:pageBlock >
    <apex:pageBlockTable value="{!objList}" var="item">
   <apex:column value="{!item.Field1__c}"/>
              <apex:column value="{!item.State__c}"/>
              <apex:column value="{!item.District__c}"/>
              <apex:column value="{!item.Mandal__c}"/>
              <apex:column value="{!item.Village__c}"/>
              <apex:column value="{!item.First_Name__c}"/>
                            <apex:column value="{!item.Aadhar_ID__c}"/>
                                          <apex:column value="{!item.Gender__c}"/>
                                          <apex:column value="{!item.Date_Of_Birth__c}"/>
                            <apex:column value="{!item.Age__c}"/>
                            <apex:column value="{!item.field__6__c}"/>
                            <apex:column value="{!item.field__4__c}"/>
                            <apex:column value="{!item.fileld3__c}"/>
                            <apex:column value="{!item.field5__c}"/>
                            <apex:column value="{!item.field_2__c}"/>
                            <apex:column value="{!item.Mobile_Number__c}"/>

    </apex:pageblockTable>          
</apex:pageBlock>
</apex:form>                
 </apex:page>
3
  • 1
    what do you mean it is just displaying only some columns in pdf. ?
    – Ratan Paul
    May 1, 2017 at 13:34
  • In my original code i have added 16 columns, It is executing fine without errors, But it is displaying only 9 cloumn in pdf. I want to display all columns in pdf. When i save as Excel it is displaying all coloumns. May 1, 2017 at 13:52
  • can you add a screenshot ?
    – Ratan Paul
    May 1, 2017 at 13:55

2 Answers 2

0

I am trying to save my page as pdf, My page having Pageblocktable with 16 coloumns, When i try to save using code, it is just displaying only some columns in pdf.

How to display all cloumns in pdf? please check the code

please check the screen shot

2
  • Try set a width on the table and avoid using visualforce styling elements as they're not fully supported by the PDF renderer. Try to stick as much as you can to plain HTML when generating a PDF.
    – sfdc
    May 1, 2017 at 14:11
  • I changed width on table and I also changed to html table,Even it is displaying some fileds in pdf. Can you modify the code or provide any example. Thank you. May 1, 2017 at 15:21
0

Please go through my code:

I checked with different widths on table and I also changed pageBlockTable to html table, Even it is displaying few columns in pdf. Please povide solution or provide an example. Thank you.

page 1: Coloumn name2 Coloumn name3 Coloumn name4 Coloumn name5 Coloumn name6 Coloumn name7 Coloumn name8 Coloumn name9 Coloumn name10 Coloumn name11 Coloumn name12 Coloumn name13 Coloumn name14 Coloumn name15 Coloumn name16 {!item.Field1__c} {!item.Field2__c} {!item.Field3__c} {!item.Field4__c} {!item.Field5__c} {!item.Field6__c} {!item.Field7__c} {!item.Field8__c} {!item.Field9__c} {!item.Field10__c} {!item.Field11__c} {!item.Field12__c} {!item.Field13__c} {!item.Field14__c} {!item.Field15__c} {!item.Field16__c}

page2: PageThatGeneratesPdf:

@page{ size:A4 portrait;

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

}

Here is your main content ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.