CAM::PDF::Annot - Perl extension for appending annotations on PDFs


CAM-PDF-Annot documentation  | view source Contained in the CAM-PDF-Annot distribution.

Index


NAME

Top

CAM::PDF::Annot - Perl extension for appending annotations on PDFs

SYNOPSIS

Top

  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

Top

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

Top

This module was only tested for some subtypes of annotation objects and may not work consistently for untested subtypes.

SEE ALSO

Top

CAM::PDF

AUTHOR

Top

Donato Azevedo, <donatoaz _AT_ gmail.com>

Many thanks to Mr. Chris Dolan for developing CAM::PDF.

COPYRIGHT AND LICENSE

Top


CAM-PDF-Annot documentation  | view source Contained in the CAM-PDF-Annot distribution.