Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.15, 2.0.11
-
None
Description
When input pdf file for overlay contains empty page (with contents == null) like NPE.pdf file we get NullPointerException in Overlay.addOriginalContent method. It occurres even if we overlay over other than this empty page.
Here's some sample code to reproduce the problem:
Overlay overlayObj = new Overlay(); File file1 = new File("NPE.pdf"); PDDocument originalDoc = PDDocument.load(file1); overlayObj.setOverlayPosition(Overlay.Position.FOREGROUND); overlayObj.setInputPDF(originalDoc); Map<Integer, String> ovmap = new HashMap<>(); File file2 = new File("pdf2.pdf"); ovmap.put(2, file2.getPath()); overlayObj.overlay(ovmap); originalDoc.save("test__result.pdf");