Overlay Watermark PDF using Java

Overlay your PDF with Watermark

PDF

Add PDF Watermark using PDF Page Overlay easily with Overlay Watermark PDF Java library.

Try for FREE

ConvertAPI Java library install

ConvertAPI provides a Java SDK that allows you to perform a Overlay Watermark PDF conversion with just a few lines of code. Overlay Watermark PDF documents using Java programming language with no effort at all!

# Add the following dependency to your pom.xml:
<dependency>
   <groupId>com.convertapi.client</groupId>
   <artifactId>convertapi</artifactId>
   <version>2.10</version>
</dependency>

Authenticate your Java library

You can obtain your secret key by signing up for a free account. Once you sign up, you'll receive 250 free conversions instantly! Grab your authentication secret from the account dashboard, and authenticate the ConvertAPI Java library like this:

# get your secret key here: https://www.convertapi.com/a/auth
use \ConvertApi\ConvertApi;
ConvertApi::setApiSecret('your-api-secret');

Overlay Watermark PDF using Java in no time!

Once you have your authentication in place, simply copy-paste this pdf to watermark-overlay conversion code snippet into your Java project:

// Code snippet is using the ConvertAPI JavaScript Client: https://github.com/ConvertAPI/convertapi-js

// Code snippet is using the ConvertAPI Node.js Client: https://github.com/ConvertAPI/convertapi-nodejs

// Code snippet is using the ConvertAPI PHP Client: https://github.com/ConvertAPI/convertapi-php

// Code snippet is using the ConvertAPI Java Client: https://github.com/ConvertAPI/convertapi-java

// Code snippet is using the ConvertAPI C# Client: https://github.com/ConvertAPI/convertapi-dotnet

# Code snippet is using the ConvertAPI Ruby Client: https://github.com/ConvertAPI/convertapi-ruby

# Code snippet is using the ConvertAPI Python Client: https://github.com/ConvertAPI/convertapi-python

// Code snippet is using the ConvertAPI Go Client: https://github.com/ConvertAPI/convertapi-go

REM Code snippet is using the command line utility program: https://github.com/ConvertAPI/convertapi-cli

<!-- For conversions with the multiple file result please refer to this example: https://repl.it/@ConvertAPI/HTML-Form-with-multiple-file-result -->

Upload the file and see how it works

You can set up the advanced conversion parameters and test the conversion result online using our interactive demo tool. It will auto-generate the code snippet for you!

Advanced Overlay Watermark PDF conversion parameters

Password String

Sets the password to open protected documents.

PageRange String

Set page range. Example 1-10 or 1,2,5.

OverlayFile File

Specifies the PDF file to use as overlay. Value can be URL or file content.

OverlayPage Integer

Specifies the page to use as overlay from the OverlayFile file.

Scale Integer

Specifies the watermark scale in percent.

Opacity Integer

Specifies watermark opacity level.

Style Collection

Specifies watermark style, stamp or watermark. The stamp is placed over page content and watermark under page content.

Values:   stamp watermark

GoToLink String

Specifies the web address to go when the watermark is clicked.

GoToPage String

Specifies the page number to go when the watermark is clicked.

PageRotation Bool

Specifies whether to use the page rotation parameter when placing watermark.

CropBox Bool

Specifies whether to use the page crop box to position watermark.

HorizontalAlignment Collection

Specifies the horizontal watermark alignment.

Values:   left center right

VerticalAlignment Collection

Specifies the vertical watermark alignment.

Values:   top center bottom

PositionX Integer

Specifies the watermark X coordinate. If set overrides property HorizontalAlignment.

PositionY Integer

Specifies the watermark Y coordinate. If set overrides property VerticalAlignment.

PositionUnit Collection

Specifies measurement unit to use for the PositionX and PositionY properties.

Values:   pt in mm cm

EmbedFonts Bool

Embed fonts in PDF.

SubsetFonts Bool

Include in the output PDF document only the font characters that are used in the original document.

SubsetFontsThreshold Integer

Sets the Subset Fonts threshold. If the percentage of used characters, compared with total characters of the particular font, exceeds this threshold, the entire font is embedded.

PdfVersion Collection

Set PDF version.

Values:   1.2 1.3 1.4 1.5 1.6 1.7 1.8 2.0

PdfResolution Integer

Set PDF resolution.

PdfTitle String

Provide a value to customize the PDF title. Otherwise, the default document title will be used. Use single quotes and a space (' ') to remove the title.

PdfSubject String

Provide a value to customize the PDF subject. Otherwise, the default document subject will be used. Use single quotes and a space (' ') to remove the subject.

PdfAuthor String

Provide a value to customize the PDF author. Otherwise, the default document author will be used. Use single quotes and a space (' ') to remove the author.

PdfKeywords String

Provide a value to customize the PDF keywords. Otherwise, the default document keywords will be used. Use single quotes and a space (' ') to remove the keywords.

OpenPage Integer

Set the page number at which the PDF document should open.

OpenZoom Collection

Set the default zoom percentage for when you open PDF files .

Values:   Default ActualSize FitPage FitWidth FitHeight FitVisible 25 50 75 100 125 150 200 400 800 1600 2400 3200 6400

RotatePage Collection

Automatically rotate pages based on the orientation of the text. By Page option will rotate each page based on the direction of the text on that page. All option will rotate all pages in the document based on the orientation of the majority of text.

Values:   Disabled ByPage All

ColorSpace Collection

Set PDF color space.

Values:   Default RGB CMYK Gray

Try Overlay Watermark PDF for free!