Hi Tilman, I'm not performing any filtering , so I don't think it can be the resource filtering problem.
All three of the tests result in PDFs that cannot be read through Adobe Acrobat. Alex -----Original Message----- From: Tilman Hausherr [mailto:thaush...@t-online.de] Sent: Thursday, July 29, 2021 3:07 AM To: users@pdfbox.apache.org Subject: Re: PDFBox corrupting PDFs when saving 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\\sr > c\\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 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org