CAM::PDF::Annot - Perl extension for appending annotations on PDFs
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');
CAM::PDF::Annot is an extension to CAM::PDF to ease the appending of Annotation objects to pdf documents.
CAM::PDF
This module does not export any functions.
Constructor method, same as CAM::PDF.
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).
$refKeys
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.
This module was only tested for some subtypes of annotation objects and may not work consistently for untested subtypes.
Donato Azevedo, <donatoaz _AT_ gmail.com>
Many thanks to Mr. Chris Dolan for developing CAM::PDF.
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.
To install CAM::PDF::Annot, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CAM::PDF::Annot
CPAN shell
perl -MCPAN -e shell install CAM::PDF::Annot
For more information on module installation, please visit the detailed CPAN module installation guide.