Oops, I am getting tired; I forgot to mention the classes.
package org.apache.pdfbox.pdmodel; public class PDDocument And the same code in this class package org.apache.pdfbox.pdmodel.fdf; public class FDFDocument ________________________________ From: Lenahan, Peter Sent: Tuesday, January 20, 2009 6:08 AM To: '[email protected]' Subject: Could possibly be missing the case where the output was open, but the writer was not // could possibly be missing the case where the output was open, but the writer was not // be sure to close output of it is not possible to close the writer. public void save( OutputStream output ) throws IOException, COSVisitorException { //update the count in case any pages have been added behind the scenes. getDocumentCatalog().getPages().updateCount(); COSWriter writer = null; try { writer = new COSWriter( output ); writer.write( this ); writer.close(); } finally { if( writer != null ) { writer.close(); } else if (output != null) { output.close(); // This may happen of you don't have disk space or write access to the file. } } }
