otrcomm commented
Phil,
Thank you for yout prompt response. Ok, I am trying to embed a url in a pdf document. So in the code to generate the document I have added:
use PDF::Builder;
use PDF::Builder::Util;
use PDF::Builder::Annotation;
...
my $pdf = PDF::Builder->new(-compress => $compress);
my $annotation = PDF::Builder::Annotation->new();
...
my $page = $pdf->page();
$page->mediabox(595,842);
...
my $text = $page->text();
...
So how would I add a url below the text block to this page with annotation? I am not really new to perl, but I am new to deciphering modules like
PDF::Builder and how to apply them without examples as guides.
Thank you for your help,
Murrah Boswell
PhilterPaper commented
From the Annotation documentation:
$annotation->url($url, %options)
Defines the annotation as a launch-url with url $url and options %options (-rect, -border, -color: see descriptions below). This page is usually brought up in a browser, and may be remote.
and (either in the url() call or separately defined)
$annotation->rect($llx,$lly, $urx,$ury)
Sets the rectangle (active click area) of the annotation, given by -rect option. This is any pair of diagonally opposite corners of the rectangle.
The default clickable area is the icon itself.
Defining option. Note that this "option" is actually required.
-rect => [LLx, LLy, URx, URy]
Set annotation rectangle at [LLx,LLy] to [URx,URy] (lower left and upper right coordinates). LL to UR is customary, but any diagonal is allowed.
$annotation->border(@b)
Sets the border-style of the annotation, if applicable, as given by the -border option. There are three entries in the array: horizontal and vertical corner radii, and border width.
A border is used in annotations where text or some other material is put down, and a clickable rectangle is defined over it (-rect). A border is not used when an icon is being used to mark the clickable area.
The default is [0 0 1] (solid line of width 1, with sharp corners).
Defining option:
-border => [CRh, CRv, W]
-border => [CRh, CRv, W [, on, off...]]
Set annotation border style of horizontal and vertical corner radii CRh and CRv (value 0 for squared corners) and width W (value 0 for no border). The default is squared corners and a solid line of width 1 ([0 0 1]). Optionally, a dash pattern array may be given (on length, off length, as one or more pairs). The default is a solid line.
The border vector seems to ignore the first two settings (corner radii), but the line thickness works, on basic Readers. The radii may work on some other Readers.
$annotation->Color(@color)
Set the icon's fill color. The color is an array of 1, 3, or 4 numbers, each in the range 0.0 to 1.0. If 1 number is given, it is the grayscale value (0 = black to 1 = white). If 3 numbers are given, it is an RGB color value. If 4 numbers are given, it is a CMYK color value. Currently, named colors (strings) are not handled.
For link and url annotations, this is the color of the rectangle border (-border given with a width of at least 1).
If an invalid array length or numeric value is given, a medium gray ( [0.5] ) value is used, without any message. If no color is given, the usual fill color is black.
Defining option:
-color => [ ] or not 1, 3, or 4 numbers 0.0-1.0
A medium gray (0.5 value) will be used if an invalid color is given.
-color => [ g ]
If g is between 0.0 (black) and 1.0 (white), the fill color will be gray.
-color => [ r, g, b ]
If r (red), g (green), and b (blue) are all between 0.0 and 1.0, the fill color will be the defined RGB hue. [ 0, 0, 0 ] is black, [ 1, 1, 0 ] is yellow, and [ 1, 1, 1 ] is white.
-color => [ c, m, y, k ]
If c (red), m (magenta), y (yellow), and k (black) are all between 0.0 and 1.0, the fill color will be the defined CMYK hue. [ 0, 0, 0, 0 ] is white, [ 1, 0, 1, 0 ] is green, and [ 1, 1, 1, 1 ] is black.
I know that the documentation is a bit light on "how to" or "cookbook" examples. I'll mull over whether I can add a new example for annotations. Do you have just the bare installation, or do you have the complete installation with examples and contributions, as well as a tool for generating all the documentation?