NAME
CAM::PDF::Annot - Perl extension for appending annotations on PDFs
SYNOPSIS
use strict;
use CAM::PDF::Annot;
my $pdf = CAM::PDF::Annot->new( 'pdf1.pdf' );
my $otherDoc = CAM::PDF::Annot->new( 'pdf2.pdf' );
for my $page ( 1 .. $pdf->numPages() ) {
my %refs;
for my $annotRef ( @{$pdf->getAnnotations( $page )} ) {
$otherDoc->appendAnnotation( $page, $pdf, $annotRef, \%refs );
}
}
$otherDoc->output('pdf_merged.pdf');
DESCRIPTION
CAM::PDF::Annot is an extension to CAM::PDF
to ease the appending of Annotation objects to pdf documents.
EXPORT
This module does not export any functions.
METHODS
- CAM::PDF::Annot->new( 'file.pdf' );
-
Constructor method, same as
CAM::PDF
. - $doc->appendAnnotation($page, $doc, $annotRef, $refKeys) *NEW*
-
Duplicate an annotation object from another PDF document and add it to this document. It also copies its appearance object and Popup object. In case this is a Text Subtype Annot object (a Reply to another Annot object) it recurses to append the Annot object it refers to (using the IRT reference of the object).
It was only tested for annotations of /Type /Annot and /Subtype /Square, /Circle, /Polygon and /Text. It is hardcoded to not allow any other subtypes (sometime in the future this may change).
It takes a hash reference
$refKeys
and adds the altered keys so it can be used across calls and update references across objects (and avoid adding the same object more than once). - $doc->getAnnotations( $page )
-
Returns an array reference to the Annots array of the page. The array contains CAM::PDF::Nodes (see
CAM::PDF
) of type 'reference' refering to the annotations.
CAVEATS
This module was only tested for some subtypes of annotation objects and may not work consistently for untested subtypes.
SEE ALSO
CAM::PDF
AUTHOR
Donato Azevedo, <donatoaz _AT_ gmail.com>
Many thanks to Mr. Chris Dolan for developing CAM::PDF
.
COPYRIGHT AND LICENSE
Copyright (C) 2009 by Donato Azevedo
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.