NAME

PDF::Make::Watermark - Watermarks and page stamps

SYNOPSIS

use PDF::Make;
use PDF::Make::Watermark;

my $doc = PDF::Make::Document->new;
$doc->add_page;

# Text watermark
my $wm = PDF::Make::Watermark->text(
	'CONFIDENTIAL',
	position => 'diagonal',
	opacity  => 0.3,
	size     => 72,
);
$doc->add_watermark($wm);

# Image watermark
my $logo = PDF::Make::Watermark->image(
	42,
	width    => 200,
	height   => 100,
	position => 'center',
	opacity  => 0.2,
);
$doc->add_watermark($logo);

# Text stamp
my $stamp = PDF::Make::Stamp->text(
	'Page %p of %P',
	position => 'bottom_center',
	margin   => 36,
	size     => 10,
);
$doc->apply_stamp($stamp);

# Bates stamp
my $bates = PDF::Make::Stamp->bates(
	prefix => 'DOC',
	start  => 1,
	digits => 6,
);
$doc->apply_stamp($bates);

DESCRIPTION

PDF::Make::Watermark and PDF::Make::Stamp provide watermark and stamp objects implemented in XS/C.

This module contains no Perl-side behavior logic. Constructors, validation, option parsing, format expansion, and rendering application all execute in XS/C.

Supported watermark types:

  • text watermark

  • image watermark

Supported stamp types:

  • text format stamps (%p, %P, %d, %t, %f, %%)

  • Bates numbering stamps

CLASSES

PDF::Make::Watermark

Constructors:

  • text($text, %options)

  • image($image_obj, %options)

Common option keys include: position, opacity, rotation, scale, x_offset, y_offset, overlay, tile_spacing_x, tile_spacing_y.

Text watermark options additionally include: font, size, color.

Image watermark requires: width and height.

PDF::Make::Stamp

Constructors:

  • text($format, %options)

  • bates(%options)

Stamp option keys include: position, margin, margin_x, margin_y, font, size, color.

For Bates stamps, additional keys include: prefix, start, digits, suffix.

DOCUMENT METHODS

The following methods are provided by PDF::Make::Document:

  • add_watermark($watermark)

  • apply_stamp($stamp)

POSITIONS

Position names accepted by constructors:

center diagonal tile custom
top_left top_center top_right
bottom_left bottom_center bottom_right
left_center right_center

SEE ALSO

PDF::Make, PDF::Make::Document, PDF::Make::Builder

AUTHOR

LNATION <email@lnation.org>

COPYRIGHT AND LICENSE

Copyright (C) 2024 by LNATION

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.