After doing a little more investigative work, it does seem to be something
with my program that is causing the problem, and not the version of the PDF
document.
The error is "There was an error opening this document. The file is damaged
and could not be repaired." The error is occurring for Adobe Reader Version
7 (and below I presume). The PDFs work fine in version 8 and above. The
error occurs even if I try working with an old pdf created in 2005, which I
can open up directly in Adobe Reader Version 7 with no problem. It just
doesn't open in my code.
I've tried a simple version of my program which just opens an instance of an
iText Document, reads in the PDF via a pdfReader to my final PDF document
via the AddPage method, and closes the document but even that does not work.
Here is my simple program code. Can anyone see something wrong?
Response.ContentType = "Application/pdf"
Dim myFinalDocument As New Document
Dim myFinalPDFCopyStream As New PdfCopy(myFinalDocument,
Response.OutputStream)
myFinalDocument.Open()
Dim i As Integer
Dim strExplanationPDFFile As String =
MapPath("pdfs/CrystalReportsWalkthrough.pdf")
Dim ExplanationPDFReader As New PdfReader(New
RandomAccessFileOrArray(strExplanationPDFFile), Nothing)
Dim NExplanationPDFPages As Integer =
ExplanationPDFReader.NumberOfPages
For i = 1 To NExplanationPDFPages
myFinalPDFCopyStream.AddPage(myFinalPDFCopyStream.GetImportedPage(ExplanationPDFReader,
i))
Next
myFinalDocument.Close()
myFinalPDFCopyStream.Close()
Karen
On Fri, Apr 9, 2010 at 2:09 PM, Karen Keller <[email protected]> wrote:
> Thanks, Mark. I'm being told that they are getting a file corrupted error.
> I only have Adobe Reader 9 and it works fine in that. I haven't had a chance
> to find somewhere where I can test the other versions myself. I'm going to
> try using your setPdfVersion code and see if that helps. I appreciate your
> help.
>
>
> On Fri, Apr 9, 2010 at 1:14 PM, Mark Storer <[email protected]> wrote:
>
>> In what way does the PDF not work? Are they just getting a “not the
>> right version” message when they open the file?
>>
>>
>>
>> Any time someone opens a PDF with a version MARKED as being newer than the
>> viewer (Reader, Acrobat, whatever) they are using, the get a warning
>> message. It’s entirely possible that this error report is simply a result
>> of seeing that message. iText just leaves the original version number in
>> place from the original file. You can call myPdfWriter.setPdfVersion(
>> PdfWriter.PDF_VERSION_1_X ), where X is whatever you need to support.
>>
>>
>>
>>
>>
>>
>>
>> --Mark Storer
>>
>> Senior Software Engineer
>>
>> Cardiff.com
>>
>>
>>
>> import legalese.Disclaimer;
>>
>> Disclaimer<Cardiff> DisCard = null;
>>
>>
>> ------------------------------
>>
>> *From:* Karen Keller [mailto:[email protected]]
>> *Sent:* Friday, April 09, 2010 4:44 AM
>>
>> *To:* Post all your questions about iText here
>> *Subject:* Re: [iText-questions] What version of Adobe Acrobat?
>>
>>
>>
>> The PDF that is generated from the program is generated via iText and
>> isn't saved anywhere, just displayed in a browser, so I don't have a sample
>> of that to show you. The final PDF is created from three separate PDFs, two
>> of which I attached. These two PDFs were, indeed, generated originally from
>> Acrobat 9, and one of them (GFE) has some fields that can be filled in by
>> the program. The third PDF is generated dynamically in memory at run-time by
>> Reporting Services and isn't saved anywhere.
>>
>> On Fri, Apr 9, 2010 at 2:16 AM, 1T3XT info <[email protected]> wrote:
>>
>> Karen Keller wrote:
>> > I recently downloaded and used the iText libary version 5.0.1 in a
>> > website for a client. For the website, I had to prefill some fields on
>> > one PDF and concatenate it with two other PDFs and then display the
>> > resulting package. I am being told that the resultant PDF file can't be
>> > viewed in anything except Adobe Acrobat 9.0. Why should this be?
>>
>> This is not an iText question. You can create PDF documents
>> with Acrobat 9 that have functionality that doesn't work
>> in Acrobat 8. To have those documents work in Acrobat 8,
>> you need to avoid the functionality that was introduced in
>> Acrobat 9. That can be a range of things, it would lead us
>> too far to list them here.
>>
>> The easiest solution would be for you to show us the PDF.
>> --
>> This answer is provided by 1T3XT BVBA
>> http://www.1t3xt.com/ - http://www.1t3xt.info
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.itextpdf.com/book/
>> Check the site with examples before you ask questions:
>> http://www.1t3xt.info/examples/
>> You can also search the keywords list:
>> http://1t3xt.info/tutorials/keywords/
>>
>>
>>
>> No virus found in this incoming message.
>>
>> Checked by AVG - www.avg.com
>> Version: 9.0.801 / Virus Database: 271.1.1/2786 - Release Date: 04/08/10
>> 11:32:00
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.itextpdf.com/book/
>> Check the site with examples before you ask questions:
>> http://www.1t3xt.info/examples/
>> You can also search the keywords list:
>> http://1t3xt.info/tutorials/keywords/
>>
>
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/