summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/020_corefonts22
-rw-r--r--examples/020_textunderline2
-rw-r--r--examples/021_psfonts17
-rw-r--r--examples/021_synfonts16
-rw-r--r--examples/023_cjkfonts15
-rw-r--r--examples/050_pagelabels136
-rw-r--r--examples/055_outlines1
-rw-r--r--examples/060_transparency12
-rw-r--r--examples/BarCode.pl2
-rw-r--r--examples/Boxes.pl2
-rw-r--r--examples/Bspline.pl2
-rw-r--r--examples/Column.pl159
-rw-r--r--examples/Content.pl2
-rw-r--r--examples/ContentText.pl2
-rw-r--r--examples/FontManager.pl2
-rw-r--r--examples/HarfBuzz.pl2
-rw-r--r--examples/Rotated.pl2
-rw-r--r--examples/ShowFont.pl2
-rw-r--r--examples/Windows/Win32.pm2
19 files changed, 308 insertions, 92 deletions
diff --git a/examples/020_corefonts b/examples/020_corefonts
index bd99bfa..515e785 100644
--- a/examples/020_corefonts
+++ b/examples/020_corefonts
@@ -1,7 +1,7 @@
#!/usr/bin/perl
-# wants one or more font names on the command line. If none, use list of
-# core fonts.
+# wants one or more font names on the command line. If none given, use full
+# list of core fonts. If -s given as first arg, use the short list.
# CAUTION: the displayed Unicode value (U=xxxx) appears to be correct in most
# cases, except that the MS Smart Quotes (32 characters) are given as U=0080
@@ -21,8 +21,8 @@ use lib '../lib';
use PDF::Builder;
use PDF::Builder::Util;
-my $compress = 'none'; # uncompressed streams
-#my $compress = 'flate'; # compressed streams
+#my $compress = 'none'; # uncompressed streams
+my $compress = 'flate'; # compressed streams
my $sx = 33;
my $sy = 45;
@@ -70,6 +70,16 @@ my @fns=qw{
# bankgothicbolditalic
# bankgothicitalic
+my @ARGVcopy = @ARGV;
+# 'short' (-s flag)?
+if (@ARGVcopy > 0 && $ARGVcopy[0] eq '-s') {
+ @ARGVcopy = qw{
+ Courier-Bold
+ Times-Italic
+ Symbol
+ };
+}
+
# use only with single byte encodings, as multibyte (including UTF-8) don't
# appear to be compatible with these core fonts
# there may be a number of aliases available for each encoding.
@@ -111,8 +121,8 @@ my @ecs = qw{
my ($y, $pdf, $f1);
# override default list with command line entries
-if (scalar @ARGV) {
- @fns = @ARGV;
+if (scalar @ARGVcopy && $ARGVcopy[0] ne '-s') {
+ @fns = @ARGVcopy;
}
# loop through list of font names
diff --git a/examples/020_textunderline b/examples/020_textunderline
index 4ae916b..8e5e361 100644
--- a/examples/020_textunderline
+++ b/examples/020_textunderline
@@ -19,7 +19,7 @@ my $page = $pdf->page();
$page->mediabox(595,842);
my $text = $page->text();
-$text->textlabel(50,700, $f2, 20, 'Normal Text in Red', -color=>'red');
+$text->textlabel(50,700, $f2, 20, 'Normal Text in Red (no underline)', -color=>'red');
$text->textlabel(50,600, $f2, 20, 'Normal Text in Blue Underline in Red+Yellow',
-color=>'#0000CC',
-rotate=>-45,
diff --git a/examples/021_psfonts b/examples/021_psfonts
index 23feead..b9b21e1 100644
--- a/examples/021_psfonts
+++ b/examples/021_psfonts
@@ -1,8 +1,8 @@
#!/usr/bin/perl
# wants one or more font names on the command line. They must have a file
-# extension of .pfa or .pfb, and have an associated metrics file of the same
-# path and name, except with extension .afm or .pfm respectively.
+# extension of .pfa, .pfb, or .t1 and have an associated metrics file of the
+# same path and name, except with extension .afm or .pfm respectively.
# CAUTION: the displayed Unicode value (U+xxxx) appears to be correct in most
# cases, except that the MS Smart Quotes (32 characters) are given as U+0080
@@ -102,6 +102,7 @@ for ($i=0; $i<scalar @gns; $i++) {
$base =~ m#([^/\\]+)$#;
$base = $1;
$base =~ s#\.pf[ab]$##i;
+ $base =~ s#\.t1$##i;
# at least one page for each encoding
foreach my $ec (split / /, $ecs[$i]) {
@@ -228,7 +229,7 @@ for ($i=0; $i<scalar @gns; $i++) {
$txt->transform(-translate => [50, 800]);
$txt->fillcolor('black');
$txt->font($fnt, 18);
- $txt->lead(18*1.25);
+ $txt->leading(18*1.25);
my $toprint;
while ($textL ne '') {
($toprint, $textL) = $txt->_text_fill_line($textL, 500, 0);
@@ -268,7 +269,7 @@ flags_1 --
following glyph file names until a new -e.
glyph_file --
- a .pfa or .pfb extension T1 (PS) glyph file (with path)
+ a .pfa or .pfb or .t1 extension Type 1 (PS) glyph file (with path)
flags_2 --
-m metrics files paths
@@ -300,7 +301,7 @@ Going through glyph file names, the complete path, name, and extension
will search for the metrics file (.afm or .pfm) using each metrics
file path entry appended to the glyph file path, the base name of
the glyph file, and each extension .afm and .pfm are tried (in that
- order for a .pfa glyph file, and in the reverse order for a .pfb
+ order for a .pfa or .t1 glyph file, and in the reverse order for a .pfb
glyph file). Matching of extensions is case-insensitive, even on
Linux systems (e.g., times-roman.AFM is considered a match for
times-roman.pfb).
@@ -408,10 +409,10 @@ sub processCMD {
# split into path, basename, extension
($path, $basename, $extension) = splitPath($token);
- if ($extension =~ m/^pf[ab]$/i) {
+ if ($extension =~ m/^pf[ab]$/i || $extension =~ m/^t1$/i) {
# acceptable extension name
} else {
- print "expected glyph file extension .pfa or .pfb not found in glyph file '$token' (arg $tokenNumber)\n";
+ print "expected glyph file extension .pfa, .pfb, or .t1 not found in glyph file '$token' (arg $tokenNumber)\n";
return 1;
}
@@ -559,7 +560,7 @@ sub makeMPath {
# try each gPath + gName + afm or pfm
# .pfa tries .afm before .pfm, .pfb tries .pfm before .afm
- my @extList = qw/ .afm .pfm /;
+ my @extList = qw/ .afm .pfm /; # also use for .t1
if ($gExt =~ m#^pfb$#i) {
@extList = qw/ .pfm .afm /; # or reverse @extList
}
diff --git a/examples/021_synfonts b/examples/021_synfonts
index 2d108a5..0fa9b0f 100644
--- a/examples/021_synfonts
+++ b/examples/021_synfonts
@@ -1,5 +1,8 @@
#!/usr/bin/perl
+# command line defaults to 0 (full list of core fonts). 1 or -s is for a
+# short list, 2 is a single TTF, and 3 is a single Type 1
+
use strict;
use warnings;
@@ -8,7 +11,7 @@ use PDF::Builder;
use PDF::Builder::Util;
my $type = 0; # 0 = full list of core fonts
- # 1 = single core font (for testing)
+ # 1 or -s = single core font (for testing)
# 2 = TTF font(s)
# 3 = Type1 (PS) font(s)
my $encoding = 'latin1'; # normally latin1
@@ -16,7 +19,9 @@ my $encoding = 'latin1'; # normally latin1
# for testing, command line number is type
if (scalar @ARGV > 0) {
- if ($ARGV[0] > -1 && $ARGV[0] < 4) {
+ if ($ARGV[0] eq '-s') {
+ $type = 1; # -s is alias for 1
+ } elsif ($ARGV[0] > -1 && $ARGV[0] < 4) {
# command line type 0 1 2 or 3
$type = $ARGV[0];
}
@@ -37,8 +42,8 @@ push @varLabels, 'bold 4';
push @variants, {-caps=>1};
push @varLabels, 'caps 1';
-my $compress = 'none'; # no stream compression
-#my $compress = 'flate'; # compress streams
+#my $compress = 'none'; # no stream compression
+my $compress = 'flate'; # compress streams
my $sx = 33;
my $sy = 45;
@@ -47,6 +52,7 @@ my $fx = 20;
my ($ci, $y, $k);
my (@font_list, @short_name, @T1_metrics);
+
# core
if ($type == 0) {
@font_list = qw(
@@ -82,7 +88,7 @@ if ($type == 0) {
);
}
if ($type == 1) {
- @font_list = qw( Times-Roman );
+ @font_list = qw( Courier-Oblique );
}
# note that for TTF and Type1, spaces in names (Windows) replaced by ~
diff --git a/examples/023_cjkfonts b/examples/023_cjkfonts
index 3545107..0fd78f7 100644
--- a/examples/023_cjkfonts
+++ b/examples/023_cjkfonts
@@ -1,5 +1,8 @@
#!/usr/bin/perl -w
+# wants one or more font names on the command line. If none given, use full
+# list of CJK fonts. If -s given as first arg, use the short list.
+
use strict;
use warnings;
@@ -31,6 +34,18 @@ my @fontnames = qw[
KozGo KozGo-Bold KozGo-Italic KozGo-BoldItalic
];
+# 'short' (-s flag)?
+if (@ARGV > 0 && $ARGV[0] eq '-s') {
+ @fontnames = qw[
+ KozGo Ming-Bold
+ ];
+}
+
+# override default list with command line entries
+if (scalar @ARGV && $ARGV[0] ne '-s') {
+ @fontnames = @ARGV;
+}
+
foreach my $fn (@fontnames) {
#if ($fn eq 'Ming-Bold') { last; } # for testing
diff --git a/examples/050_pagelabels b/examples/050_pagelabels
index 4795d7c..58f8b46 100644
--- a/examples/050_pagelabels
+++ b/examples/050_pagelabels
@@ -10,7 +10,9 @@ use PDF::Builder::Util;
#my $compress = 'none'; # uncompressed streams
my $compress = 'flate'; # compressed streams
+my $section_length = 32; # examples per old and new methods
my @labels = (
+# new method page_labels()
'upper case Roman numeral I',
'upper case Roman numeral II',
'upper case Roman numeral III',
@@ -31,12 +33,57 @@ my @labels = (
'prefixed B-2',
'prefixed C-1',
'prefixed C-2',
+ 'decimal (Arabic) number 11',
+ 'decimal (Arabic) number 12',
+ 'upper case letter A',
+ 'upper case letter B',
+ 'lower case Roman numeral i',
+ 'lower case Roman numeral ii',
+ 'no counter (blank)',
+ 'no counter (blank)',
+ 'prefix, no counter Z',
+ 'prefix, no counter Z',
+ 'prefix, uc Roman Index I',
+ 'prefix, uc Roman Index II',
+
+# old method pageLabel()
+ 'upper case Roman numeral I',
+ 'upper case Roman numeral II',
+ 'upper case Roman numeral III',
+ 'upper case Roman numeral IV',
+ 'decimal (Arabic) number 1',
+ 'decimal (Arabic) number 2',
+ 'decimal (Arabic) number 3',
+ 'decimal (Arabic) number 4',
+ 'decimal (Arabic) number 5',
+ 'decimal (Arabic) number 6',
+ 'decimal (Arabic) number 7',
+ 'decimal (Arabic) number 8',
+ 'decimal (Arabic) number 9',
'decimal (Arabic) number 10',
+ 'prefixed A-1',
+ 'prefixed A-2',
+ 'prefixed B-1',
+ 'prefixed B-2',
+ 'prefixed C-1',
+ 'prefixed C-2',
'decimal (Arabic) number 11',
+ 'decimal (Arabic) number 12',
'upper case letter A',
'upper case letter B',
'lower case Roman numeral i',
'lower case Roman numeral ii',
+ 'no counter (blank)',
+ 'no counter (blank)',
+ 'prefix, no counter Z',
+ 'prefix, no counter Z',
+ 'prefix, uc Roman Index I',
+ 'prefix, uc Roman Index II',
+# extra: these two styles (4 pages) combined one call, pageLabel only
+ 'lower case letter c',
+ 'lower case letter d',
+ 'lc Roman and prefixed App-iv',
+ 'lc Roman and prefixed App-v',
);
my $pdf = PDF::Builder->new(-compress => $compress);
@@ -44,42 +91,93 @@ my $pdf = PDF::Builder->new(-compress => $compress);
my $f1=$pdf->corefont('Helvetica', -encode=>'latin1'); # unused?
my $f2=$pdf->corefont('Helvetica-Bold', -encode=>'latin1'); # "Page Index=" text
-# initial pass, create 26 pages labeled "Page Index=n" for n=0-25
-foreach my $i (0 .. 25) {
+# initial pass, create 2 x $section_length-1 pages labeled
+# "Page Index=n" for n=0-$section_length
+# extra pages for pageLabel combined -1 -> +3
+foreach my $i (0 .. 2*$section_length+3) {
my $page = $pdf->page();
$page->mediabox(595,842);
my $text=$page->text();
- $text->textlabel(40,700, $f2, 20, 'Page Index='.$i.',');
+ $text->textlabel(40,700, $f2, 20, 'Page Index='.$i.', Physical Page='.($i+1));
$text->textlabel(40,670, $f2, 20, 'thumbnail label should be '.$labels[$i]);
}
# modify page numbering /Catalog /PageLabels entries
# note that each style change resets page to 1
# this number NOT on printed page... only in reader thumbnail
+# and possibly the reader's display page
+
+# ---------- NEW method using page_labels()
+# pages 1..4 should be Upper Case Roman (I..IV)
+$pdf->page_labels(1, -style => 'Roman' ); # << /S /R >> default St 1
+
+# pages 5..14 s/b decimal, restart at 1 (1..10)
+$pdf->page_labels(5, -start => 1 ); # << /S /D /St 1 >>
+
+# pages 15..16 s/b A-decimal, restart at 1 (A-1, A-2)
+$pdf->page_labels(15, -start => 1, -prefix => 'A-' ); # << /P (A-) /S /D /St 1 >>
+# pages 17..18 s/b B-1, B-2
+$pdf->page_labels(17, -start => 1, -prefix => 'B-' ); # << /P (B-) /S /D /St 1 >>
+# pages 19..20 s/b C-1, C-2
+$pdf->page_labels(19, -start => 1, -prefix => 'C-' ); # << /P (C-) /S /D /St 1 >>
+
+# pages 21..22 s/b decimal, restart at 11 (11..12)
+$pdf->page_labels(21, -start => 11 ); # << /S /D /St 11 >>
+
+# pages 23..24 s/b Alpha, auto-restarts at 1 (A, B)
+$pdf->page_labels(23, -style => 'Alpha' ); # << /S /A >>
+
+# pages 25..26 s/b lowercase roman, auto-restarts at 1 (i, ii)
+$pdf->page_labels(25, -style => 'roman' ); # << /S /r >>
+
+# pages 27..28 s/b blank (nocounter)
+$pdf->page_labels(27, -style => 'nocounter' );
+
+# pages 29..30 s/b blank (nocounter) with Z prefix
+$pdf->page_labels(29, -style => 'nocounter', -prefix => 'Z' );
+
+# pages 31..32 s/b prefix Index plus UC Roman
+$pdf->page_labels(31, style => 'Roman', prefix => 'Index ' );
+
+# ---------- OLD method using pageLabel()
+# pages $section_length+0..3 should be Upper Case Roman (I..IV)
+$pdf->pageLabel($section_length+0, { -style => 'Roman' }); # << /S /R >> default St 1
+
+# pages $section_length+4..13 s/b decimal, restart at 1 (1..10)
+$pdf->pageLabel($section_length+4, { -start => 1 }); # << /S /D /St 1 >>
+
+# pages $section_length+14..15 s/b A-decimal, restart at 1 (A-1, A-2)
+$pdf->pageLabel($section_length+14, { -start => 1, -prefix => 'A-' }); # << /P (A-) /S /D /St 1 >>
+# pages $section_length+16..17 s/b B-1, B-2
+$pdf->pageLabel($section_length+16, { -start => 1, -prefix => 'B-' }); # << /P (B-) /S /D /St 1 >>
+# pages $section_length+18..19 s/b C-1, C-2
+$pdf->pageLabel($section_length+18, { -start => 1, -prefix => 'C-' }); # << /P (C-) /S /D /St 1 >>
+
+# pages $section_length+20..21 s/b decimal, restart at 11 (10..11)
+$pdf->pageLabel($section_length+20, { -start => 11 }); # << /S /D /St 11 >>
-# pages 0..3 should be Upper Case Roman (I..IV)
-$pdf->pageLabel(0, { -style => 'Roman' }); # 0 << /S /R >> default St 1
+# pages $section_length+22..23 s/b Alpha, auto-restarts at 1 (A, B)
+$pdf->pageLabel($section_length+22, { -style => 'Alpha' }); # << /S /A >>
-# pages 4..13 s/b decimal, restart at 1 (1..10)
-$pdf->pageLabel(4, { -start => 1 }); # 4 << /S /D /St 1 >>
+# pages $section_length+24..25 s/b lowercase roman, auto-restarts at 1 (i, ii)
+$pdf->pageLabel($section_length+24, { -style => 'roman' }); # << /S /r >>
-# pages 14..15 s/b A-decimal, restart at 1 (A-1, A-2)
-$pdf->pageLabel(14, { -start => 1, -prefix => 'A-' }); # 14 << /P (A-) /S /D /St 1 >>
-# pages 16..17 s/b B-1, B-2
-$pdf->pageLabel(16, { -start => 1, -prefix => 'B-' }); # 16 << /P (B-) /S /D /St 1 >>
-# pages 18..19 s/b C-1, C-2
-$pdf->pageLabel(18, { -start => 1, -prefix => 'C-' }); # 18 << /P (C-) /S /D /St 1 >>
+# pages $section_length+26..27 s/b blank (nocounter)
+$pdf->pageLabel($section_length+26, { -style => 'nocounter' });
-# pages 20..21 s/b decimal, restart at 10 (10..11)
-$pdf->pageLabel(20, { -start => 10 }); # 20 << /S /D /St 10 >>
+# pages $section_length+28..29 s/b blank (nocounter) with Z prefix
+$pdf->pageLabel($section_length+28, { -style => 'nocounter', -prefix => 'Z' });
-# pages 22..23 s/b Alpha, auto-restarts at 1 (A, B)
-$pdf->pageLabel(22, { -style => 'Alpha' }); # 22 << /S /A >>
+# pages $section_length+30..31 s/b prefix Index plus UC Roman
+$pdf->pageLabel($section_length+30, { 'style' => 'Roman', 'prefix' => 'Index ' });
-# pages 24..25 s/b lowercase roman, auto-restarts at 1 (i, ii)
-$pdf->pageLabel(24, { -style => 'roman' }); # 24 << /S /r >>
+# -------------
+# combine two calls into one for pageLabel only!
+$pdf->pageLabel($section_length+32, { style => 'alpha', start => 3 },
+ $section_length+34, { style => 'roman', start => 4, prefix => 'App-' });
+# -------------
$pdf->saveas("$0.pdf");
$pdf->end();
diff --git a/examples/055_outlines b/examples/055_outlines
index f3eb9d9..99efae3 100644
--- a/examples/055_outlines
+++ b/examples/055_outlines
@@ -10,6 +10,7 @@ my $infile = 'examples/resources/sample_55.pdf';
my $outfile = 'examples/055_outlines.sample_55.pdf';
my $doc = PDF::Builder-> open($infile);
+print "Use 'outline' or 'bookmark' feature on your PDF Reader to move around\n";
$doc-> outlines
-> outline
diff --git a/examples/060_transparency b/examples/060_transparency
index fe01248..ed92fc1 100644
--- a/examples/060_transparency
+++ b/examples/060_transparency
@@ -28,32 +28,28 @@ my $text = $page->text();
# both texts bleed off right side of page
$text->textlabel(30,750, $fnt,100, '100% Opaque', -color=>'#F00');
-#$text->save();
$text->egstate($TRANSPARENT);
$text->textlabel(30,720, $fnt,100, '40% Transparent', -color=>'#000');
-#$text->restore();
# page 2: similar to page 1, but using different methods. bleed off left side.
$page = $pdf->page();
$text = $page->text();
-#$text->save();
$text->font($fnt, 100);
$text->fillcolor('red');
$text->translate(570,750);
$text->text_right('Opaque 100%');
-#$text->restore();
-$text->textend();
+$text->textend(); # back into graphics state so can do transparency
-$text->save();
+#$text->save(); # unnecessary, as this is the last segment
$text->egstate($TRANSPARENT);
-$text->textstart();
+$text->textstart(); # back into text mode
$text->font($fnt, 100);
$text->fillcolor('black');
$text->translate(570,720);
$text->text_right('Transparent 40%');
$text->textend();
-$text->restore();
+#$text->restore();
$pdf->saveas("$0.pdf");
$pdf->end();
diff --git a/examples/BarCode.pl b/examples/BarCode.pl
index 5c1707e..c82f088 100644
--- a/examples/BarCode.pl
+++ b/examples/BarCode.pl
@@ -9,7 +9,7 @@
use warnings;
use strict;
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.023'; # manually update whenever code is changed
use Math::Trig;
diff --git a/examples/Boxes.pl b/examples/Boxes.pl
index 89eeb14..3841168 100644
--- a/examples/Boxes.pl
+++ b/examples/Boxes.pl
@@ -21,7 +21,7 @@ my $trimbox_adj = 1/mm; # in from bleed box
my $bleedbox_adj = 36/pt; # in from crop box on top and right for printer inst.
my $cropbox_adj = 0.25/in; # in from media edge
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.023'; # manually update whenever code is changed
my $PDFname = $0;
diff --git a/examples/Bspline.pl b/examples/Bspline.pl
index c1f3c4e..e530961 100644
--- a/examples/Bspline.pl
+++ b/examples/Bspline.pl
@@ -33,7 +33,7 @@
use warnings;
use strict;
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Math::Trig;
diff --git a/examples/Column.pl b/examples/Column.pl
index c85c1c0..36ee777 100644
--- a/examples/Column.pl
+++ b/examples/Column.pl
@@ -6,8 +6,8 @@ use PDF::Builder;
#use Data::Dumper; # for debugging
# $Data::Dumper::Sortkeys = 1; # hash keys in sorted order
-our $VERSION = '3.025'; # VERSION
-our $LAST_UPDATE = '3.025'; # manually update whenever code is changed
+our $VERSION = '3.026'; # VERSION
+our $LAST_UPDATE = '3.026'; # manually update whenever code is changed
my $use_Table = 1; # if 1, use PDF::Table for table example
# TBD automatically check if PDF::Table available, and if so, use it
@@ -288,41 +288,41 @@ if ($use_Table) {
my $table = PDF::Table->new();
my $table_data = [
# row 1, solid color lines
- [
- [ 'html', '<font color="red">This is some red text</font>',
- { 'font_size' => 12, 'para' => [ 0, 0 ] } ],
+ [
+ [ 'html', '<font color="red">This is some red text</font>',
+ { 'font_size' => 12, 'para' => [ 0, 0 ] } ],
[ 'html', "<span style=\"color:green\">This is some green text</span>",
- { 'font_size' => 12, 'para' => [ 0, 0 ] } ],
- ],
+ { 'font_size' => 12, 'para' => [ 0, 0 ] } ],
+ ],
# row 2, special symbols, colored
[
- [ 'html', 'This is a red cross: <font face="ZapfDingbats" color="red">8</font>.',
- { 'font_size' => 12, 'para' => [ 0, 0 ] } ],
- [ 'html', "This is a green tick: <span style=\"font-family:ZapfDingbats; color:green\">4</span>.",
+ [ 'html', 'This is a red cross: <font face="ZapfDingbats" color="red">8</font>.',
+ { 'font_size' => 12, 'para' => [ 0, 0 ] } ],
+ [ 'html', "This is a green tick: <span style=\"font-family:ZapfDingbats; color:green\">4</span>.",
{ 'font_size' => 12, 'para' => [ 0, 0 ] } ],
],
# row 3, like row 2, but using macro substitutions
[
- [ 'html', "This is a red cross substitute: %cross%.",
- { 'font_size'=>12, 'para'=>[ 0, 0 ],
- 'substitute'=>[
- ['%cross%','<font face="ZapfDingbats" color="red">', '8', '</font>'],
- ['%tick%','<span style="font-family: ZapfDingbats; color: green;">', '4', '</span>'] ]
- }
+ [ 'html', "This is a red cross substitute: %cross%.",
+ { 'font_size'=>12, 'para'=>[ 0, 0 ],
+ 'substitute'=>[
+ ['%cross%','<font face="ZapfDingbats" color="red">', '8', '</font>'],
+ ['%tick%','<span style="font-family: ZapfDingbats; color: green;">', '4', '</span>'] ]
+ }
],
- [ 'html', "This is a green tick substitute: %tick%.",
- { 'font_size'=>12, 'para'=>[ 0, 0 ],
- 'substitute'=>[
- ['%cross%','<font face="ZapfDingbats" color="red">', '8', '</font>'],
- ['%tick%','<span style="font-family: ZapfDingbats; color: green;">', '4', '</span>'] ]
+ [ 'html', "This is a green tick substitute: %tick%.",
+ { 'font_size'=>12, 'para'=>[ 0, 0 ],
+ 'substitute'=>[
+ ['%cross%','<font face="ZapfDingbats" color="red">', '8', '</font>'],
+ ['%tick%','<span style="font-family: ZapfDingbats; color: green;">', '4', '</span>'] ]
}
],
- ],
+ ],
# row 4, non-markup text
- [ 'Plain old text',
+ [ 'Plain old text',
'More plain text'
],
];
@@ -447,6 +447,23 @@ $content = <<"END_OF_CONTENT";
A Perl library to facilitate the creation and modification of PDF files
+## What is it?
+
+PDF::Builder is a **fork** of the popular PDF::API2 Perl library. It provides a
+library of modules and functions so that a PDF file (document) may be built and
+maintained from Perl programs. It is not a WYSIWYG editor; nor is it a canned
+utility or converter. It does _not_ have a GUI -- it is driven by your Perl
+program. It is a set of **building blocks** with which you can perform a wide
+variety of operations, ranging from basic operations such as selecting a font
+face, to defining an entire page at a time in the document, using a large
+subset of either Markdown or HTML markup languages. You can call it from
+arbitrary Perl programs, which may even create content on-the-fly (or read it
+in from other sources). Quite a few code examples are provided, to help you to
+get started with the process of creating a PDF document. Many enhancements are
+in the pipeline to make PDF::Builder even more powerful and versatile.
+
+[Home Page](https://www.catskilltech.com/FreeSW/product/PDF%2DBuilder/title/PDF%3A%3ABuilder/freeSW_full), including Documentation and Examples.
+
[![Open Issues](https://img.shields.io/github/issues/PhilterPaper/Perl-PDF-Builder)](https://github.com/PhilterPaper/Perl-PDF-Builder/issues)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/PhilterPaper/Perl-PDF-Builder/graphs/commit-activity)
@@ -478,7 +495,7 @@ By default, none are installed.
### Perl
-**Perl 5.24** or higher. It will likely run on somewhat earlier versions, but
+**Perl 5.26** or higher. It will likely run on somewhat earlier versions, but
the CPAN installer may refuse to install it. The reason this version was
chosen was so that LTS (Long Term Support) versions of Perl going back about
6 years are officially supported (by PDF::Builder), and older versions are not
@@ -487,14 +504,14 @@ are an artifact of old Perl releases.
#### Older Perls
-If you MUST install on an older (pre 5.24) Perl, you can try the following for
+If you MUST install on an older (pre 5.26) Perl, you can try the following for
Strawberry Perl (Windows). NO PROMISES! Something similar MAY work for other
OS's and Perl installations:
1. Unpack installation file (`.tar.gz`, via a utility such as 7-Zip) into a directory, and cd to that directory
-1. Edit META.json and change 5.024000 to 5.016000 or whatever level desired
-1. Edit META.yml and change 5.024000 to 5.016000 or whatever level desired
-1. Edit Makefile.PL and change `use 5.024000;` to `use 5.016000;`, change `\$PERL_version` from `5.024000` to `5.016000`
+1. Edit META.json and change 5.026000 to 5.016000 or whatever level desired
+1. Edit META.yml and change 5.026000 to 5.016000 or whatever level desired
+1. Edit Makefile.PL and change `use 5.026000;` to `use 5.016000;`, change `\$PERL_version` from `5.026000` to `5.016000`
1. `cpan .`
Note that some Perl installers MAY have a means to override or suppress the
@@ -529,11 +546,13 @@ matters, especially if an optional package fails to install. You can always
manually install them later, if you desire to make use of their added
functionality.
+* Perl::Critic (1.150 or higher, need if running tools/1\_pc.pl)
* Graphics::TIFF (19 or higher, recommended if using TIFF image functions)
* Image::PNG::Libpng (0.57 or higher, recommended for enhanced PNG image function processing)
* HarfBuzz::Shaper (0.024 or higher, needed for Latin script ligatures and kerning, as well as for any complex script such as Arabic, Indic scripts, or Khmer)
* Text::Markdown (1.000031 or higher, needed if using 'md1' markup)
* HTML::TreeBuilder (5.07 or higher, needed if using 'html' or 'md1' markup)
+* Pod::Simple::XHTML (3.45 or higher, needed if using buildDoc utility to create HTML documentation)
If an optional package is needed, but not installed, sometimes PDF::Builder
will be able to fall back to built-in partial functionality (TIFF and PNG
@@ -564,7 +583,8 @@ have it under a different name, such as dmake (Strawberry Perl on Windows),
gmake, or nmake.
PDF::Builder does not currently compile and link anything, so gcc, g++, etc.
-will not be used. The build process merely copies .pm files around.
+will not be used. The build process merely copies .pm files around, and
+runs the "t" tests to confirm the proper installation.
## Copyright
@@ -590,11 +610,24 @@ redistribute and/or modify this software (those portions under LGPL) at an
LGPL version greater than 2.1. See INFO/LICENSE for more information on the
licenses and warranty statement.
+### Carrying On...
+
+PDF::Builder is Open Source software, built upon the efforts not only of the
+current maintainer, but also of many people before me. Therefore, it's perfectly
+fair to make use of the algorithms and even code (within the terms of the
+LICENSE). That's exactly how the State of the
+Art progresses! Just please be considerate and acknowledge the work of others
+that you are building on, as well as pointing back to this package. Drop us a
+note with news of your project (if based on the code and algorithms in
+PDF::Builder, or even just heavily inspired by it) and we'll be happy to make
+a pointer to your work. The more cross-pollination, the better!
+
## See Also
-* INFO/RoadMap file for the PDF::Builder road map
* CONTRIBUTING file for how to contribute to the project
* LICENSE file for more on the license term
+* INFO/RoadMap file for the PDF::Builder road map
+* INFO/ACKNOWLEDGE.md for "thank yous" to those who contributed to this product
* INFO/SUPPORT file for information on reporting bugs, etc. via GitHub Issues
* INFO/DEPRECATED file for information on deprecated features
* INFO/KNOWN\_INCOMP file for known incompatibilities with PDF::API2
@@ -611,6 +644,10 @@ and go to the `docs/` directory. Run `buildDoc.pl --all` to generate the full
tree of documentation. There's a lot of additional information in the
PDF::Builder::Docs module (it's all documentation).
+You may find it more convenient to point your browser to our
+[Home Page](https://www.catskilltech.com/FreeSW/product/PDF-Builder/title/PDF%3A%3ABuilder/freeSW_full)
+to see the full documentation build (as well as most of the example outputs).
+
We admit that the documentation is a bit light on "how to" task orientation.
We hope to more fully address this in the future, but for now, get the full
installation and look at the `examples/` and `contrib/` directories for sample
@@ -774,8 +811,53 @@ if ($rc) {
print STDERR "list example overflowed column!\n";
}
-# block quotes and font extent changes
+# Counting down (reversed) ordered lists
print "======================================================= pg 11\n";
+print "---- Count down list examples\n";
+$page = $pdf->page();
+$text = $page->text();
+$grfx = $page->gfx();
+
+$content = <<"END_OF_CONTENT";
+<h2>Test reversed ordered lists</h2>
+<ol reversed="1" start="10">
+ <li>ten</li>
+ <li>nine</li>
+ <li>eight</li>
+ <li>seven</li>
+ <li>six</li>
+ <li>five
+ <ol>
+ <li>holding</li>
+ <li>resume countdown</li>
+ </ol></li>
+ <li>four</li>
+ <li>three</li>
+ <li>two</li>
+ <li>one</li>
+</ol>
+<h2>Reversed ordered list run past 1</h2>
+<ol reversed="1" start="3">
+ <li>three</li>
+ <li>two</li>
+ <li>one</li>
+ <li>zero... blast off!</li>
+ <li>minus one... the clock is running</li>
+</ol>
+END_OF_CONTENT
+
+restore_props($text, $grfx);
+($rc, $next_y, $unused) =
+ $text->column($page, $text, $grfx, 'html', $content,
+ 'rect'=>[50,750, 500,450], 'outline'=>$magenta,
+ 'para'=>[ 0, 0 ] );
+if ($rc) {
+ print STDERR "list example overflowed column!\n";
+}
+
+
+# block quotes and font extent changes
+print "======================================================= pg 12\n";
print "---- Block quotes\n";
$page = $pdf->page();
$text = $page->text();
@@ -841,7 +923,7 @@ if ($rc) {
}
# setting your own CSS for Markdown or none
-print "======================================================= pg 12\n";
+print "======================================================= pg 13\n";
$page = $pdf->page();
$text = $page->text();
$grfx = $page->gfx();
@@ -965,11 +1047,18 @@ if ($rc) {
# might have to go to a column2.pl!
# demonstrate balanced columns two long columns and one short, first pass
-# fill blindly, then by trial-and-error shorten long columns until short
-# one just fills (show initial and final runs)
+# fill blindly, overflowing to column 2 then 3, then by trial-and-error
+# shorten long two columns until short one just fills (show initial and
+# final runs). graphic X-out block for ad.
+# headline in English Towne Medium (.otf) "New Yawk Times" ("All the news
+# that fits, we print!"). Headline under it (across 3 columns): "Congress
+# Does Something Stoopid". Lorem Ipsum for body text.
+# continuation to page __ method? text to output for very last line in col.
# demonstrate column shapes that split line in two (only first part used)
# demonstrate irregularly shaped columns, including a bowtie scaled 3 times
-# demonstrate two column layout with insets and marginpar
+# demonstrate two column layout with insets and marginpar (inset routine to
+# place text w/ hr's, return cutout outline for columns outline creation,
+# intersect with rectangles for columns)
# demonstrate a circular column, etc.
# demonstrate a spline column cutout, with image in background with edges
# that fade away so text can overlap outer fringes of image
diff --git a/examples/Content.pl b/examples/Content.pl
index da32d1d..9b70b04 100644
--- a/examples/Content.pl
+++ b/examples/Content.pl
@@ -6,7 +6,7 @@
use warnings;
use strict;
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.023'; # manually update whenever code is changed
use Math::Trig;
diff --git a/examples/ContentText.pl b/examples/ContentText.pl
index dfa9ff3..9af7192 100644
--- a/examples/ContentText.pl
+++ b/examples/ContentText.pl
@@ -6,7 +6,7 @@
use warnings;
use strict;
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.023'; # manually update whenever code is changed
use Math::Trig;
diff --git a/examples/FontManager.pl b/examples/FontManager.pl
index 7ccdbf8..bb39d8c 100644
--- a/examples/FontManager.pl
+++ b/examples/FontManager.pl
@@ -7,7 +7,7 @@
use strict;
use warnings;
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.024_002'; # manually update whenever code is changed
use PDF::Builder;
diff --git a/examples/HarfBuzz.pl b/examples/HarfBuzz.pl
index 7a051dd..3cd9183 100644
--- a/examples/HarfBuzz.pl
+++ b/examples/HarfBuzz.pl
@@ -6,7 +6,7 @@
use strict;
use warnings;
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.021'; # manually update whenever code is changed
my $PDFname = $0;
diff --git a/examples/Rotated.pl b/examples/Rotated.pl
index c225966..7785e36 100644
--- a/examples/Rotated.pl
+++ b/examples/Rotated.pl
@@ -7,7 +7,7 @@
use warnings;
use strict;
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.023'; # manually update whenever code is changed
use PDF::Builder;
diff --git a/examples/ShowFont.pl b/examples/ShowFont.pl
index 9ff58a9..a663512 100644
--- a/examples/ShowFont.pl
+++ b/examples/ShowFont.pl
@@ -7,7 +7,7 @@
use strict;
use warnings;
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder;
diff --git a/examples/Windows/Win32.pm b/examples/Windows/Win32.pm
index b75560a..3a78125 100644
--- a/examples/Windows/Win32.pm
+++ b/examples/Windows/Win32.pm
@@ -4,7 +4,7 @@ use strict;
use warnings;
#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.025'; # VERSION
+our $VERSION = '3.026'; # VERSION
our $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Win32::TieRegistry qw( :KEY_ ); # creates $Registry, et al.