Hello Amber Prakash Verma Last week i reported on this issue as well, and it was confirmed by Tilman Hausherr as a bug.
See https://issues.apache.org/jira/browse/PDFBOX-5775 Mit freundlichen Grüssen Fabian Zünd ICT Techniker EFZ / Modul Programmierer Industriestrasse 19 CH-9450 Altstätten SG +41 71 595 10 60 +41 77 261 16 21 www.si-solutions.ch zu...@si-solutions.ch -----Ursprüngliche Nachricht----- Von: Amber Prakash Verma <amber.ve...@newgensoft.com.INVALID> Gesendet: Dienstag, 27. Februar 2024 08:56 An: users@pdfbox.apache.org Cc: Komal <komal.wa...@newgensoft.com>; Prasad Nemmikanti <prasad.nemmika...@newgensoft.com> Betreff: Issue with PDFBox 3.0.0 - Unable to Extract and Add Pages Dear PDFBox Team, I hope this email finds you well. I am writing to report an issue I encountered while using PDFBox version 3.0.0. It appears that there is a problem when attempting to extract pages from one PDF and add them to another PDF. While using the same code and PDFBox version 2.0.29, it is perfectly working and output PDF contains no blank pages. Issue Description: * Version: PDFBox 3.0.0 * Problem: When using the PDFBox library to extract pages from one PDF file and add them to another PDF or a new PDF file, the resulting document contains blank pages. Steps to Reproduce: * Load an existing PDF document. * Extract pages from document. * Add the extracted Pages to a new PDF. * Save the modified PDF. Expected Result: The resulting PDF should contain the extracted pages without any blank content. Actual Result: The resulting PDF contains blank pages. Additional Information: * I have attached the code snippet that reproduces the issue * I am using the following dependencies. PDFBox version 3.0.0 Java Version - 1.8.0_91 Code Snippet: ``` try{ for (int i = 1; i < iDestPageNumber; i++) { PDPage page = destReader.getPage(i-1); page.setMediaBox(destReader.getPage(i-1).getMediaBox()); page.setResources(destReader.getPage(i-1).getResources()); tempDocument.addPage(page); iOutputPageCount++; } int srcPages = srcReader.getNumberOfPages(); for (int i = 0; i < srcPages; i++) { PDPage page = srcReader.getPage(i); page.setMediaBox(srcReader.getPage(i).getMediaBox()); page.setResources(srcReader.getPage(i).getResources()); tempDocument.addPage(page); iOutputPageCount++; } for (int i =iDestPageNumber; i <= destPages; i++) { PDPage page = destReader.getPage(i-1); page.setMediaBox(destReader.getPage(i-1).getMediaBox()); page.setResources(destReader.getPage(i-1).getResources()); tempDocument.addPage(page); iOutputPageCount++; } tempDocument.save(outputPath); tempDocument.close(); } ``` I would appreciate any guidance, suggestions, or potential solutions to resolve this issue. If this is a known problem, please let me know if there are any workarounds or if a fix is planned in a future release. Thank you for your time and assistance. I appreciate the hard work you put into maintaining the PDFBox library. Best regards, Amber Prakash Verma amber.v...@newgensoft.com Newgen Software Disclaimer: This e-mail and any attachment may contain confidential, proprietary or legally privileged information. If you are not the original intended recipient and have erroneously received this message, you are prohibited from using, copying, altering or disclosing the content of this message. Please delete it immediately and notify the sender. Newgen Software Technologies Ltd (NSTL) accepts no responsibilities for loss or damage arising from the use of the information transmitted by this email including damages from virus and further acknowledges that no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of NSTL.