Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] Addition to generate PDF/A 1a

Schalück, Elmar

2007-06-14

Replies:

Hi,
I was able to produce valid PDF/A 1a (not only 1b) for very simple documents.
You may use this as a hint for further evaluation.

this.writer = PdfWriter.getInstance(this.doc, out);
this.writer.setPDFXConformance(PdfWriter.PDFA1B);
   
doc.open();
try {
 // Do PDF/A support
 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(this.getClass().getResourceAsStream("/srgb.profile"));
 PdfICCBased ib = new PdfICCBased(icc);
 ib.remove(PdfName.ALTERNATE);
 outi.put(PdfName.DESTOUTPUTPROFILE, this.writer.addToBody(ib).getIndirectReference());
 this.writer.getExtraCatalog().put(PdfName.OUTPUTINTENTS, new PdfArray(outi));
 PdfDictionary markInfo = new PdfDictionary(PdfName.MARKINFO);
 markInfo.put(PdfName.MARKED, new PdfString("true"));
 this.writer.getExtraCatalog().put(PdfName.MARKINFO, markInfo);
} catch (IOException e) {
 getErrorLogger().error("Problem reading resource", e);
}

This was mostly done by Paolo, only the MarkInfo part was added by me.

Good luck
Elmar

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.