We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PdfFileEditor.append does not close file

PdfFileEditor.append does not close outputFile on Linux.


Can you please share some more details like complete sample code snippet and sample files to test and replicate the issue at our end? Also, please share how you are checking if the file is still open?

    public void testPdfEditorAppendDoesNotCloseOutputFile()
        throws FileNotFoundException, Exception {
    final PdfFileEditor pdfEditor = new PdfFileEditor();
    final URL url1 = this.getClass().getResource("1.pdf");
    final URL url2 = this.getClass().getResource("2.pdf");

    final License license = new License();
    final InputStream is = this.getClass().getResourceAsStream("aspose.pdf.kit.lic");

    final String outFileName = url2.getFile() + "_out";
    final boolean appended =
            pdfEditor.append(url1.getFile(), url2.getFile(), 1, 1, outFileName);

    final boolean renamed =
            new File(outFileName).renameTo(new File(url2.getFile() + "_renamed"));


Fails on Windows 10.


We need to investigate this behavior of the API. Therefore, an investigation ticket as PDFJAVA-40768 has been logged in our issue tracking system. We will further analyze this case and let you know as soon as the analysis is complete. Please be patient and spare us some time.

The issues you have found earlier (filed as PDFJAVA-40768) have been fixed in Aspose.PDF for Java 21.8.