Reputation: 33
I'm using p:dataExporter to export the contents of my p:dataTable, which has Arabic content. When I export it as Excel it works fine, but if I try to export it as PDF, the Arabic content is not displayed. I'm using iText 2.1.7.
here is my p:dataTable with the p:dataExporter
<p:dataTable id="chequeReport_tbl" value="#{reportsController.listOfChequeReports}" var="chequeReport"
paginator="true" editable="false" rows="10"
tableStyle="width: auto;" style="direction: ltr; text-align: right;margin-top: 5px;margin-bottom:20px"
paginatorTemplate="{Exporters} {CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10">
<f:facet name="{Exporters}">
<div style="float:right;">
<h:commandLink actionListener="#{reportsController.generateBankChequeReportPDF()}">
<p:graphicImage value="res/images/pdf_2.png" width="12"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="res/images/excel.png" width="24"/>
<p:dataExporter type="xls" target="chequeReport_tbl" fileName="chequeReport"/>
</h:commandLink>
</div>
</f:facet>
<p:column headerText="تاريخ الصرف" style="text-align: center">
<h:outputText value="#{chequeReport.exchangeDate}"/>
</p:column>
<p:column headerText="أسم المستفيد" style="text-align: center">
<h:outputText value="#{chequeReport.beneficiaryName}"/>
</p:column>
<p:column headerText="مبلغ الشيك بالدولار" style="text-align: center">
<h:outputText value="#{chequeReport.chequeAmountInDollar}"/>
</p:column>
<p:column headerText="العملة" style="text-align: center">
<h:outputText value="#{chequeReport.currency}"/>
</p:column>
<p:column headerText="قيمة الشيك" style="text-align: center">
<h:outputText value="#{chequeReport.chequeAmount}"/>
</p:column>
<p:column headerText="تاريخ الإصدار" style="text-align: center">
<h:outputText value="#{chequeReport.issuingDate}"/>
</p:column>
<p:column headerText="القطاع الإقتصادي" style="text-align: center">
<h:outputText value="#{chequeReport.financialDep}"/>
</p:column>
<p:column headerText="الفرع" style="text-align: center">
<h:outputText value="#{chequeReport.branch}"/>
</p:column>
<p:column headerText="رقم الحساب" style="text-align: center">
<h:outputText value="#{chequeReport.accountNumber}"/>
</p:column>
<p:column headerText="رقم الهوية" style="text-align: center">
<h:outputText value="#{chequeReport.idNumber}"/>
</p:column>
<p:column headerText="أسم العميل" style="text-align: center">
<h:outputText value="#{chequeReport.customerName}"/>
</p:column>
</p:dataTable>
Upvotes: 0
Views: 1337
Reputation: 12337
Effectively, your question can be (and should have been) split in two questions, both of which have existing Q/A in stackoverflow.
Question 1: How do I display arabic in a PDF when using iText.
Answer 1: How to display Arabic in PDF created using iText
Question 2: How do I customize the PrimeFaces dataExporter when exporting to PDF
Answer 2: How do I customize the PDF from a PrimeFaces p:dataExporter, e.g. page size
Combine them and you have your solution.
Upvotes: 1