i also tested it and it was fixed in version 2.1.6. Maybe that was the fix:
A PdfImportedPage always created a new entry in the xref table. That's not
always necessary. This change makes sure PdfImportedPage no more causes
entries like this: "0000000000 65536 n"

Glad it is working for you now...


2013/10/2 Daniel Borlean <dborl...@extraview.com>

> **
> FYI,
>
> I have just tested with iText-2.1.7.jar and the problem is resolved!
>
> Thanks,
> Daniel
>
>  ------------------------------
> *From:* Daniel Borlean [mailto:dborl...@extraview.com]
> *Sent:* Wednesday, 2 October, 2013 11:59
>
> *To:* 'Post all your questions about iText here'
> *Subject:* RE: [iText-questions] java.io.IOException: trailer not found
>
>  TvT,
>
> Thanks for the detailed response.  Attached is the problematic pdf file
> that the customer has allowed me to share.
>
> I will also try a newer version to see if that fixes the issue.
>
> I don't have Adobe Acrobat, but a colleague does so I will ask him to run
> Preflight on the pdf file.
>
> Thanks,
> Daniel
>
>  ------------------------------
> *From:* TvT [mailto:tvtre...@nepatec.de]
> *Sent:* Tuesday, 1 October, 2013 23:46
> *To:* Post all your questions about iText here
> *Subject:* Re: [iText-questions] java.io.IOException: trailer not found
>
>  Two possibilities:
>
> 1. You are using an quite old version of iText and maybe that was a bug
> fixed a long time ago?
> 2. Your PDF is not (fully) PDF spec compliant
> (3. possible but not probable: iText has a bug and your PDF is running
> into it)
>
> Opening a PDF in Adobe Reader doesn't say anything except it may be some
> sort of PDF file you are trying to open. Adobe Reader is like IE back in
> the days - opening any crap HTML page guessing their authors intent. You
> can now try the following three things:
>
> 1. provide the PDF and we can tell you more. If it is a customer PDF and
> you are not able to share then
> 2. try a newer version of iText (2.1.7 for less changes in your code
> and/or 5.4.4 the most up-to-date version) and see whether the problem still
> exists
> 3. Do you have an Adobe Acrobat at hand? If so run Preflight (Check PDF
> Syntax Errors and PDF/A-1b compatibility. Even if your PDF may not be a
> PDF/A document this test is in many cases better to detect general PDF spec
> problems then the syntax check)
>
>
> Regards,
> TvT
>
>
>
> 2013/10/1 Daniel Borlean <dborl...@extraview.com>
>
>> **
>> Hi,
>>
>> We're using the iText-2.1.2u.jar version to generate flattened pdf forms
>> with additional pdf files inserted.  The following code illustrates how the
>> additional pdf files are inserted:
>>
>> ...
>>                 // read pdf attachment
>>                 InputStream is = getFileInputStream(con, diu);
>>
>>                 if (is == null)
>>                 {
>>                     return;
>>                 }
>>
>>                 PdfReader docReader = new PdfReader(is);
>>
>>                 // note: pdf pages start with 1, not 0
>>                 for (int p = 1; p <= docReader.getNumberOfPages(); p++)
>>                 {
>>                     copy.addPage(copy.getImportedPage(docReader, p));
>>                 }
>>
>>                 docReader.close();
>>                 is.close();
>> ...
>>
>> Our customer is having trouble with inserting a pdf file that was
>> generated from scanning a document into a pdf file.  The "new
>> PdfReader(is)" line above keeps generating the exception below.  I've
>> searched online for the cause of this error and learned that it's because
>> the file is not ended properly or is somehow corrupt, but I am able to open
>> the pdf file just fine with Adobe Reader; furthermore, I compared the
>> ending of the file with other pdf files that work just fine (using a text
>> editor), and don't observe any differences.  Does anyone know how to
>> resolve this issue?
>>
>> Thanks,
>> Daniel
>>
>>
>> 2013-10-01  10:29:19  [  ERROR]  ajp-bio-8116-exec-1 Exception =
>> java.io.IOException: trailer not found.
>> java.io.IOException: trailer not found.
>>         at com.lowagie.text.pdf.PdfReader.rebuildXref(Unknown Source)
>>         at com.lowagie.text.pdf.PdfReader.readPdf(Unknown Source)
>>         at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
>>         at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
>>         at
>> com.extraview.applogic.admin.PDFGenerationTool.insertDocument(PDFGenerationTool.java:627)
>>         at
>> com.extraview.applogic.admin.PDFGenerationTool.applyDocumentAttachmentMapping(PDFGenerationTool.java:281)
>>         at
>> com.extraview.applogic.admin.PDFGenerationTool.generatePDF(PDFGenerationTool.java:178)
>>         at
>> com.extraview.usercustom.CustomCodeBase.generateAndSavePdf(CustomCodeBase.java:3663)
>>         at
>> com.extraview.usercustom.CustomCodeBase.ucEditRefresh(CustomCodeBase.java:791)
>>         at
>> com.extraview.usercustom.UserCustom.preEditRefresh(UserCustom.java:1699)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>         at
>> com.extraview.usercustom.UserCustomProxy.invoke(UserCustomProxy.java:105)
>>         at $Proxy6.preEditRefresh(Unknown Source)
>>         at
>> com.extraview.presentation.Display.doEditDisplayRefresh(Display.java:1925)
>>         at
>> com.extraview.presentation.Display.doEditDisplay(Display.java:1723)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>         at ExtraView.service(ExtraView.java:309)
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>         at
>> com.planetj.servlet.filter.compression.CompressingFilter.doFilter(CompressingFilter.java:270)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>         at
>> com.extraview.presentation.JSPForwardingFilter.doFilter(JSPForwardingFilter.java:38)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>         at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
>>         at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>>         at
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>>         at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>>         at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>>         at
>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
>>         at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>>         at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
>>         at
>> org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:196)
>>         at
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
>>         at
>> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
>>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
>> Source)
>>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
>> Source)
>>         at java.lang.Thread.run(Unknown Source)
>>
>> ---------------------------------------
>> Daniel Borlean
>> Consulting Engineer
>> ExtraView Corporation
>> Scotts Valley, California, USA
>> (831) 461-7100 ext 117
>>
>>
>>
>> ------------------------------------------------------------------------------
>> October Webinars: Code for Performance
>> Free Intel webinars can help you accelerate application performance.
>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
>> from
>> the latest Intel processors and coprocessors. See abstracts and register >
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> iText(R) is a registered trademark of 1T3XT BVBA.
>> Many questions posted to this list can (and will) be answered with a
>> reference to the iText book: http://www.itextpdf.com/book/
>> Please check the keywords list before you ask for examples:
>> http://itextpdf.com/themes/keywords.php
>>
>
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
> from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to