0

I used iTextSharp to create PDF document. Added table. Checked the PDF accessibility through PAC 2.0. When I read the document through "ScreenReader Preview" option of the PAC tool,table cells are not wrapped. PDF document is generated the table as expected. Used below code.

PdfPTable table = new PdfPTable(3);
table.TotalWidth = 500f;
table.LockedWidth = true;
float[] widths = new float[] { 20f, 60f, 60f};
table.SetWidths(widths);
PdfPCell cell = new PdfPCell(new Phrase("text 1", times));
   table.AddCell(cell);
cell = new PdfPCell(new Phrase("text 2", times));
   table.AddCell(cell);
cell = new PdfPCell(new Phrase("text 3", times));
   table.AddCell(cell);

How I can fix this?

Thank you

Briyatis
  • 57
  • 2
  • 14
  • Upgrade to iText 7. Older versions of iText only have limited support for accessibility. – Bruno Lowagie May 15 '18 at 15:31
  • Ok thanks @Bruno. How can I do it using iText 7? – Briyatis May 15 '18 at 15:58
  • You should start by reading [tutorials](https://developers.itextpdf.com/books) such as [iText 7: Jump-start tutorial](https://developers.itextpdf.com/content/itext-7-jump-start-tutorial) and [iText 7: Building Blocks](https://developers.itextpdf.com/content/itext-7-building-blocks). But if you're looking for a really simple way to create accessible PDF, I'd read the [HTML to PDF tutorial](https://developers.itextpdf.com/content/itext-7-converting-html-pdf-pdfhtml), but start with: https://developers.itextpdf.com/content/itext-7-jump-start-tutorial/chapter-7-creating-pdfua-and-pdfa-documents – Bruno Lowagie May 15 '18 at 16:10
  • kind of a side question, once you upgrade and regenerate the file, have you looked at the tags in acrobat? you can view the tree of tags (pdf/ua) to see how well-formed your table is. in acrobat, go to the view menu > show/hide > navigation panes > tags. in the left nav area, at the bottom is a tag icon which will let you explore the tree. – slugolicious May 15 '18 at 16:16
  • I could create the PDF/UA document using iText. It passed the all the checks in PAC 2.0. The problem is, when the one cell of the table has long text. In the generated PDF file, the text is wrapped and displayed the all the columns of the table. But when I read the document through ScreenReader Preview tool in PAC, long text is not wrapped and displayed only some columns. Some columns are missing. – Briyatis May 15 '18 at 17:20

0 Answers0