Hi,
 
I'm currently using iText 4.0.8 (java) to convert existing PDFs to
PDF/A-1b.  I cannot upgrade to 4.1.0 currently, as I am also using a 3rd
party library that uses functions in iText that were removed in 4.1.0.
As part of the conversion to PDF/A-1b, I am setting the ICC_Profile on
the new document, using the code found here:
http://blog.rubypdf.com/2007/08/10/itext-and-itextsharp-support-pdfa-1-n
ow/
 
In the sample they show, the PDF generated is 23K (about 3K of that is
overhead from the ICC_Profile, which matches the file size of the
.profile file used).  When I generate a PDF without an ICC_Profile, I
can generate a PDF that's about 20K (1 page).  If I generate the same
PDF using the code below to embed an ICC_Profile (using the same profile
document), I get a PDF that is 122K.  This overhead of around 100KB does
not seem to be related to the content of the PDF I'm processing; a 300K
PDF (40 pages) with a profile becomes 400K.
 
The only difference from this code is that I am using a PdfCopy instead
of a PdfWriter.  Here is an extract of my code:
// PDF is read from bOut stream
PdfReader reader = new PdfReader(new
ByteArrayInputStream(bOut.toByteArray()));
Document doc = new Document(reader.getPageSizeWithRotation(1));
PdfCopy copy = new PdfCopy(doc, bOut);
copy.setPDFXConformance(PdfWriter.PDFA1B);
doc.open();
// Set ICC Output Intent
PdfDictionary intents = new PdfDictionary(PdfName.OUTPUTINTENT);
intents.put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("sRGB
IEC61966-2.1"));
intents.put(PdfName.INFO, new PdfString("sRGB IEC61966-2.1"));
intents.put(PdfName.S, PdfName.GTS_PDFA1);
ICC_Profile icc = ICC_Profile.getInstance("sRGB.pf");
PdfICCBased pdfICC = new PdfICCBased(icc);
pdfICC.remove(PdfName.ALTERNATE);
intents.put(PdfName.DESTOUTPUTPROFILE,
copy.addToBody(pdfICC).getIndirectReference());
copy.getExtraCatalog().put(PdfName.OUTPUTINTENTS, new
PdfArray(intents));
for (int page = 1; page <= reader.getNumberOfPages(); ++page) {
    copy.addPage(copy.getImportedPage(reader, page));
}
copy.createXmpMetadata();
doc.close();
 
Some code (ie: setting metadata) has been removed, but even without
configuring the document as PDF/A, embedding the ICC_Profile using
PdfCopy has led to these very large files.  I have also tried moving the
addPage() calls before my calls to set the ICC_Profile.
 
Is there any reason that my code should be producing files this large?
 
Thank you,
Robert Stoski
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to