>- you did your changes in an old source file.

Yes. I've patched the version I use (I'll update soon).

>the temp file is deleted on close. It makes impossible to reopen.

Yes again. It's just a temp file : I use iText in a web
application, so deleteOnExit was not an option.

However, if you call reopen (without calling the close), it just performs a
seek(0) as in the original code.

Deleting the file on close is the first solution I though about: better
solutions certainly exists.

>The javadoc needs a warning about the memory

I agree.

> but I'll leave the rest to the user.

If it's clearly indicated in the JavaDoc, this can be a choice.
Since I don't want to patch iText everytime I update it, I'll update my code
to save the BLOB in a temporary file before I call iText.

Thank you for your time and your help.

Regards,
Massimiliano Ziccardi

On Thu, Jun 19, 2008 at 6:15 PM, Paulo Soares <[EMAIL PROTECTED]> wrote:

> Some remarks:
>
> - you did your changes in an old source file.
> - the temp file is deleted on close. It makes impossible to reopen.
>
> The javadoc needs a warning about the memory but I'll leave the rest to
> the user.
>
> Paulo
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of Massimiliano Ziccardi
> > Sent: Thursday, June 19, 2008 4:01 PM
> > To: itext-questions@lists.sourceforge.net
> > Subject: Re: [iText-questions] Problem parsing huge PDF files
> >
> > Hi Paulo.
> >
> > I solved the problem.
> > I've looked through the iText sources and I've found the problem.
> >
> > The PDF file I've to parse, is extracted from an Oracle BLOB,
> > so the RandomAccessFileOrArray received an InputStream
> > as input.
> > Looking through the RandomAccessFileOrArray class, I've
> > discovered that InputStreams are fully loaded into an byte
> > array: this was
> > the reason I always got OutOfMemory.
> >
> > I solved the problem saving the stream to a temporary file
> > and then passing the file to RandomAccessFileOrArray.
> >
> > **I think the JavaDoc should clearly say that passing an
> > input stream you get the file fully loaded in memory, don't
> > you agree?**
> >
> > One more think: I think it would be nice if streams bigger
> > than a given size would be saved to a temporary file instead
> > of memory.
> >
> > An example of this implementation is the attached file.
> > It could be improved in many way: a static configuration
> > class, where you can enable/disable temporary file saving,
> > configure the MAXIMUM memory consumption, configure the
> > temporary directory, etc...
> >
> > Regards,
> > Massimiliano Ziccardi
> >
> >
> >
> >
> >
> >
> > On Thu, Jun 19, 2008 at 1:30 PM, Paulo Soares
> > <[EMAIL PROTECTED]> wrote:
> >
> >
> >       The problem is that you have a lot of objects and even
> > though iText only
> >       stores the xref it is still a few million elements to
> > store. It could be
> >       possible to have this in file instead of memory but
> > that's not how
> >       things work now.
> >
> >       Paulo
> >
> >
> >       > -----Original Message-----
> >       > From: [EMAIL PROTECTED]
> >       > [mailto:[EMAIL PROTECTED] On
> >       > Behalf Of Massimiliano Ziccardi
> >
> >       > Sent: Thursday, June 19, 2008 12:19 PM
> >       > To: itext-questions@lists.sourceforge.net
> >
> >       > Subject: Re: [iText-questions] Mail delivery failed:
> >       > returning message tosender
> >       >
> >       > Thanks Paulo.
> >       >
> >       > That solution do not works. I already tried (I found that on
> >       > the mailing list archive), but
> >       > I always get OutOfMemory (My JVM has 512M of memory).
> >       >
> >       > >Big PDFs will always require more memory, no miracles here.
> >       >
> >       > I'm not very expert about internal PDF structure. My question
> >       > is: do iText has some
> >       > streaming function, so that it takes very few data in memory
> >       > and writes all the temporary data
> >       > on a temporary file?
> >       >
> >       > Thanks,
> >       > Massimiliano Ziccardi
>
>
> 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://sourceforge.net/services/buy/index.php
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Do you like iText?
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Or leave a tip: https://tipit.to/itexttipjar
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to