Hi,

 

I have encountered a strange problem with pdf box. I’m trying to split a Larger PDF file into smaller ones. The split function does work, but when saving the new generated pdf to disk, there’s a problem. I get this errormessage:
COSStream has been closed and cannot be read. Perhaps its enclosing PDDocument has been closed?

 

But I’ve sysout’ed the state of the document which say’s it’s not closed. And as well, the program runs properly in debug mode. I’m currently running eclipse on a Websphere applicatation Server 7. And I’ve tried to fix the problem for days now. But converting the PDDocument to a bytearray, and everything that is possible. As well I’ve tried to just use your save function that takes a filename as a parameter (Which is extremely slow, you should use a filebuffer and bytearray to save it).

 

How is it possible that it works in debug mode, and not “normal” mode. And I’m adding a picture so it’s possible for you to see the stacktrace. I’m adding a small part of the code as well, so it’s possible for you to analyze the source code (Which now looks bad, due to not being able to use debug mode, since it works fine)



Hope you have the time to help me as soon as possible. Btw, get the same error at version 1.8.7 and 2.0.0

 

Med vennlig hilsen

Vegard Fossestøl

Tlf: 916 32 699
Konsulent Møllergruppen