Hi,
Is there a way to represent data in tabular format without using PdfPTable?
The problem is i have a Table but i am not using table header and one of the
PDF guideline says:
"SC 1.3.1: The table in the document does not have table headers. If adding
table headers does not make sense, then maybe the table should not be used
to show these data and it should just be text."
I tried assigning the DIV role to PdfPTable but it didnt work.
Assigning TEXT role gives Exception.
What can i do different here?
Here's a sample code using PdfPTable.

public class TableData{

        public static void main(String[] args) throws IOException,
DocumentException, XMPException {
                Document document = new Document();
                PdfAWriter writer = PdfAWriter.getInstance(document, new
FileOutputStream("list.pdf"), PdfAConformanceLevel.PDF_A_1A);
                writer.setViewerPreferences(PdfAWriter.PageModeUseOutlines);
                writer.setViewerPreferences(PdfAWriter.DisplayDocTitle);
                writer.setRunDirection(PdfAWriter.RUN_DIRECTION_LTR);
                writer.setTagged(PdfAWriter.markAll);
                writer.createXmpMetadata();
                XmpWriter xmp = writer.getXmpWriter();

                DublinCoreProperties.addSubject(xmp.getXmpMeta(), "Subject");
                DublinCoreProperties.setTitle(xmp.getXmpMeta(), "Title", 
"en_US",
"en_US");
                DublinCoreProperties.setDescription(xmp.getXmpMeta(), 
"Description",
"en_US", "en_US");
                PdfProperties.setKeywords(xmp.getXmpMeta(), "Keywords");
                PdfProperties.setVersion(xmp.getXmpMeta(), "1.4");
                document.addTitle("Title");
                document.addLanguage("en_US");
                document.open();
                Font font1 = FontFactory.getFont("ROsanswebtextregular.ttf",
BaseFont.WINANSI, BaseFont.EMBEDDED, 12);
                Font fontBullet = FontFactory.getFont("ZapfDingbats.ttf",
BaseFont.WINANSI, BaseFont.EMBEDDED, 8);
                ICC_Profile icc = ICC_Profile.getInstance(new 
FileInputStream("sRGB Color
Space Profile.icm"));
                writer.setOutputIntents("Custom", "", "http://www.color.org";, 
"sRGB
IEC61966-2.1", icc);

                PdfPTable table = new PdfPTable(2);
                table.setWidthPercentage(75);
                table.setWidths(new float[]{0.7f, 1.3f});
                table.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
                table.setSpacingBefore(10);
                table.setSpacingAfter(15);

                Paragraph p13 = new Paragraph("List indicator: ", font1);
                List p14 = new List(10);
                Chunk bullet = new Chunk(String.valueOf((char)110), fontBullet);
                p14.setListSymbol(bullet);
                
                for(int i = 0; i < 5; i++){
                        ListItem li = new ListItem("asd"+i, font1);
                        p14.add(li);
                }
                
                PdfPCell cell13 = new PdfPCell(p13);
                PdfPCell cell14 = new PdfPCell();
                cell14.addElement(p14);
                cell14.setUseAscender(true);
                table.addCell(cell13);
                table.addCell(cell14);
                table.setRunDirection(PdfAWriter.RUN_DIRECTION_LTR);
                table.setRole(PdfName.TEXT);
                document.add(table);
                document.close();
        }
}





--
View this message in context: 
http://itext.2136553.n4.nabble.com/Represent-data-in-tabular-form-without-using-PdfPTable-tp4660901.html
Sent from the iText mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to