I have it. I should have news next week. Paulo
----- Original Message ----- From: "Kevin Day" <[EMAIL PROTECTED]> To: "itext-questions-request@" <lists.sourceforg [email protected]> Sent: Tuesday, October 14, 2008 9:52 PM Subject: Re: [iText-questions] 'Could not find XObject named Xi1' errorafterusing PdfCopy with PageStamp Paulo- I sent a unit test case to your glintt.com address - if you haven't seen it yet, please let me know and I'll resend. Cheerio, - K ----------------------- Original Message ----------------------- From: Paulo Soares <[EMAIL PROTECTED]> To: Post all your questions about iText here <[email protected]> Cc: Date: Mon, 13 Oct 2008 17:31:32 +0100 Subject: Re: [iText-questions] 'Could not find XObject named Xi1' error afterusing PdfCopy with PageStamp I'll need a small standalone program and any needed PDF files so that I can reproduce the problem. If the PDFs have sensible information you may send it privately to me. Paulo > -----Original Message----- > From: Kevin Day [mailto:[EMAIL PROTECTED] > Sent: Monday, October 13, 2008 5:01 PM > To: itext-questions-request@ > Subject: Re: [iText-questions] 'Could not find XObject named > Xi1' error afterusing PdfCopy with PageStamp > > > Thanks for getting back to me - I think that we are seeing > something more involved - I'll include some of the data from > the resultant PDF and explain why I think so... > > > The source file for the stamp is very simple - just an MS > Word document with a single word on it printed to PDF - no > annotations, no form fields, etc... > > The problem is highly repeatable with a number of different > stamp sources. > > I'm running with latest code from iText SVN HEAD. > > > Just in case it helps, here is the PDF object for the second > page (which gives the error about object Xi1 missing): > > 14 0 obj > /ColorSpace/Font>>/MediaBox[0 0 612 792]/Rotate 0>> > endobj > > It appears that XObject named Xi1 is backed by object 11 0 > obj - but there is no object 11 0 obj in the PDF file at all. > That explains the error message in Acrobat, at least. > > Even more interesting is the xref table in the PDF: > > xref > 0 25 > 0000000000 65535 f > 0000000000 65536 n > 0000005347 00000 n > 0000000015 00000 n > 0000000091 00000 n > 0000003312 00000 n > 0000000193 00000 n > 0000002275 00000 n > 0000002037 00000 n > 0000017890 00000 n > 0000000000 65536 n > 0000000000 65536 n > 0000003598 00000 n > 0000003675 00000 n > 0000005056 00000 n > 0000004017 00000 n > 0000003778 00000 n > 0000005842 00000 n > 0000006072 00000 n > 0000006209 00000 n > 0000006471 00000 n > 0000006852 00000 n > 0000017868 00000 n > 0000017948 00000 n > 0000017994 00000 n > > > According to this, object 11 is at offset 0 with generation > number 65536 - doesn't seem right, does it? > > > Finally, I found the following listserv in the archives that > describe something similar to what I'm seeing (it's on the > dot-net list, but maybe I'm running into a similar issue on > the Java side??): > > http://www.nabble.com/Using-underlays-with-PdfCopy-tt15485168. > html#a15485168 > > > Any ideas on what might be going on here? It seems almost > like object 11 0 is just not being written to the output > stream somehow... > > - K > > ----------------------- Original Message ----------------------- > > From: "Paulo Soares" <[EMAIL PROTECTED]> > To: "Post all your questions about iText here" > <[email protected]> > Cc: > Date: Sun, 12 Oct 2008 18:45:19 +0100 > Subject: Re: [iText-questions] 'Could not find XObject named > Xi1' error afterusing PdfCopy with PageStamp > > You may call getImportedPage on the same reader more than > once only if the > pages doesn't ahave any annotation. > > Paulo > > ----- Original Message ----- > From: "Kevin Day" <[EMAIL PROTECTED]> > To: "itext-questions-request@" <lists.sourceforg > [email protected]> > Sent: Saturday, October 11, 2008 12:35 AM > Subject: [iText-questions] 'Could not find XObject named Xi1' error > afterusing PdfCopy with PageStamp > > > We are having a problem with PdfCopy (and PdfSmartCopy) > generating PDFs that > give the following error in Acrobat when navigating to any > page except the > first page: > > Could not find XObject named 'Xi1' > > > The stamped content appears on the first page of the PDF > only. Subsequent > pages show the original content, but not the stamp content. > > > We have traced the trigger to whether we re-instantiate the > PdfReader used > for the content source of the stamp for every single output > page. If we > re-use the PdfReader from page to page, we get the above > error. If we > create a new PdfReader for every page, we do not get the above error. > > > Here is test code that will recreate the problem (if you change > resetStampEachPage to true, the PDF generated behaves properly): > > > public void mergeAndStampPdf(File[] in, File out, File > stamp) throws > Exception { > Document document = new Document(); > > PdfCopy writer = new PdfSmartCopy(document, new > FileOutputStream(out)); > > document.open(); > > boolean resetStampEachPage = false; > int stampPageNum = 1; > PdfReader stampReader = new PdfReader(stamp.getPath()); > for (int inNum = 0; inNum < in.length; inNum++){ > // create a reader for the input document > PdfReader documentReader = new > PdfReader(in[inNum].getPath()); > > for (int pageNum = 1; pageNum <= > documentReader.getNumberOfPages(); pageNum++){ > > // import a page from the main file > PdfImportedPage mainPage = > writer.getImportedPage(documentReader, pageNum); > > // make a stamp from the page and get under content... > PdfCopy.PageStamp pageStamp = > writer.createPageStamp(mainPage); > > // import a page from a file with the stamp... > if (resetStampEachPage) > stampReader = new PdfReader(stamp.getPath()); > PdfImportedPage stampPage = > writer.getImportedPage(stampReader, stampPageNum++); > > // add the stamp template, update stamp, and > add the page > pageStamp.getOverContent().addTemplate(stampPage, 0, 0); > pageStamp.alterContents(); > writer.addPage(mainPage); > > if (stampPageNum > stampReader.getNumberOfPages()) > stampPageNum = 1; > } > } > > writer.close(); > document.close(); > } > > > > It seems odd to me that it wouldn't be legal to call > getImportedPage on the > same reader more than once (after all, we are calling > getImportedPage on the > source file reader multiple times without issue). > > I noticed in the source for PdfCopy#createPageStamp() that it > says that it > modifies the Reader instance, but I'm assuming this refers to > the reader > associated with the page passed in to createPageStamp. > > Any ideas on what's going on here (or are we mis-using something)? > > Thanks! > > - K ------------------------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
