Hi,
I'm building PDF/A documents with iText, but I have a problem with the 
validation.

What's going wrong?
The PDF/A specification demands in 6.1.8: ... The obj and endobj keywords shall 
each be followed by an EOL marker.
This is the case for endobj, but not for obj.
If you inspect the class com.lowagie.text.pdf.PdfIndirectObject, the lines
    static final byte STARTOBJ[] = DocWriter.getISOBytes(" obj");
    static final byte ENDOBJ[] = DocWriter.getISOBytes("\nendobj\n");

show the difference.

Can you please fix it?

Regards,
Elmar

Here's my source code:
        public static void main(String[] args) {
                Document document = new Document(PageSize.A4, 50, 50, 50, 50);
                PdfWriter pdfWriter;
                try {
                        pdfWriter = PdfWriter.getInstance(document, new 
FileOutputStream("C:\\Projekte\\iText\\testpdfa.pdf"));
                        pdfWriter.setPdfVersion(PdfWriter.PDF_VERSION_1_4);
                        pdfWriter.setPDFXConformance(PdfWriter.PDFA1A);

                        document.open();

                        PdfDictionary outi = new 
PdfDictionary(PdfName.OUTPUTINTENT);
                        outi.put(PdfName.OUTPUTCONDITIONIDENTIFIER, new 
PdfString("sRGB IEC61966-2.1"));
                        outi.put(PdfName.INFO, new PdfString("sRGB 
IEC61966-2.1"));
                        outi.put(PdfName.S, PdfName.GTS_PDFA1);
                        ICC_Profile icc = ICC_Profile.getInstance(new 
FileInputStream("C:\\Projekte\\iText\\srgb.profile"));
                        PdfICCBased ib = new PdfICCBased(icc);
                        ib.remove(PdfName.ALTERNATE);
                        outi.put(PdfName.DESTOUTPUTPROFILE, 
pdfWriter.addToBody(ib).getIndirectReference());
                        pdfWriter.getExtraCatalog().put(PdfName.OUTPUTINTENTS, 
new PdfArray(outi));
                        PdfDictionary markInfo = new 
PdfDictionary(PdfName.MARKINFO);
                        markInfo.put(PdfName.MARKED, new PdfBoolean(true));
                        pdfWriter.getExtraCatalog().put(PdfName.MARKINFO, 
markInfo);

                        // Load Font
                        InputStream ris = new 
FileInputStream("C:\\Projekte\\iText\\DejaVuSansMono.ttf");
                        byte[] ttfAfm = IOUtils.toByteArray(ris);
                        ris.close();
                        BaseFont courier = 
BaseFont.createFont("DejaVuSansMono.ttf", BaseFont.IDENTITY_H, true, true, 
ttfAfm, null);

                        document.add(new Chunk("TestString", new 
Font(courier,14)));
                        pdfWriter.createXmpMetadata();
                        document.close();
                } catch (FileNotFoundException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (DocumentException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }


        }

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to