You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Vassallo, Fabio" <Fa...@wuerth-phoenix.com> on 2017/05/16 06:54:40 UTC

Warning about document close

Good morning.
In my job I have to create several kind of documents.
I also have a user task that allows to create a single document by merging some (or many) of these documents.

So I create each document to merge, create and save the merged document, close it.
After that I call PDDocument.close() on each of the original document.

Everything works fine if I merge a little number of PDDocuments (I'm sure I call close() on each one); but if I merge many documents (and so the procedure last a longer time), I get a warning:
Warning: You did not close a PDF Document

Fabio


Fabio Vassallo
Product Development (CIS)

[cid:image001.png@01D18B3E.92F52E70]
Würth Phoenix S.r.l.
via Kravogl 4, 39100 Bolzano
T: +39 0471 564 116
F: +39 0471 564 122
Website<http://www.wuerth-phoenix.com/> | e-Mail<ma...@wuerth-phoenix.com> | Map<https://www.google.de/maps/place/Wuerth+Phoenix+S.R.L./@46.474192,11.33141,15z/data=!4m2!3m1!1s0x0:0x98a5db69edb2a02?hl=en>

[twitter-2]<https://twitter.com/WuerthPhoenix>  [wordpress-2] <http://www.neteye-blog.com/>   [linkedin] <https://www.linkedin.com/company/wuerth-phoenix>   [youtube] <https://www.youtube.com/user/WuerthPhoenix>   [http://feng-shui-web.net/blog2/wp-content/uploads/2016/02/xing-icon.png] <https://www.xing.com/companies/w%C3%BCrthphoenixsrl>   [facebook] <https://www.facebook.com/wuerthphoenix>


RE: Warning about document close

Posted by "Vassallo, Fabio" <Fa...@wuerth-phoenix.com>.
Good morning.
Yesterday I finally had the time to thoroughly debug  my code: it was actually my fault.
In certain cases I didn't close a document and PDFBox was right to point it out.

Thank you,
Fabio


Fabio Vassallo
Product Development (CIS)


Würth Phoenix S.r.l.
via Kravogl 4, 39100 Bolzano
T: +39 0471 564 116
F: +39 0471 564 122
Website | e-Mail | Map

          

-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Tuesday, May 16, 2017 11:52 AM
To: users@pdfbox.apache.org
Subject: Re: Warning about document close

Am 16.05.2017 um 08:54 schrieb Vassallo, Fabio:
>
> Good morning.
>
> In my job I have to create several kind of documents.
>
> I also have a user task that allows to create a single document by 
> merging some (or many) of these documents.
>
> So I create each document to merge, create and save the merged 
> document, close it.
>
> After that I call PDDocument.close() on each of the original document.
>
> Everything works fine if I merge a little number of PDDocuments (I'm 
> sure I call close() on each one); but if I merge many documents (and 
> so the procedure last a longer time), I get a warning:
>
> Warning: You did not close a PDF Document
>

Hard to tell without code. You must close every PDDocument that you open or create. Use "try with resources" if possible.

Tilman

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Warning about document close

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 16.05.2017 um 08:54 schrieb Vassallo, Fabio:
>
> Good morning.
>
> In my job I have to create several kind of documents.
>
> I also have a user task that allows to create a single document by 
> merging some (or many) of these documents.
>
> So I create each document to merge, create and save the merged 
> document, close it.
>
> After that I call PDDocument.close() on each of the original document.
>
> Everything works fine if I merge a little number of PDDocuments (I’m 
> sure I call close() on each one); but if I merge many documents (and 
> so the procedure last a longer time), I get a warning:
>
> Warning: You did not close a PDF Document
>

Hard to tell without code. You must close every PDDocument that you open 
or create. Use "try with resources" if possible.

Tilman