I haven't tested your code yet (might do later), but in the code I see you're loading from a resource. Could it be the resource filtering problem?

https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

Which of the tests fail? All three? Only one?

Tilman

Am 28.07.2021 um 22:22 schrieb Alexander Slonim:
Hello,

When I attempt to use PDDocument.save, the saved output file is corrupted,
even when no action is taken on the file other than saving it.

For example:

```

         File file = new
File("C:\\Users\\Public\\Desktop\\projects\\test-pdfbox-corruption\\src\\mai
n\\resources\\chicken.pdf");

         PDDocument document = Loader.loadPDF(file);

         document.save("C:\\Users\\Public\\Music\\file" + new
Date().getTime() + ".pdf");

         document.close();

```

I am currently using PDFBox 3.0.1-RC, however, I also used 2.0.15 and
2.0.24, and experienced the same issues.

For a more complete example, I have posted the project to GitHub
(https://github.com/pdinc-oss/pdfbox-corrupt-test.git)

I am new to PDFbox and am unsure if this is a usage error on my end or a bug
within PDFBox itself.

Best,

Alex




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

Reply via email to