It's a bug in iText. iText has an arbitrary file limit to avoid loading
infinitely big images that caps the file size at 0x7ffffff or 134217727 bytes.
I'll have to increase the size, maybe have a global variable.
Paulo
> -----Original Message-----
> From: Mark Storer [mailto:msto...@autonomy.com]
> Sent: Tuesday, September 15, 2009 6:32 PM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Large JPG file corrupted when
> loaded into PDF
>
> You can't. That's what happens when you write code in an
> email program.
>
> --Mark Storer
> Senior Software Engineer
> Cardiff.com
>
> #include <disclaimer>
> typedef std::Disclaimer<Cardiff> DisCard;
>
>
>
> > -----Original Message-----
> > From: Glen Hamel [mailto:glen.ha...@auricnet.ca]
> > Sent: Tuesday, September 15, 2009 10:17 AM
> > To: 'Post all your questions about iText here'
> > Subject: Re: [iText-questions] Large JPG file corrupted when
> > loaded into
> > PDF
> >
> >
> > Ummm, how can you use buf before you create the variable??
> >
> > Glen Hamel
> > Auric Networks Canada, Inc.
> > 570 Orwell Street, Unit 1
> > Mississauga, Ontario
> > L5A 3V7
> >
> > Phone : 905.361.7621 x 204
> > Cell : 647.212.8742
> > Fax : 905.274.3912
> > Email : glen.ha...@auricnet.ca
> >
> > http://www.auricnet.ca
> >
> > -----Original Message-----
> > From: Mark Storer [mailto:msto...@autonomy.com]
> > Sent: Tuesday, September 15, 2009 1:09 PM
> > To: Post all your questions about iText here
> > Subject: Re: [iText-questions] Large JPG file corrupted when
> > loaded into PDF
> >
> > I'm gonna guess that the JPG is being read through a buffered read
> > operation, but they're only calling "read" once.
> >
> > void slurp( InputStream src, OutputStream dest ) throws
> IOException {
> > int numRead = src.read( buf );
> > byte [] buf = new byte[ 4096 ];
> > while (numRead > 0) {
> > dest.write( buf, 0, numRead );
> > numRead = src.read( buf );
> > }
> > }
> >
> > --Mark Storer
> > Senior Software Engineer
> > Cardiff.com
> >
> > #include <disclaimer>
> > typedef std::Disclaimer<Cardiff> DisCard;
> >
> >
> >
> > > -----Original Message-----
> > > From: Paulo Soares [mailto:psoa...@glintt.com]
> > > Sent: Tuesday, September 15, 2009 9:32 AM
> > > To: Post all your questions about iText here
> > > Subject: Re: [iText-questions] Large JPG file corrupted when
> > > loaded into
> > > PDF
> > >
> > >
> > > There's something else going on, the JPG file file is always
> > > copied to the PDF. Can you post your code and a link to the
> > big image?
> > >
> > > Paulo
> > >
> > > > -----Original Message-----
> > > > From: Larry Reeder [mailto:lnree...@gmail.com]
> > > > Sent: Tuesday, September 15, 2009 5:01 PM
> > > > To: Post all your questions about iText here
> > > > Subject: Re: [iText-questions] Large JPG file corrupted when
> > > > loaded into PDF
> > > >
> > > > Thanks for the quick response! I'm using Xmx to set the Java
> > > > heap memory to 1 GB, and my java process seems to top out at
> > > > 300 MB, and I'm not seeing any OutOfMemory errors, so I don't
> > > > think it's a JDK memory problem.
> > > >
> > > > Regarding validity of the image, the image in the PDF is
> > > > corrupt before acrobat sees it. My PDF doc only has one JPG
> > > > image in it, and that JPG image is 173 MB, but the PDF that's
> > > > generated from the JPG is only 134 MB. Since the JPG is
> > > > inserted as-is inline in the PDF doc, I would have expected
> > > > the PDF file size to be slightly over 173 MB. My original
> > > > JPG has the JPG end-of-image marker FFD9, but the image
> > > > stream in the PDF doesn't have this end-of-image marker, so
> > > > it seems like the JPG is corrupted in the process of loading
> > > > it into the PDF.
> > > >
> > > > Any other thoughts about what might be going wrong here? I
> > > > can provide a small sample if that would be helpful.
> > > >
> > > > Thanks......... Larry
> > > >
> > > >
> > > > On Tue, Sep 15, 2009 at 8:47 AM, Paulo Soares
> > > > <psoa...@glintt.com> wrote:
> > > >
> > > >
> > > > The only limitation is that at some time you must have
> > > > enough memory for the image but there are no other
> > > > restrictions. JPG images are always imported as-is so it's
> > > > Acrobat that doesn't like the image.
> > > >
> > > > Paulo
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Larry Reeder [mailto:lnree...@gmail.com]
> > > > > Sent: Tuesday, September 15, 2009 3:39 PM
> > > > > To: itext-questions@lists.sourceforge.net
> > > > > Subject: [iText-questions] Large JPG file
> corrupted when
> > > > > loaded into PDF
> > > > >
> > > > > I'm loading a very large JPG (173 MB, with geometry
> > > > > 28000x28000) into a PDF using the iText SDK.
> iText creates
> > > > > the PDF without error, but, based on the size of the
> > > > > resulting PDF, only about 134 MB of the JPG
> is loaded. As a
> > > > > result, Adobe Reader loads most of my PDF,
> but complains that
> > > > > there is "Insufficient data for an image"
> after the image is
> > > > > about 75% loaded.
> > > > >
> > > > > I think the issue is related to the file size, not the
> > > > > geometry of the JPG. When I use a lower
> quality JPG with a
> > > > > geometry of 28000x28000 and a size of 129 MB,
> iText generates
> > > > > the PDF, and Adobe Reader loads it without complaint.
> > > > >
> > > > > Note that I am setting the mediabox to
> 14000x14000 and the
> > > > > image scale to 50% to avoid making the PDF bigger
> > > > than 200x200 inches.
> > > > >
> > > > > Is there some known limit to the image file
> size in iText?
> > > > > Any pointers about where I can look for problems?
> > > > >
> > > > > Thanks.......... Larry
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.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
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/