You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tanmay Sharma (Jira)" <ji...@apache.org> on 2024/02/11 03:07:00 UTC

[jira] [Created] (PDFBOX-5765) Not able to add watermark in PDF using Overlay

Tanmay Sharma created PDFBOX-5765:
-------------------------------------

             Summary: Not able to add watermark in PDF using Overlay
                 Key: PDFBOX-5765
                 URL: https://issues.apache.org/jira/browse/PDFBOX-5765
             Project: PDFBox
          Issue Type: Bug
            Reporter: Tanmay Sharma


I am trying to add watermark to PDF. I am taking following two files as inputs:
 # Original PDF file: To which needs to be added.
 # Watermark PDF File: It is one page PDF in which only contains watermark.

I am trying to combine those files in overlay to generate new document containing watermark in it.
{code:java}
PDDocument watermarkDoc = PDDocument.load(new File(".."));
//Assuming your empty document with watermark image in it.

        PDDocument realDoc = PDDocument.load(new File("..."));

        Overlay overlay = new Overlay();
        overlay.setInputPDF(realDoc);
        overlay.setDefaultOverlayPDF(watermarkDoc);
        PDDocument document = overlay.overlay(new HashMap<Integer, String>());
        document.save("...")); {code}
But when I try to open newly generated document in acrobat, though the watermark is displayed in the file, but Acrobat is not able to detect it. That is I am not able to perform any operation like update or delete watermark.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org