watermarkPdf

watermarkPdf

ADVANCED / PREMIUM BASIC

Inserts a watermark into a PDF document.

Description
public void watermarkPDF(String source, String target, String type, HashMap options) throws Exception

This method allows you to insert a watermark image or text in a PDF document.

Parameters

source

Path to the PDF document.

target

Path to the resulting watermarked document.

type

Watermark type: "text" or "image".

options

If type is "image":

Option Type Description
image String Path to the watermark image.
positionX Integer X-asis position (page center as default).
positionY Integer Y-asis position (page center as default).

If type is "text":

Option Type Description
text String The string of text used for watermarking.
positionX Integer X-asis position (page center as default).
positionY Integer Y-asis position (page center as default).
font String The font-family. It must be installed in the OS.
size Integer Font size.
color Integer HEX value.
Code samples

Example #1

Example #2