This is a problem with PdfSmartCopy. Use PdfCopy until the problem is
fixed.

Paulo 

> -----Original Message-----
> From: Bo Benson [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, January 08, 2008 5:48 AM
> To: Paulo Soares
> Subject: Re: [iText-questions] strange problem with 
> concatenation and pantone
> 
> thanks, paulo.
> 
> i hope it is ok to mail you them, since i'd rather not have 
> these PDFs put in a public forum (although any discussions 
> about the bug/solution certainly belong in the mailing list.) 
>   thanks for your understanding. 
> 
> in the attached, the pdf* files all look great.  when these 
> are concat'd together into book*.pdf, note that the pantone 
> box at the top of each page becomes a uniform color.
> 
> this only happens with pantone sources; rgb works great, for 
> example.  but i need these to be pantone colors. 
> 
> thanks for taking the time to look.  this has caused me no 
> small amount of grief.  :-)
> 
> -Bo
> 
> 
> 
> Date: Sat, 5 Jan 2008 09:34:20 -0000
> From: "Paulo Soares" < [EMAIL PROTECTED]>
> Subject: Re: [iText-questions] strange problem with concatenation and
>        pantone
> 
> 
> That's very strange. Post a link to the pdf files so that the 
> problem can be 
> reproduced.
> 
> Paulo
> 
> 
> ----- Original Message -----
> From: "Bo Benson" <[EMAIL PROTECTED]>
> To: < [email protected] 
> <mailto:[email protected]> >
> Sent: Saturday, January 05, 2008 7:25 AM
> Subject: [iText-questions] strange problem with concatenation 
> and pantone
> 
> 
> > i'm seeing some strange behavior with concatenation. 
> >
> > i have individual PDF files (1-2 pages each) that have a 
> pantone-colored
> > box
> > in the header of the page.  these individual PDF files look great.
> >
> > i then use iText (java) to concatenate them into a single 
> PDF via the 
> > prescribed concatenate technique (adapted from the
> > Concatenate.javaexample.)  this works well except for one problem:
> > all of the pages' header
> > boxes "inherit" the color of the box on whatever is the 
> first page in the 
> > sequence.
> >
> > so, if i have 3 single-page PDF files with pantone-colored 
> rectangles in
> > the
> > header:
> >
> >   1. blue box
> >   2. orange box
> >   3. brown box
> >
> > those 3 PDF files look perfect.  after concatenation, one 
> would obviously
> > expect the same sequence, but all 3 would be blue.  (or 
> whatever the color
> > is of PDF #1).  everything else about the pages (text, 
> fonts, layout, 
> > EVERYTHING) is perfect.  only that rectangular pantone box 
> has the wrong
> > color -- a valid color, not a random one or 
> not-quite-the-right-shade
> > color,
> > just the one belonging to page #1 for all pages. 
> >
> > i haven't been able to find any documentation that 
> describes anything
> > different that needs to be done to handle concatenation when pantone
> > colors
> > are involved.  i've tried some variations (with/without 
> smart-copy, etc) 
> > to
> > no avail.
> >
> > any ideas?
> >
> > thanks much!
> >
> > =====================
> >
> >    public int concatenatePdf(List<File> pdfList, File 
> destPdfFile, boolean
> > makeEven) {
> >        int pageCount = 0;
> >        if (pdfList == null) {
> >            return pageCount;
> >        }
> >
> >        // concatenate into single PDF
> >        Document document = null; 
> >        PdfCopy writer = null;
> >        for (File srcFile : pdfList) {
> >            // open the source for reading
> >            PdfReader reader = getPdfReader(srcFile);
> >            if (reader != null) { 
> >
> >                // prepare the destination for writing
> >                if (document == null) {
> >                    document = new 
> Document(reader.getPageSizeWithRotation
> > (1));
> >                    try { 
> >                        writer = new PdfSmartCopy(document, new
> > FileOutputStream(destPdfFile));
> >                    } catch (Throwable e) {
> >                        log.error("unable to write to output 
> pdf: " + 
> > destPdfFile.getPath() + ":", e);
> >                        return 0;
> >                    }
> >                    document.open();
> >                }
> >
> >                // concatenate pages, ignore form fields and 
> bookmarks if 
> > any
> >                pageCount += importPages(reader, writer, srcFile);
> >            }
> >        }
> >
> >        if (makeEven && pageCount > 0 && (pageCount % 2) == 1) { 
> >            File srcFile = PdfAssembler.getBlankPageFile();
> >            // open the source for reading
> >            PdfReader reader = getPdfReader(srcFile);
> >            if (reader != null) {
> >
> >                assert (document != null);
> >
> >                // concatenate pages, ignore form fields and 
> bookmarks if
> > any
> >                pageCount += importPages(reader, writer, srcFile); 
> >            }
> >        }
> >
> >        if (document != null) {
> >            document.close();
> >        }
> >        return pageCount;
> >    }
> >
> >    protected PdfReader getPdfReader(File srcFile) { 
> >        PdfReader reader = null;
> >        try {
> >            reader = new PdfReader(srcFile.getPath());
> >            reader.consolidateNamedDestinations();
> >        } catch (IOException e) { 
> >            log.error("unable to read src pdf: " + 
> srcFile.getPath() + ":",
> > e);
> >        }
> >        return reader;
> >    }
> >
> >    protected int importPages(PdfReader reader, PdfCopy writer, File 
> > srcFile) {
> >        int pageCount = 0;
> >        PdfImportedPage page;
> >        int n = reader.getNumberOfPages();
> >        for (int i = 1; i <= n; i++) {
> >            page = writer.getImportedPage (reader, i);
> >            try {
> >                writer.addPage(page);
> >                pageCount++;
> >            } catch (Throwable e) {
> >                log.error("unable to add pdf page " + i + ": " + 
> > srcFile.getPath() + ":", e);
> >            }
> >        }
> >        return pageCount;
> >    }
> >
> 
> 


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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