This feature enables fully customizable exporter with the required functionalities with the help of Service Loader Concept.

Steps needs to follow:

  • Step 1: Create a folder named META-INF under resouces folder.Below META-INF folder create another folder called services.
  • Step 2: Creae a file with the name "ExporterFactory" as a service(Fully binary name of the service).
        Here it should be org.primefaces.extensions.component.exporter.ExporterFactory.
  • Step 3: Provide your own implementaions/providers of Exporter factory anywhere in your project.
        And copy the absolute path of custom exporter factory implementation in the ExporterFactory file
        How to do : Copy the file content of DefaultExporterFactory and rename the file as CustomExporterFactory.Copy the absolute path org.primefaces.extensions.showcase.util.CustomExporterFactory in ExporterFactory file.
  • Step 4: Copy the exporter implementations and add your own changes.And call these custom     implementations(Ex PDFCustomExporter,ExcelCustomExporter) instead built-in implmentations(Ex PDFExporter,ExcelExporter)

  • The below example demonstrates how the index column added using Custom Exporter feature.
    Basic Message Table-As At Date-26/09/2020
    subject 0text 01601117750969
    subject 1text 11601117750968
    subject 2text 21601117750969
    subject 3text 31601117750969
    subject 4text 41601117750969
    Export PDF and Excel
                    <p:dataTable id="messageTable" var="message" value="#{messageTableController.messages}"
                     paginator="true" rows="5" paginatorPosition="bottom"
         <f:facet name="header">
              <h:outputText value="Basic Message Table"/>
              <h:outputText value="-As At Date-"/>
              <h:outputText value="#{messageTableController.currentDate}">
                 <f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
         <p:column filterBy="#{message.subject}" id="subject">
             <f:facet name="header">
                 <h:outputText value="Subject"/>
                <h:outputText value="#{message.subject}"/>
         <p:column filterBy="#{message.text}">
             <f:facet name="header">
                    <h:outputText value="Text"/>
                <h:outputText value="#{message.text}"/>
         <p:column filterBy="#{message.time}">
             <f:facet name="header">
                <h:outputText value="Time"/>
                <h:outputText value="#{message.time}"/>
    <p:panel header="Export PDF and Excel">
         <p:commandLink id="pdf" ajax="false"  >
             <p:graphicImage value="/resources/images/pdf.png"/>
             <f:setPropertyActionListener value="true" target="#{exporterController.customExporter}" />
             <pe:exporter type="pdf" target="messageTable" fileName="MessagesTable"
         <p:spacer width="20"/>
         <p:commandLink id="xls" ajax="false"  >
             <p:graphicImage value="/resources/images/excel.png"/>
             <f:setPropertyActionListener value="true" target="#{exporterController.customExporter}" />
             <pe:exporter type="xlsx" target="messageTable" fileName="MessagesTable"
    Components and more
    Documentation pe:exporter
    Attributes (move mouse over the names to see data types)
    Name Description
    targetServer side id(s) of the DataTable/DataList whose data would be exported. Multiple components must be comma "," separated
    typeExport type: "pdf","xlsx".
    fileNameFilename of the generated export file, defaults to DataTable/DataList server side id.
    tableTitleTable/List header title to use.
    pageOnlyExports only current page instead of whole dataset.
    preProcessorPreProcessor for the exported document.
    postProcessorPostProcessor for the exported document.
    encodingCharacter encoding to use.
    selectionOnlyWhen enabled, only selection would be exported.
    subTableWhen enabled, subtable would be exported.
    facetBackgroundFacet background to use.Ex:Hex Colors like #FFFF00,#FF0000...
    facetFontSizeFacet font size to use.Ex:10,12..
    facetFontColorFacet font color to use.Hex Colors like #FFFF00,#FF0000...
    facetFontStyleFacet Font Style to use.Ex:normal,bold,italic.Default value is Bold
    fontNameFont Name/Font family to use.Ex:Courier New,Verdana..
    cellFontSizeCell Font size to use.Ex:10,12
    cellFontColorCell Font Color to use.Ex:Hex Colors like #FFFF00,#FF0000...
    cellFontStyleCell Font style to use.Ex:normal,bold,italic.Default value is normal
    datasetPaddingSpacing between multiple DataTables/DataLists
    orientationPDF format orientation.Possible values are Portrait or Landscape.Default value:Portrait
    skipComponentsThe list of components to be skipped in the pdf and excel export
    PrimeFaces Extensions Showcase - © 2011-2020, PrimeFaces: 8.0, PrimeFaces Extensions: 8.0.2, JSF: jakarta 2.3.14, Server: jetty/9.4.2.v20170220, Build time: 2020-04-29 13:39