Hi,

I'm trying to add a custom Output Intent with an sRGB color profile to a
PDF. I started with the Hello world example and tried to set the
OutputIntent before opening the document:

byte[] colorProfileData = getColorProfile();
Document document = new Document();
try {
    PdfWriter writer = PdfWriter.getInstance(document,
        new FileOutputStream("HelloWorld.pdf"));

    writer.setOutputIntents("Custom", "PDF/A sRGB", null, "PDF/A sRGB
ICC Profile, sRGB_IEC61966-2-1_withBPC.icc", colorProfileData);

    document.open();
    document.add(new Paragraph("Hello World"));
} catch (DocumentException de) {
   System.err.println(de.getMessage());
} catch (IOException ioe) {
   System.err.println(ioe.getMessage());
}
document.close();

But this resulted in a NullPointerException in the method
PdfWriter.setOutputIntents().


Then I tried setting the OutputIntent after the document.open() call:

byte[] colorProfileData = getColorProfile();
Document document = new Document();
try {
    PdfWriter writer = PdfWriter.getInstance(document,
        new FileOutputStream("HelloWorld.pdf"));
    document.open();

    writer.setOutputIntents("Custom", "PDF/A sRGB", null, "PDF/A sRGB
ICC Profile, sRGB_IEC61966-2-1_withBPC.icc", colorProfileData);

    document.add(new Paragraph("Hello World"));
} catch (DocumentException de) {
   System.err.println(de.getMessage());
} catch (IOException ioe) {
   System.err.println(ioe.getMessage());
}
document.close();

But this way I cannot open the resulting Pdf in the Adobe Reader.
The error message says "There was an error processing a page. There was
a problem reading this document (16)".
I attached the resulting Pdf.

So How can I add such a OutputIntent?

Thanks in advance,
Armin

PS: The color profile that I used is from
http://www.color.org/srgbprofiles.html



Attachment: HelloWorld.pdf
Description: Adobe PDF document

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to