summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgregor herrmann <gregoa@debian.org>2020-12-28 21:22:57 +0100
committergregor herrmann <gregoa@debian.org>2020-12-28 21:22:57 +0100
commit9d562f0ce0fbc8d6c7cf3ef624aa5054a8e9ad74 (patch)
treed06fbfd742801cae59491319f1ca9c752105e198
parent307e8d3af7b1edc7182a9679fc65f96e3dcc6333 (diff)
New upstream version 3.021
-rw-r--r--CONTRIBUTING17
-rw-r--r--Changes59
-rw-r--r--INFO/Changes-ver_221
-rw-r--r--INFO/SUPPORT27
-rw-r--r--INFO/old/dist.ini.old4
-rw-r--r--MANIFEST2
-rw-r--r--META.json9
-rw-r--r--META.yml8
-rw-r--r--Makefile.PL17
-rw-r--r--README113
-rw-r--r--README.md130
-rw-r--r--contrib/combine_pdfs.pl2
-rw-r--r--contrib/pdf-debug.pl2
-rw-r--r--contrib/pdf-deoptimize.pl2
-rw-r--r--contrib/pdf-optimize.pl2
-rw-r--r--contrib/text2pdf.pl7
-rw-r--r--docs/buildDoc.pl6
-rw-r--r--examples/021_synfonts3
-rw-r--r--examples/023_cjkfonts12
-rw-r--r--examples/025_unifonts7
-rw-r--r--examples/BarCode.pl10
-rw-r--r--examples/Boxes.pl2
-rw-r--r--examples/Bspline.pl8
-rw-r--r--examples/Content.pl12
-rw-r--r--examples/ContentText.pl16
-rw-r--r--examples/HarfBuzz.pl6
-rw-r--r--examples/Rotated.pl2
-rw-r--r--examples/Windows/Win32.pm7
-rw-r--r--lib/PDF/Builder.pm48
-rw-r--r--lib/PDF/Builder/Annotation.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Array.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Bool.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Dict.pm7
-rw-r--r--lib/PDF/Builder/Basic/PDF/File.pm20
-rw-r--r--lib/PDF/Builder/Basic/PDF/Filter.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Filter/ASCII85Decode.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Filter/ASCIIHexDecode.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Filter/FlateDecode.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm7
-rw-r--r--lib/PDF/Builder/Basic/PDF/Filter/RunLengthDecode.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Literal.pm7
-rw-r--r--lib/PDF/Builder/Basic/PDF/Name.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Null.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Number.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Objind.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Page.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Pages.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/String.pm2
-rw-r--r--lib/PDF/Builder/Basic/PDF/Utils.pm2
-rw-r--r--lib/PDF/Builder/Content.pm7
-rw-r--r--lib/PDF/Builder/Content/Hyphenate_basic.pm6
-rw-r--r--lib/PDF/Builder/Content/Text.pm2
-rw-r--r--lib/PDF/Builder/Docs.pm2
-rw-r--r--lib/PDF/Builder/Lite.pm9
-rw-r--r--lib/PDF/Builder/Matrix.pm2
-rw-r--r--lib/PDF/Builder/NamedDestination.pm7
-rw-r--r--lib/PDF/Builder/Outline.pm2
-rw-r--r--lib/PDF/Builder/Outlines.pm2
-rw-r--r--lib/PDF/Builder/Page.pm2
-rw-r--r--lib/PDF/Builder/Resource.pm2
-rw-r--r--lib/PDF/Builder/Resource/BaseFont.pm2
-rw-r--r--lib/PDF/Builder/Resource/CIDFont.pm11
-rw-r--r--lib/PDF/Builder/Resource/CIDFont/CJKFont.pm9
-rw-r--r--lib/PDF/Builder/Resource/CIDFont/TrueType.pm9
-rw-r--r--lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm9
-rw-r--r--lib/PDF/Builder/Resource/ColorSpace.pm7
-rw-r--r--lib/PDF/Builder/Resource/ColorSpace/DeviceN.pm9
-rw-r--r--lib/PDF/Builder/Resource/ColorSpace/Indexed.pm7
-rw-r--r--lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile.pm7
-rw-r--r--lib/PDF/Builder/Resource/ColorSpace/Indexed/Hue.pm7
-rw-r--r--lib/PDF/Builder/Resource/ColorSpace/Indexed/WebColor.pm7
-rw-r--r--lib/PDF/Builder/Resource/ColorSpace/Separation.pm7
-rw-r--r--lib/PDF/Builder/Resource/Colors.pm2
-rw-r--r--lib/PDF/Builder/Resource/ExtGState.pm7
-rw-r--r--lib/PDF/Builder/Resource/Font.pm11
-rw-r--r--lib/PDF/Builder/Resource/Font/BdFont.pm54
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont.pm7
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/bankgothic.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/courier.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/courierbold.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/courierboldoblique.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/courieroblique.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/georgia.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/georgiabold.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/georgiabolditalic.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/georgiaitalic.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/helvetica.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/helveticabold.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/helveticaboldoblique.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/helveticaoblique.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/symbol.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/timesbold.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/timesbolditalic.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/timesitalic.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/timesroman.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/trebuchet.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbold.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbolditalic.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/trebuchetitalic.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/verdana.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/verdanabold.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/verdanabolditalic.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/verdanaitalic.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/webdings.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/wingdings.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/CoreFont/zapfdingbats.pm2
-rw-r--r--lib/PDF/Builder/Resource/Font/Postscript.pm23
-rw-r--r--lib/PDF/Builder/Resource/Font/SynFont.pm20
-rw-r--r--lib/PDF/Builder/Resource/Glyphs.pm7
-rw-r--r--lib/PDF/Builder/Resource/PaperSizes.pm2
-rw-r--r--lib/PDF/Builder/Resource/Pattern.pm2
-rw-r--r--lib/PDF/Builder/Resource/Shading.pm2
-rw-r--r--lib/PDF/Builder/Resource/UniFont.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Form.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Form/BarCode.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/GD.pm7
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/GIF.pm7
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/JPEG.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/PNG.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm14
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/PNM.pm7
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/TIFF.pm9
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm2
-rw-r--r--lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm526
-rw-r--r--lib/PDF/Builder/UniWrap.pm12
-rw-r--r--lib/PDF/Builder/Util.pm9
-rw-r--r--t/00-all-usable.t16
-rw-r--r--t/deprecations.t2
-rw-r--r--t/gif.t3
-rw-r--r--t/png.t3
-rw-r--r--t/pnm.t3
-rw-r--r--t/rt120397.t3
-rw-r--r--t/tiff.t5
-rw-r--r--tools/1_pc.pl45
-rw-r--r--tools/2_t-tests.pl2
-rw-r--r--tools/3_examples.pl4
-rw-r--r--tools/4_contrib.pl2
-rw-r--r--tools/TTFdump.pl2
148 files changed, 1185 insertions, 491 deletions
diff --git a/CONTRIBUTING b/CONTRIBUTING
index 3ff445c..827bbb4 100644
--- a/CONTRIBUTING
+++ b/CONTRIBUTING
@@ -7,16 +7,9 @@ not good to spend a lot of time working on something that no one is interested
in!
You can contribute to the discussion by posting bug reports, feature requests,
-observations, etc. to either the GitHub issues area, https://github.com/
+observations, etc. to the GitHub issues area, https://github.com/
PhilterPaper/Perl-PDF-Builder/issues?q=is%3Aissue+sort%3Aupdated-desc (please
-tag new threads accordingly ["Labels"]) or to the Forum on catskilltech.com,
-https:://www.catskilltech.com/forum/index.html#c5 (please place a new topic in
-the appropriate area ["board"]). We will cross-post from one to the other as
-necessary. If you don't have an account on either system, and want to
-occasionally post something, there is a Contact form on the Forum where you can
-send in something for us to post. Please do not abuse this system -- if you are
-regularly posting via the Contact form, please take a minute to register on
-one or both systems. We do not use CPAN's "RT" bug tracking system.
+tag new threads accordingly, using ["Labels"]).
Please also read INFO/RoadMap to get an idea of where we would like for
PDF::Builder to be heading, and may give you an idea of where you could
@@ -38,6 +31,12 @@ burden to us), we reserve the right to limit the ways that code changes can be
submitted. At this point, the volume is low enough that almost anything can be
handled.
+Do NOT under ANY circumstances open a PR (Pull Request) to report a bug. It is
+a waste of both your and our time and effort. Open a regular ticket (issue),
+and attach a Perl (.pl) program illustrating the problem, if possible. If you
+believe that you have a program patch, and offer to share it as a PR, we may
+give the go-ahead. Unsolicited PRs may be closed without further action.
+
Please do not start on a massive project (especially, new function), without
discussing it with us first (via email or one of the discussion areas). This
will save you the disappointment of seeing your hard work rejected because it
diff --git a/Changes b/Changes
index fdad3d9..d55ff6a 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,65 @@ See also INFO/Changes-ver_2 for changes released for PDF::API2, and
incorporated into PDF::Builder.
See also INFO/Changes_2019 for earlier version 3 release logs.
+3.021 2020-12-28
+
+ Makefile.PL, CONTRIBUTING, INFO/SUPPORT, INFO/old/dist.ini.old, README.md
+ Some cleanup of email addresses and obsolete support venues.
+
+ Makefile.PL, lib/PDF/Builder.pm, t/00-all-usable.t
+ New minimum version for Image::PNG::Libpng is now 0.56. There was a change
+ introduced in 0.53 that broke PDF::Builder, but has now been fixed. As
+ far as we know, versions 0.47 through 0.52 should still work, if you
+ happen to have that installed, but for automated install/upgrade, the
+ new minimum is now 0.56.
+
+ lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm
+ Added some support for TIFF with alpha channel display [CTS 33, with some
+ help from 'carygravel']. Limited testing due to lack of sample .tif
+ files, and currently not doing anything about transparency mask type or
+ any higher-numbered PhotometricInterpretation types.
+
+ tools/1_pc.pl, lib/PDF/Builder/Resource/Glyphs.pm,
+ t/gif-png-pnm-rt120397-tiff.t
+ Clean up a few things Perl Critic doesn't like, and exclude a few more
+ frivolous things (in the exclusion list).
+
+ lib/PDF/Builder.pm, t/00-all-usable.t
+ Consolidate "optional" library versions to make update easier.
+
+ lib/PDF/Builder/Basic/PDF/File.pm
+ Change grep from expression format to { }, per PDF::API2 change.
+
+ README.md (added), README (removed), MANIFEST
+ Replace the plain text README with a markdown-formatted README.md
+
+ lib/PDF/Builder.pm, lib/PDF/Builder/Content-Lite-NamedDestination-UniWrap-
+ Util.pm, lib/PDF/Builder/Basic/PDF/Dict-File-Literal.pm,
+ lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm,
+ lib/PDF/Builder/Resource/CIDFont-ColorSpace-ExtGState-Font.pm,
+ lib/PDF/Builder/Resource/CIDFont/CJKFont-TrueType.pm,
+ lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm,
+ lib/PDF/Builder/Resource/ColorSpace/DeviceN-Indexed-Separation.pm,
+ lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile-Hue-WebColor.pm,
+ lib/PDF/Builder/Resource/Font/BDFont-CoreFont-Postscript-SynFont.pm,
+ lib/PDF/Builder/Resource/XObject/Image/GD-GIF-PNM-TIFF-TIFF_GT.pm,
+ examples/Windows/Win32.pm, examples/Content-ContentText.pl,
+ examples/021_synfonts-023_cjkfonts-025_unifonts,
+ tools/1_pc.pl, tools/3_examples.pl, t/deprecations.t
+ Change any "no warnings" directive to "use warnings", and fix any
+ resulting issues. This makes perlcritic and CPAN kwalitee a bit happier.
+
+ For now, just commented out "no warnings". If no reports of problems,
+ will physically remove commented-out lines in 3.022 or later. If you
+ encounter Perl warnings from specific routines, you can uncomment the
+ "no warnings" and comment out "use warnings", to get past the warnings,
+ but please also file a bug report!
+
+ t/00-all-usable.t, Makefile.PL, lib/PDF/Builder.pm,
+ lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm
+ Make both t-tests and runtime a bit more robust if an optional library
+ (Graphics::TIFF and/or Image::PNG::Libpng) is installed, but back-level.
+
3.020 2020-11-29
lib/PDF/Builder/Content-Outline-NamedDestination.pm, INFO/DEPRECATED
diff --git a/INFO/Changes-ver_2 b/INFO/Changes-ver_2
index aa8fb52..76fd5ba 100644
--- a/INFO/Changes-ver_2
+++ b/INFO/Changes-ver_2
@@ -1,5 +1,26 @@
Change log for PDF::API2 version 2.xxx (predecessor to PDF::Builder)
+2.039 2020-12-12
+
+ - add missing trailing commas in Content.pm (not done in PDF::Builder)
+
+ - update code style in Resource/Font/CoreFont.pm (not worth doing in
+ PDF::Builder)
+
+ - expression form of grep changed in Basic/PDF/File.pm
+
+ - PDF::API2->open($filename) no longer reads the entire file into memory
+ before working on it, instead reading from the file as needed. This
+ results in a substantial reduction in memory usage and start-up time for
+ large PDF files, particularly in cases where the calling script doesn't
+ need to access all of the contents of the PDF.
+ (not yet implemented in PDF::Builder, want to gain some experience
+ with PDF::API2 first)
+
+2.038 2020-08-31
+
+ - Use libpng.a PNG processing to speed up (already in PDF::Builder)
+
2.037 2020-02-05
- Allow PDF 2.0 files to be opened. [already in PDF::Builder]
diff --git a/INFO/SUPPORT b/INFO/SUPPORT
index ec2f5bc..67c77d0 100644
--- a/INFO/SUPPORT
+++ b/INFO/SUPPORT
@@ -10,28 +10,21 @@ from 2.xxx (API2) to 3.xxx (now Builder) and had made three releases
(served from the catskilltech.com website). Rather than reset to 1.000,
it seemed cleaner just to continue with the 3.xxx version.
-Currently, PDF::Builder source is hosted on GitHub
+PDF::Builder source is hosted on GitHub
(https://github.com/PhilterPaper/Perl-PDF-Builder), with the Perl
-installable module download offered on CPAN (PDF::Builder).
+installable module download offered on CPAN (PDF::Builder). Many users can
+directly install using a CPAN-compatible installer (e.g., 'cpan' on Strawberry
+Perl, or 'cpanm').
Please raise issues (bug reports, etc.) on GitHub, under the "issues" tab,
with label "bugs". Feature Requests should be labeled "enhancement". The
maintainer will close (and tag as appropriate) resolved or rejected issues.
-Please do NOT use the CPAN RT ticket system -- it is not being regularly
-monitored by the owner.
General discussions not pertaining to a specific issue (bug) may be
-conducted on the forum at https://www.catskilltech.com/forum/index.html
-in the PDF::Builder/General Discussions board. Alternately, use the "general
-discussion" label under the GitHub system.
-
-If you do not have a CPAN or GitHub account with which to open a ticket,
-you can use my Contact form at the above forum URL. Look for a link "Post
-without Account". This is provided as a convenience for those lacking a
-GitHub ID (for submitting an issue) and only need it on an occasional
-basis. If you end up using it regularly, I will have to ask you to open
-a GitHub account so that you can post directly. Please indicate whether
-you are trying to post a ticket (issue) for GitHub, an entry to a thread
-(or are starting a new thread) in the forum, or something else.
-
+conducted on GitHub "issues", labeled with the "general discussion" label.
+Do NOT under ANY circumstances open a PR (Pull Request) to report a bug. It is
+a waste of both your and our time and effort. Open a regular ticket (issue),
+and attach a Perl (.pl) program illustrating the problem, if possible. If you
+believe that you have a program patch, and offer to share it as a PR, we may
+give the go-ahead. Unsolicited PRs may be closed without further action.
diff --git a/INFO/old/dist.ini.old b/INFO/old/dist.ini.old
index 5a7c19b..4c8bd6a 100644
--- a/INFO/old/dist.ini.old
+++ b/INFO/old/dist.ini.old
@@ -1,5 +1,5 @@
name = PDF-Builder
-author = Phil Perry <phil4597@catskilltech.com>
+author = Phil Perry <no-reply@catskilltech.com>
license = LGPL_2_1
copyright_holder = Phil Perry
@@ -12,7 +12,7 @@ repository.type = git
format = %-9v %{yyyy-MM-dd}d
[Prereqs]
-perl = v5.18.0
+perl = v5.20.0
Compress::Zlib = 1.0
Font::TTF = 1.06
diff --git a/MANIFEST b/MANIFEST
index 75b3563..a5e36e6 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5,7 +5,7 @@ Changes
CONTRIBUTING
Makefile.PL
MANIFEST
-README
+README.md
tools/1_pc.pl
tools/2_t-tests.pl
tools/3_examples.pl
diff --git a/META.json b/META.json
index 5e77c9d..e4b338b 100644
--- a/META.json
+++ b/META.json
@@ -1,10 +1,10 @@
{
"abstract" : "Facilitates the creation and modification of PDF files",
"author" : [
- "Phil Perry <phil4597@catskilltech.com>"
+ "Phil Perry"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.56, CPAN::Meta::Converter version 2.150010",
+ "generated_by" : "ExtUtils::MakeMaker version 7.58, CPAN::Meta::Converter version 2.150010",
"license" : [
"open_source"
],
@@ -47,16 +47,15 @@
"release_status" : "stable",
"resources" : {
"bugtracker" : {
- "mailto" : "support2854 [at] catskilltech.com",
"web" : "https://github.com/PhilterPaper/Perl-PDF-Builder/issues"
},
- "homepage" : "https://www.catskilltech.com",
+ "homepage" : "https://metacpan.org/pod/PDF::Builder",
"repository" : {
"type" : "git",
"url" : "git://github.com/PhilterPaper/Perl-PDF-Builder.git",
"web" : "https://github.com/PhilterPaper/Perl-PDF-Builder"
}
},
- "version" : "3.020",
+ "version" : "3.021",
"x_serialization_backend" : "JSON::PP version 4.05"
}
diff --git a/META.yml b/META.yml
index aaecce3..6c9cddc 100644
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
---
abstract: 'Facilitates the creation and modification of PDF files'
author:
- - 'Phil Perry <phil4597@catskilltech.com>'
+ - 'Phil Perry'
build_requires:
ExtUtils::MakeMaker: '0'
Test::Exception: '0'
@@ -9,7 +9,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: '6.5503'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.56, CPAN::Meta::Converter version 2.150010'
+generated_by: 'ExtUtils::MakeMaker version 7.58, CPAN::Meta::Converter version 2.150010'
license: open_source
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -25,7 +25,7 @@ requires:
perl: '5.020000'
resources:
bugtracker: https://github.com/PhilterPaper/Perl-PDF-Builder/issues
- homepage: https://www.catskilltech.com
+ homepage: https://metacpan.org/pod/PDF::Builder
repository: git://github.com/PhilterPaper/Perl-PDF-Builder.git
-version: '3.020'
+version: '3.021'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff --git a/Makefile.PL b/Makefile.PL
index 3ce8e1e..33cd6e6 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -8,7 +8,7 @@ use ExtUtils::MakeMaker 6.5503;
my $PERL_version = '5.020000'; # can't use in "use" statement above! eval?
# could read from .perl-version file otherwise
my $MakeMaker_version = '6.5503';
-my $version = '3.020'; # PDFbuild.pl updates from 'version' file
+my $version = '3.021'; # PDFbuild.pl updates from 'version' file
# optional libraries... prompt user whether or not to install
# nice to have but not vital for many users
@@ -21,9 +21,11 @@ my @choice_list = ( # use array to guarantee order
# 'a' and 'n' are reserved, do not use as key [0]
# [1] is actual library name [2] is minimum version [3] description
["t", "Graphics::TIFF", 7, "TIFF image support"],
- # improved TIFF image processing
- ["p", "Image::PNG::Libpng", 0.47, "PNG image support"],
- # advanced/fast PNG image processing
+ # improved TIFF image processing. DON'T FORGET TO UPDATE VERSION in
+ # t/00-all-usable.t, lib/PDF/Builder.pm
+ ["p", "Image::PNG::Libpng", 0.56, "PNG image support"],
+ # advanced/fast PNG image processing. DON'T FORGET TO UPDATE VERSION in
+ # t/00-all-usable.t, lib/PDF/Builder.pm
["h", "HarfBuzz::Shaper", 0.23, "complex script support"],
# text shaping for Latin script ligatures and kerning, and for
# many complex scripts both LTR and RTL directions.
@@ -77,7 +79,7 @@ my %WriteMakefileArgs =
# ABSTRACT_FROM => $master,
ABSTRACT => "Facilitates the creation and modification of PDF files",
- AUTHOR => 'Phil Perry <phil4597@catskilltech.com>',
+ AUTHOR => 'Phil Perry',
LICENSE => "lgpl",
MIN_PERL_VERSION => $PERL_version,
INSTALLDIRS => "site",
@@ -118,7 +120,7 @@ my %WriteMakefileArgs =
resources => {
- homepage => "https://www.catskilltech.com",
+ homepage => "https://metacpan.org/pod/PDF::Builder",
repository => {
type => 'git',
@@ -128,7 +130,6 @@ my %WriteMakefileArgs =
bugtracker => {
web => 'https://github.com/PhilterPaper/Perl-PDF-Builder/issues',
- mailto => 'support2854 [at] catskilltech.com',
},
},
@@ -172,7 +173,7 @@ if (scalar @choice_list > 0) { # in case all disabled!
# $c should have one or more of a,n (contradictory!) t,p,h
if ($c !~ m/n/) { # remind user that librarie(s) to be installed/updated
-print <<END;
+print <<'END';
===========================================================================
The installation process will attempt to install or update several OPTIONAL
prerequisite packages. If one or more should fail to install, Don't Panic
diff --git a/README b/README
deleted file mode 100644
index 3661e66..0000000
--- a/README
+++ /dev/null
@@ -1,113 +0,0 @@
-
-This archive contains the distribution PDF::Builder.
-See Changes file for the version.
-
- A Perl library to facilitate the creation and modification of PDF files
-
-The installable Perl package may be obtained from https://www.cpan.org,
-as PDF::Builder. If you install this product, only the run-time modules will
-be installed. Download the full .tar.gz file and unpack it (hint: on Windows,
-7-Zip File Manager is an excellent tool) to get utilities, test buckets,
-example usage, etc.
-
-Alternatively, you can obtain the full source files from
-https://github.com/PhilterPaper/Perl-PDF-Builder, where the ticket list (bugs,
-enhancement requests, etc.) is also kept. Unlike the installable CPAN version,
-this will have to be manually installed (copy files; there are no XS compiles
-at this time).
-
-Note that there are several "optional" libraries (Perl modules) used to extend
-and improve PDF::Builder. The installation process will not attempt to install
-them if not present -- you need to do this manually (if you want to use them),
-or at least, give the go-ahead during the installation process to try
-installing them. Read about the list of optional libraries in
-PDF::Builder::Docs, and decide whether or not you want to install any of them.
-
-REQUIREMENTS ======================================================
-
-Perl 5.20 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 supported. The intent is to not waste time and effort trying to fix bugs
- which are an artifact of old Perl releases.
-
- If you MUST install on an older (pre 5.20) Perl, you can try the following
- for Strawberry Perl (Windows). NO PROMISES! Something similar MAY work for
- other OS's and Perl installations:
- Unpack installation file (.tar.gz, via a utility such as 7-Zip) into a
- directory, and cd to that directory
- Edit .perl-version and change 5.20.0 to 5.16.0 or whatever level desired
- Edit Makefile.PL and change use 5.020000; to use 5.016000;
- change $PERL_version from '5.020000' to '5.016000'
- cpan .
-
- Note that some Perl installers MAY have a means to override or suppress the
- Perl version check. That may be easier to use. Or, you may have to repack
- the edited directory back into a .tar.gz installable. YMMV.
-
- If all goes well, PDF::Builder will be installed on your system. Whether or
- not it will RUN is another matter. Please do NOT open a bug report (ticket)
- unless you're absolutely sure that the problem is not a result of using an
- old Perl release, e.g., PDF::Builder is using a feature introduced in Perl
- 5.008 and you're trying to run Perl 5.002!
-
-Libraries used, available from CPAN --
-
- REQUIRED, should be automatically installed...
- Compress::Zlib
- Font::TTF
- Test::Exception (needed only for installation tests)
- Test::Memory::Cycle (needed only for installation tests)
-
- OPTIONAL, install manually if wanted AND they failed to install
- automatically when requested...
- Graphics::TIFF (recommended if using TIFF image functions)
- Image::PNG::Libpng (recommended for enhanced PNG image function processing)
- HarfBuzz::Shaper (recommended for Latin script ligatures and kerning, as
- well as for any complex script such as Arabic, Indic
- scripts, or Khmer)
-
-Other than an installer for standard CPAN packages (such as 'cpan' on
-Strawberry Perl for Windows), no other tools or manually-installed prereqs
-are needed (worst case, you can unpack the .tar.gz file and copy files into
-place yourself!). Currently there are no compiles and links (Perl extensions)
-done during the install process, only copying of .pm Perl module files.
-
-===================================================================
-
-This software is Copyright (c) 2017-2020 by Phil M. Perry.
-Previous copyrights are held by others (Steve Simms, Alfred Reibenschuh,
-et al.).
-
-This is free software, licensed under:
-
- The GNU Lesser General Public License, Version 2.1, February 1999
-
-EXCEPT for some files which are explicitly under other licenses. You are
-permitted (at your option) to 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.
-
-See INFO/RoadMap file for the PDF::Builder road map.
-See CONTRIBUTING file for how to contribute to the project.
-See INFO/SUPPORT file for information on reporting bugs, etc. via GitHub Issues
- (preferred), or the author's website.
-See INFO/DEPRECATED file for information on deprecated features.
-See INFO/KNOWN_INCOMP file for known incompatibilities with PDF::API2.
-See INFO/Changes* files for older change logs.
-See INFO/PATENTS file for information on patents.
-See INFO/CONVERSION file for how to convert from PDF::API2 to PDF::Builder
-
-INFO/old/ also has some build and test tool files that are not currently used.
-
-To build the full HTML documentation (all the POD), get the full installation
-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).
-
-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
-code that may help you figure out how to do things. The installation tests in
-the "t" directory might also be useful to you.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..83a2d8a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,130 @@
+# PDF::Builder
+
+`A Perl library to facilitate the creation and modification of PDF files`
+
+This archive contains the distribution PDF::Builder.
+See **Changes** file for the version.
+
+## Obtaining the Package
+
+The installable Perl package may be obtained from
+"https://metacpan.org/pod/PDF::Builder", or via a CPAN installer package. If
+you install this product, only the run-time modules will be installed. Download
+the full `.tar.gz` file and unpack it (hint: on Windows,
+**7-Zip File Manager** is an excellent tool) to get utilities, test buckets,
+example usage, etc.
+
+Alternatively, you can obtain the full source files from
+"https://github.com/PhilterPaper/Perl-PDF-Builder", where the ticket list
+(bugs, enhancement requests, etc.) is also kept. Unlike the installable CPAN
+version, this will have to be manually installed (copy files; there are no XS
+compiles at this time).
+
+Note that there are several "optional" libraries (Perl modules) used to extend
+and improve PDF::Builder. Read about the list of optional libraries in
+PDF::Builder::Docs, and decide whether or not you want to install any of them.
+
+## Requirements
+
+### Perl
+
+**Perl 5.20** 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
+supported. The intent is to not waste time and effort trying to fix bugs which
+are an artifact of old Perl releases.
+
+#### Older Perls
+
+If you MUST install on an older (pre 5.20) 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 .perl-version and change 5.20.0 to 5.16.0 or whatever level desired
+1. Edit Makefile.PL and change `use 5.020000;` to `use 5.016000;`, change `$PERL_version` from `5.020000` to `5.016000`
+1. `cpan .`
+
+Note that some Perl installers MAY have a means to override or suppress the
+Perl version check. That may be easier to use. Or, you may have to repack the
+edited directory back into a `.tar.gz` installable. YMMV.
+
+If all goes well, PDF::Builder will be installed on your system. Whether or
+not it will RUN is another matter. Please do NOT open a bug report (ticket)
+unless you're absolutely sure that the problem is not a result of using an old
+Perl release, e.g., PDF::Builder is using a feature introduced in Perl 5.008
+and you're trying to run Perl 5.002!
+
+### Libraries used
+
+These libraries are available from CPAN.
+
+#### REQUIRED
+
+These libraries should be automatically installed...
+
+* Compress::Zlib
+* Font::TTF
+* Test::Exception (needed only for installation tests)
+* Test::Memory::Cycle (needed only for installation tests)
+
+#### OPTIONAL
+
+These libraries are _recommended_ for improved functionality and performance.
+The default behavior is to attempt to install all of them during PDF::Builder
+installation. If you tell Makefile.PL (when prompted) _not_ to install any of
+them, or they fail to install, you can always manually install them later.
+
+* Graphics::TIFF (recommended if using TIFF image functions)
+* Image::PNG::Libpng (recommended for enhanced PNG image function processing)
+* HarfBuzz::Shaper (recommended for Latin script ligatures and kerning, as well as for any complex script such as Arabic, Indic scripts, or Khmer)
+
+Other than an installer for standard CPAN packages (such as 'cpan' on
+Strawberry Perl for Windows), no other tools or manually-installed prereqs are
+needed (worst case, you can unpack the `.tar.gz` file and copy files into
+place yourself!). Currently there are no compiles and links (Perl extensions)
+done during the install process, only copying of .pm Perl module files.
+
+## Copyright
+
+This software is Copyright (c) 2017-2020 by Phil M. Perry.
+
+Previous copyrights are held by others (Steve Simms, Alfred Reibenschuh, et al.).
+
+## License
+
+This is free software, licensed under:
+
+`The GNU Lesser General Public License, Version 2.1, February 1999`
+
+EXCEPT for some files which are explicitly under other licenses. You are
+permitted (at your option) to 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.
+
+## See Also
+
+* INFO/RoadMap file for the PDF::Builder road map
+* CONTRIBUTING file for how to contribute to the project
+* INFO/SUPPORT file for information on reporting bugs, etc. via GitHub Issues (preferred), or the author's website
+* INFO/DEPRECATED file for information on deprecated features
+* INFO/KNOWN\_INCOMP file for known incompatibilities with PDF::API2
+* INFO/Changes\* files for older change logs
+* INFO/PATENTS file for information on patents
+* INFO/CONVERSION file for how to convert from PDF::API2 to PDF::Builder
+
+`INFO/old/` also has some build and test tool files that are not currently used.
+
+## Documentation
+
+To build the full HTML documentation (all the POD), get the full installation
+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).
+
+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
+code that may help you figure out how to do things. The installation tests in
+the `t/` directory might also be useful to you.
diff --git a/contrib/combine_pdfs.pl b/contrib/combine_pdfs.pl
index a9d5636..d30c212 100644
--- a/contrib/combine_pdfs.pl
+++ b/contrib/combine_pdfs.pl
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
use PDF::Builder;
diff --git a/contrib/pdf-debug.pl b/contrib/pdf-debug.pl
index 730b455..5f21f63 100644
--- a/contrib/pdf-debug.pl
+++ b/contrib/pdf-debug.pl
@@ -4,7 +4,7 @@ use warnings;
use PDF::Builder::Basic::PDF::File;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
my $file = shift(@ARGV);
diff --git a/contrib/pdf-deoptimize.pl b/contrib/pdf-deoptimize.pl
index be7c5af..192d946 100644
--- a/contrib/pdf-deoptimize.pl
+++ b/contrib/pdf-deoptimize.pl
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::File;
diff --git a/contrib/pdf-optimize.pl b/contrib/pdf-optimize.pl
index 4352bb3..1e64bde 100644
--- a/contrib/pdf-optimize.pl
+++ b/contrib/pdf-optimize.pl
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::File;
diff --git a/contrib/text2pdf.pl b/contrib/text2pdf.pl
index 69b942d..35283d7 100644
--- a/contrib/text2pdf.pl
+++ b/contrib/text2pdf.pl
@@ -72,8 +72,8 @@
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.002'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder;
use PDF::Builder::Util;
@@ -125,7 +125,7 @@ my $PGheight; # Physical sheet height in points.
my $PGwidth; # Physical sheet height in points.
my ($left, $right, $top, $bottom); # margins in points
my ($LineStart, $LineBottom);
-my ($gfx, $txt, $gfx_border, $gfx_image);
+my ($gfx, $txt, $gfx_border);
our ($pageNum,$filename);
# other variables
@@ -133,7 +133,6 @@ my @FILES; # list of input files, in case of glob
my @INFILES; # command line list of files and globs
my $destpath; # destination path
my $outfile; # output path & file
-my $arg; # command line argument being processed
my $help; # Flag for displaying help
my $FontTypeStr; # C means Core, TT means TrueType.
diff --git a/docs/buildDoc.pl b/docs/buildDoc.pl
index 6523b5d..e76efff 100644
--- a/docs/buildDoc.pl
+++ b/docs/buildDoc.pl
@@ -16,8 +16,8 @@ use strict;
use warnings;
use Getopt::Long;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
# =============
# CONFIGURATION these may be overridden by command-line flags. If reading from
@@ -715,7 +715,7 @@ sub process {
if ($len <= 1) { return; } # single element won't have any children
my ($i, $j, $dir);
- my ($start2, $len2, $ref, $refc);
+ my ($len2, $ref, $refc);
# if $start row's pmnameA is now empty, that means that $start is the
# parent of everything else below it
diff --git a/examples/021_synfonts b/examples/021_synfonts
index 7e7b387..024e749 100644
--- a/examples/021_synfonts
+++ b/examples/021_synfonts
@@ -81,7 +81,8 @@ if ($type == 0) {
verdanabold
verdanabolditalic
wingdings
- webdings);
+ webdings
+ );
}
if ($type == 1) {
@font_list = qw( Times-Roman );
diff --git a/examples/023_cjkfonts b/examples/023_cjkfonts
index 0367623..d8d75c4 100644
--- a/examples/023_cjkfonts
+++ b/examples/023_cjkfonts
@@ -23,11 +23,13 @@ my $fx = 20;
my ($pdf, $f1, $gfx, $text, $page);
# font name list
-my @fontnames = qw[ Ming Ming-Bold Ming-Italic Ming-BoldItalic
- Song Song-Bold Song-Italic Song-BoldItalic
- MyungJo MyungJo-Bold MyungJo-Italic MyungJo-BoldItalic
- KozMin KozMin-Bold KozMin-Italic KozMin-BoldItalic
- KozGo KozGo-Bold KozGo-Italic KozGo-BoldItalic ];
+my @fontnames = qw[
+ Ming Ming-Bold Ming-Italic Ming-BoldItalic
+ Song Song-Bold Song-Italic Song-BoldItalic
+ MyungJo MyungJo-Bold MyungJo-Italic MyungJo-BoldItalic
+ KozMin KozMin-Bold KozMin-Italic KozMin-BoldItalic
+ KozGo KozGo-Bold KozGo-Italic KozGo-BoldItalic
+];
foreach my $fn (@fontnames) {
#if ($fn eq 'Ming-Bold') { last; } # for testing
diff --git a/examples/025_unifonts b/examples/025_unifonts
index 5ada052..bd33442 100644
--- a/examples/025_unifonts
+++ b/examples/025_unifonts
@@ -5,6 +5,11 @@ use warnings;
# read in first 45 lines from SJIS-encoded attached PDF-J file, convert to
# UTF-8, and output in 4 different CJK+Western font combinations
+#
+# NOTE: This code is meant as an example of what could be done. If it was
+# intended to be a serious utility, we would have to fold long lines that
+# currently run off the right side of the page, so that content would
+# not be lost.
use File::Basename;
use PDF::Builder;
@@ -76,7 +81,7 @@ my %fonts = (
'KozGo-Italic + Georgia-Italic' => $u3
);
-my ($pdf, $page, $gfx, $text, $y, $line);
+my ($page, $gfx, $text, $y, $line);
foreach my $fontname (keys %fonts) {
$y = 800; # title line this page
diff --git a/examples/BarCode.pl b/examples/BarCode.pl
index f43df3a..45223ac 100644
--- a/examples/BarCode.pl
+++ b/examples/BarCode.pl
@@ -9,8 +9,8 @@
use warnings;
use strict;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.013'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Math::Trig;
use List::Util qw(min max);
@@ -31,13 +31,11 @@ my $PDFname = $0;
my $globalX = 0;
my $globalY = 0;
-my ($unused, $cell_height, $j, $cont);
-
my $pdf = PDF::Builder->new(-compress => $compress);
my ($page, $grfx, $text); # objects for page, graphics, text
-my (@base, @styles, @points, $i, $lw, $angle, @npts);
-my (@cellLoc, @cellSize, $font, $width, $d1, $d2, $d3, $d4);
+my (@base, @points, $i);
+my (@cellLoc, @cellSize, $font, $width);
my @axisOffset = (5, 5); # clear the edge of the cell
my ($barcode, $type, $content, $bar_height, $mils, $scale);
diff --git a/examples/Boxes.pl b/examples/Boxes.pl
index 5fb0eb1..ed8e2c7 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.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
my $PDFname = $0;
diff --git a/examples/Bspline.pl b/examples/Bspline.pl
index 89e5bd8..5327ba7 100644
--- a/examples/Bspline.pl
+++ b/examples/Bspline.pl
@@ -33,8 +33,8 @@
use warnings;
use strict;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Math::Trig;
use List::Util qw(min max);
@@ -56,8 +56,8 @@ my $compress = 'none';
my $pdf = PDF::Builder->new(-compress => $compress);
my ($page, $grfx, $text); # objects for page, graphics, text
-my (@base, @styles, @points, $i, $lw, $angle, @npts);
-my (@cellLoc, @cellSize, $font, $width, $d1, $d2, $d3, $d4);
+my (@points, $i);
+my ($font);
my @axisOffset = (5, 5); # clear the edge of the cell
my $db = 4; # debug level
diff --git a/examples/Content.pl b/examples/Content.pl
index 0a0ddc2..6cbab8d 100644
--- a/examples/Content.pl
+++ b/examples/Content.pl
@@ -6,8 +6,8 @@
use warnings;
use strict;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.013'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Math::Trig;
use List::Util qw(min max);
@@ -2412,13 +2412,13 @@ $grfx->poly(155,120, 155,10);
$grfx->stroke();
$text->translate($base[0]+15, $base[1]+100);
-$text->text('When in the course', 140);
+$text->text('When in the course');
$text->translate($base[0]+15, $base[1]+ 80);
-$text->text('of human events, it becomes', 140);
+$text->text('of human events, it becomes');
$text->translate($base[0]+15, $base[1]+ 60);
-$text->text('necessary for one people to dissolve the', 140);
+$text->text('necessary for one people to dissolve the');
$text->translate($base[0]+15, $base[1]+ 40);
-$text->text('political bands...', 140);
+$text->text('political bands...');
# caption
drawCaption(['text()'], 'LC');
diff --git a/examples/ContentText.pl b/examples/ContentText.pl
index b92cb46..38a3e2d 100644
--- a/examples/ContentText.pl
+++ b/examples/ContentText.pl
@@ -6,8 +6,8 @@
use warnings;
use strict;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Math::Trig;
use List::Util qw(min max);
@@ -66,9 +66,9 @@ my ($unused, $cell_height, $j, $cont);
my $pdf = PDF::Builder->new();
my ($page, $grfx, $text); # objects for page, graphics, text
-my (@base, @styles, @points, $i, $lw, $angle, @npts);
+my (@base, @points, $i, $lw);
#$pdf->{'forcecompress'} = 0; # don't compress, so we can see what's happening
-my (@cellLoc, @cellSize, $font, $width, $d1, $d2, $d3, $d4);
+my (@cellLoc, @cellSize, $font, $width);
my @axisOffset = (5, 5); # clear the edge of the cell
my $pageNo = 0;
@@ -102,13 +102,13 @@ $grfx->poly(155,120, 155,10);
$grfx->stroke();
$text->translate($base[0]+15, $base[1]+100);
-$text->text_left('When in the course', 140);
+$text->text_left('When in the course');
$text->translate($base[0]+15, $base[1]+ 80);
-$text->text_left('of human events, it becomes', 140);
+$text->text_left('of human events, it becomes');
$text->translate($base[0]+15, $base[1]+ 60);
-$text->text_left('necessary for one people to dissolve the', 140);
+$text->text_left('necessary for one people to dissolve the');
$text->translate($base[0]+15, $base[1]+ 40);
-$text->text_left('political bands...', 140);
+$text->text_left('political bands...');
# caption
drawCaption(['text_left()'], 'LC');
diff --git a/examples/HarfBuzz.pl b/examples/HarfBuzz.pl
index 69aafd9..72e33c3 100644
--- a/examples/HarfBuzz.pl
+++ b/examples/HarfBuzz.pl
@@ -11,8 +11,8 @@
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
my $PDFname = $0;
$PDFname =~ s/\..*$//; # remove extension such as .pl
@@ -65,7 +65,7 @@ my $pdf = PDF::Builder->new(-compress => 'none');
$pdf->mediabox('universal'); # narrower and shorter of US letter and A4, so
# it should be printable on either paper
my $labelFont = $pdf->corefont('Helvetica');
-my ($font, @chars);
+my ($font);
# A collection of text in various scripts. Non-Latin (English) lines include
# "PDF::Builder" chunks in the middle, to demonstrate switching back and forth
diff --git a/examples/Rotated.pl b/examples/Rotated.pl
index 60bf1b6..b51fc1b 100644
--- a/examples/Rotated.pl
+++ b/examples/Rotated.pl
@@ -7,7 +7,7 @@
use warnings;
use strict;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
use PDF::Builder;
diff --git a/examples/Windows/Win32.pm b/examples/Windows/Win32.pm
index c66a408..fc369fe 100644
--- a/examples/Windows/Win32.pm
+++ b/examples/Windows/Win32.pm
@@ -1,10 +1,11 @@
package PDF::Builder::Win32; ## no critic
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Win32::TieRegistry qw( :KEY_ ); # creates $Registry, et al.
diff --git a/lib/PDF/Builder.pm b/lib/PDF/Builder.pm
index fe3127a..bc70d2c 100644
--- a/lib/PDF/Builder.pm
+++ b/lib/PDF/Builder.pm
@@ -1,12 +1,16 @@
package PDF::Builder;
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
# $VERSION defined here so developers can run PDF::Builder from git.
# it should be automatically updated as part of the CPAN build.
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
+
+my $GrTFversion = 7; # minimum version of Graphics::TIFF
+my $LpngVersion = 0.56; # minimum version of Image::PNG::Libpng
use Carp;
use Encode qw(:all);
@@ -156,11 +160,13 @@ PDF::Builder is currently being maintained by Phil M. Perry.
=head2 SUPPORT
-Full source is on https://github.com/PhilterPaper/Perl-PDF-Builder
+The full source is on https://github.com/PhilterPaper/Perl-PDF-Builder.
+
+The release distribution is on CPAN: https://metacpan.org/pod/PDF::Builder.
-Bug reports are on https://github.com/PhilterPaper/Perl-PDF-Builder/issues?q=is%3Aissue+sort%3Aupdated-desc (with "bug" label), feature requests have an "enhancement" label, and general discussions (architecture, roadmap, etc.) have a "general discussion" label. Please do not use the RT.cpan system to report issues, as it is not regularly monitored.
+Bug reports are on https://github.com/PhilterPaper/Perl-PDF-Builder/issues?q=is%3Aissue+sort%3Aupdated-desc (with "bug" label), feature requests have an "enhancement" label, and general discussions (architecture, roadmap, etc.) have a "general discussion" label.
-Release distribution is on CPAN: https://metacpan.org/pod/PDF::Builder
+Do B<not> under I<any> circumstances open a PR (Pull Request) to report a bug. It is a waste of both your and our time and effort. Open a regular ticket (issue), and attach a Perl (.pl) program illustrating the problem, if possible. If you believe that you have a program patch, and offer to share it as a PR, we may give the go-ahead. Unsolicited PRs may be closed without further action.
=head1 LICENSE
@@ -306,17 +312,17 @@ sub new {
$self->preferences(%options);
if (defined $options{'-outver'}) {
if ($options{'-outver'} >= 1.4) {
- $self->{'pdf'}->{' version'} = $outVer = $options{'-outver'};
- } else {
- print STDERR "Invalid -outver given, or less than 1.4. Ignored.\n";
- }
+ $self->{'pdf'}->{' version'} = $outVer = $options{'-outver'};
+ } else {
+ print STDERR "Invalid -outver given, or less than 1.4. Ignored.\n";
+ }
}
if (defined $options{'-msgver'}) {
- if ($options{'-msgver'} == 0 || $options{'-msgver'} == 1) {
+ if ($options{'-msgver'} == 0 || $options{'-msgver'} == 1) {
$msgVer = $options{'-msgver'};
- } else {
- print STDERR "Invalid -msgver given, not 0 or 1. Ignored.\n";
- }
+ } else {
+ print STDERR "Invalid -msgver given, not 0 or 1. Ignored.\n";
+ }
}
if ($options{'-file'}) {
$self->{'pdf'}->create_file($options{'-file'});
@@ -546,7 +552,7 @@ sub open_scalar {
if (exists $options{'-diaglevel'}) {
$self->{'diaglevel'} = $options{'-diaglevel'};
if ($self->{'diaglevel'} < 0 || $self->{'diaglevel'} > 5) {
- $self->{'diaglevel'} = 2;
+ $self->{'diaglevel'} = 2;
}
} else {
$self->{'diaglevel'} = 2;
@@ -2191,12 +2197,12 @@ sub image_tiff {
if ($rc == 1) {
# Graphics::TIFF (_GT suffix) available and to be used
require PDF::Builder::Resource::XObject::Image::TIFF_GT;
- $obj = PDF::Builder::Resource::XObject::Image::TIFF_GT->new($self->{'pdf'}, $file);
+ $obj = PDF::Builder::Resource::XObject::Image::TIFF_GT->new($self->{'pdf'}, $file, 'Ix'.pdfkey(), %opts);
$self->{'pdf'}->out_obj($self->{'pages'});
} else {
# Graphics::TIFF not available, or is but is not to be used
require PDF::Builder::Resource::XObject::Image::TIFF;
- $obj = PDF::Builder::Resource::XObject::Image::TIFF->new($self->{'pdf'}, $file);
+ $obj = PDF::Builder::Resource::XObject::Image::TIFF->new($self->{'pdf'}, $file, 'Ix'.pdfkey(), %opts);
$self->{'pdf'}->out_obj($self->{'pages'});
if ($rc == 0 && $MSG_COUNT[0]++ == 0) {
@@ -2241,6 +2247,10 @@ sub LA_GT {
1;
};
if (!defined $rc) { $rc = 0; } # else is 1
+ if ($rc) {
+ # installed, but not up to date?
+ if ($Graphics::TIFF::VERSION < $GrTFversion) { $rc = 0; }
+ }
return $rc;
}
@@ -2348,6 +2358,10 @@ sub LA_IPL {
1;
};
if (!defined $rc) { $rc = 0; } # else is 1
+ if ($rc) {
+ # installed, but not up to date?
+ if ($Image::PNG::Libpng::VERSION < $LpngVersion) { $rc = 0; }
+ }
return $rc;
}
diff --git a/lib/PDF/Builder/Annotation.pm b/lib/PDF/Builder/Annotation.pm
index b91aeff..da020f9 100644
--- a/lib/PDF/Builder/Annotation.pm
+++ b/lib/PDF/Builder/Annotation.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Basic::PDF::Dict';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
diff --git a/lib/PDF/Builder/Basic/PDF.pm b/lib/PDF/Builder/Basic/PDF.pm
index 860ae13..1414910 100644
--- a/lib/PDF/Builder/Basic/PDF.pm
+++ b/lib/PDF/Builder/Basic/PDF.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Basic::PDF;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Array.pm b/lib/PDF/Builder/Basic/PDF/Array.pm
index c69e367..d9eca76 100644
--- a/lib/PDF/Builder/Basic/PDF/Array.pm
+++ b/lib/PDF/Builder/Basic/PDF/Array.pm
@@ -17,7 +17,7 @@ use base 'PDF::Builder::Basic::PDF::Objind';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Bool.pm b/lib/PDF/Builder/Basic/PDF/Bool.pm
index dd5bfd7..8821f08 100644
--- a/lib/PDF/Builder/Basic/PDF/Bool.pm
+++ b/lib/PDF/Builder/Basic/PDF/Bool.pm
@@ -17,7 +17,7 @@ use base 'PDF::Builder::Basic::PDF::String';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Dict.pm b/lib/PDF/Builder/Basic/PDF/Dict.pm
index e6df77d..f10d3b0 100644
--- a/lib/PDF/Builder/Basic/PDF/Dict.pm
+++ b/lib/PDF/Builder/Basic/PDF/Dict.pm
@@ -15,10 +15,11 @@ package PDF::Builder::Basic::PDF::Dict;
use base 'PDF::Builder::Basic::PDF::Objind';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
our $mincache = 16 * 1024 * 1024;
diff --git a/lib/PDF/Builder/Basic/PDF/File.pm b/lib/PDF/Builder/Basic/PDF/File.pm
index d43d3d3..204e189 100644
--- a/lib/PDF/Builder/Basic/PDF/File.pm
+++ b/lib/PDF/Builder/Basic/PDF/File.pm
@@ -15,10 +15,11 @@
package PDF::Builder::Basic::PDF::File;
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
=head1 NAME
@@ -419,7 +420,7 @@ sub out_file {
=head2 $p->create_file($fname)
Creates a new output file (no check is made of an existing open file) of
-the given filename or IO object. Note, make sure that C<< $p->{' version'} >>
+the given filename or IO object. Note: make sure that C<< $p->{' version'} >>
is set correctly before calling this function.
=cut
@@ -469,7 +470,7 @@ sub close_file {
$tdict->{'Size'} = $self->{'Size'} || PDFNum(1);
$tdict->{'Prev'} = PDFNum($self->{' loc'}) if $self->{' loc'};
if ($self->{' update'}) {
- foreach my $key (grep ($_ !~ m/^[\s\-]/, keys %$self)) { ## no critic
+ foreach my $key (grep { $_ !~ m/^[\s\-]/ } keys %$self) {
$tdict->{$key} = $self->{$key} unless defined $tdict->{$key};
}
@@ -936,8 +937,8 @@ sub remove_obj {
delete $self->{' objects'}{$objind->uid()};
delete $self->{' outlist_cache'}{$objind};
delete $self->{' printed_cache'}{$objind};
- @{$self->{' outlist'}} = grep($_ ne $objind, @{$self->{' outlist'}}); ## no critic
- @{$self->{' printed'}} = grep($_ ne $objind, @{$self->{' printed'}}); ## no critic
+ @{$self->{' outlist'}} = grep { $_ ne $objind } @{$self->{' outlist'}};
+ @{$self->{' printed'}} = grep { $_ ne $objind } @{$self->{' printed'}};
$self->{' objcache'}{$objind->{' objnum'}, $objind->{' objgen'}} = undef
if $self->{' objcache'}{$objind->{' objnum'}, $objind->{' objgen'}} eq $objind;
@@ -1268,8 +1269,9 @@ sub readxrtr {
my $entry_size = 20;
# test read first entry, see if $cr in expected place, adjust size
$fh->read($buf, $entry_size * 1 - $xdiff + 15, $xdiff);
- $buf =~ m/^(.*?)$cr/;
- $entry_size = length($1) + 2;
+ if ($buf =~ m/^(.*?)$cr/) {
+ $entry_size = length($1) + 2;
+ }
if ($entry_size != 20 && $options{'-diags'} == 1) {
warn "Xref entries supposed to be 20 bytes long, are $entry_size.\n";
}
diff --git a/lib/PDF/Builder/Basic/PDF/Filter.pm b/lib/PDF/Builder/Basic/PDF/Filter.pm
index 42b343c..c3940fc 100644
--- a/lib/PDF/Builder/Basic/PDF/Filter.pm
+++ b/lib/PDF/Builder/Basic/PDF/Filter.pm
@@ -15,7 +15,7 @@ package PDF::Builder::Basic::PDF::Filter;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Filter::ASCII85Decode;
diff --git a/lib/PDF/Builder/Basic/PDF/Filter/ASCII85Decode.pm b/lib/PDF/Builder/Basic/PDF/Filter/ASCII85Decode.pm
index a2fe517..fafb050 100644
--- a/lib/PDF/Builder/Basic/PDF/Filter/ASCII85Decode.pm
+++ b/lib/PDF/Builder/Basic/PDF/Filter/ASCII85Decode.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Basic::PDF::Filter';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Filter/ASCIIHexDecode.pm b/lib/PDF/Builder/Basic/PDF/Filter/ASCIIHexDecode.pm
index 091683e..ece0aed 100644
--- a/lib/PDF/Builder/Basic/PDF/Filter/ASCIIHexDecode.pm
+++ b/lib/PDF/Builder/Basic/PDF/Filter/ASCIIHexDecode.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Basic::PDF::Filter';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Filter/FlateDecode.pm b/lib/PDF/Builder/Basic/PDF/Filter/FlateDecode.pm
index ac869e5..04233fc 100644
--- a/lib/PDF/Builder/Basic/PDF/Filter/FlateDecode.pm
+++ b/lib/PDF/Builder/Basic/PDF/Filter/FlateDecode.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Basic::PDF::Filter';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
use POSIX qw(ceil floor);
diff --git a/lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm b/lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm
index 161d6e3..1819561 100644
--- a/lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm
+++ b/lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Basic::PDF::Filter::LZWDecode;
use base 'PDF::Builder::Basic::PDF::Filter::FlateDecode';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Filter/RunLengthDecode.pm b/lib/PDF/Builder/Basic/PDF/Filter/RunLengthDecode.pm
index cecb90a..f7cd365 100644
--- a/lib/PDF/Builder/Basic/PDF/Filter/RunLengthDecode.pm
+++ b/lib/PDF/Builder/Basic/PDF/Filter/RunLengthDecode.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Basic::PDF::Filter';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Literal.pm b/lib/PDF/Builder/Basic/PDF/Literal.pm
index 14ddb14..5c76c12 100644
--- a/lib/PDF/Builder/Basic/PDF/Literal.pm
+++ b/lib/PDF/Builder/Basic/PDF/Literal.pm
@@ -4,15 +4,16 @@ package PDF::Builder::Basic::PDF::Literal;
use base 'PDF::Builder::Basic::PDF::Objind';
use strict;
+use warnings;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Filter;
use PDF::Builder::Basic::PDF::Name;
use Scalar::Util qw(blessed);
-no warnings qw[ deprecated recursion uninitialized ];
+#no warnings qw[ deprecated recursion uninitialized ];
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Name.pm b/lib/PDF/Builder/Basic/PDF/Name.pm
index 968502c..74a7181 100644
--- a/lib/PDF/Builder/Basic/PDF/Name.pm
+++ b/lib/PDF/Builder/Basic/PDF/Name.pm
@@ -17,7 +17,7 @@ use base 'PDF::Builder::Basic::PDF::String';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.011'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Null.pm b/lib/PDF/Builder/Basic/PDF/Null.pm
index 359f541..9f995c2 100644
--- a/lib/PDF/Builder/Basic/PDF/Null.pm
+++ b/lib/PDF/Builder/Basic/PDF/Null.pm
@@ -17,7 +17,7 @@ use base 'PDF::Builder::Basic::PDF::Objind';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Number.pm b/lib/PDF/Builder/Basic/PDF/Number.pm
index e93a4ce..7af8bd8 100644
--- a/lib/PDF/Builder/Basic/PDF/Number.pm
+++ b/lib/PDF/Builder/Basic/PDF/Number.pm
@@ -17,7 +17,7 @@ use base 'PDF::Builder::Basic::PDF::String';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Objind.pm b/lib/PDF/Builder/Basic/PDF/Objind.pm
index 96be9a2..67af585 100644
--- a/lib/PDF/Builder/Basic/PDF/Objind.pm
+++ b/lib/PDF/Builder/Basic/PDF/Objind.pm
@@ -16,7 +16,7 @@ use strict;
use warnings;
use Scalar::Util 'isweak';
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Page.pm b/lib/PDF/Builder/Basic/PDF/Page.pm
index 216f09a..33b303f 100644
--- a/lib/PDF/Builder/Basic/PDF/Page.pm
+++ b/lib/PDF/Builder/Basic/PDF/Page.pm
@@ -17,7 +17,7 @@ use base 'PDF::Builder::Basic::PDF::Pages';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Dict;
diff --git a/lib/PDF/Builder/Basic/PDF/Pages.pm b/lib/PDF/Builder/Basic/PDF/Pages.pm
index ee40996..22a30f4 100644
--- a/lib/PDF/Builder/Basic/PDF/Pages.pm
+++ b/lib/PDF/Builder/Basic/PDF/Pages.pm
@@ -17,7 +17,7 @@ use warnings;
use base 'PDF::Builder::Basic::PDF::Dict';
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Array;
diff --git a/lib/PDF/Builder/Basic/PDF/String.pm b/lib/PDF/Builder/Basic/PDF/String.pm
index 3c723b0..2d1d2f1 100644
--- a/lib/PDF/Builder/Basic/PDF/String.pm
+++ b/lib/PDF/Builder/Basic/PDF/String.pm
@@ -17,7 +17,7 @@ use base 'PDF::Builder::Basic::PDF::Objind';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Basic/PDF/Utils.pm b/lib/PDF/Builder/Basic/PDF/Utils.pm
index 7021cfb..2d99589 100644
--- a/lib/PDF/Builder/Basic/PDF/Utils.pm
+++ b/lib/PDF/Builder/Basic/PDF/Utils.pm
@@ -15,7 +15,7 @@ package PDF::Builder::Basic::PDF::Utils;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Content.pm b/lib/PDF/Builder/Content.pm
index db4a53a..d9f9971 100644
--- a/lib/PDF/Builder/Content.pm
+++ b/lib/PDF/Builder/Content.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Content;
use base 'PDF::Builder::Basic::PDF::Dict';
use strict;
-no warnings qw( deprecated recursion uninitialized );
+use warnings;
+#no warnings qw( deprecated recursion uninitialized );
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Carp;
use Compress::Zlib qw();
diff --git a/lib/PDF/Builder/Content/Hyphenate_basic.pm b/lib/PDF/Builder/Content/Hyphenate_basic.pm
index 1c9ff9b..65728f5 100644
--- a/lib/PDF/Builder/Content/Hyphenate_basic.pm
+++ b/lib/PDF/Builder/Content/Hyphenate_basic.pm
@@ -5,8 +5,8 @@ use base 'PDF::Builder::Content::Text';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
=head1 NAME
@@ -36,7 +36,7 @@ word-splitting rules, as well as worrying about the appearance of the results
sub splitWord {
my ($self, $word, $width, %opts) = @_;
- my ($leftWord, $rightWord, @splitLoc, @chars, $i, $j, $len, $ptLen);
+ my ($leftWord, $rightWord, @splitLoc, @chars, $i, $j, $len);
# various settings, some of which may be language-specific
my $minBegin = 2; # minimum 2 characters before split
diff --git a/lib/PDF/Builder/Content/Text.pm b/lib/PDF/Builder/Content/Text.pm
index 019da69..1e6eafc 100644
--- a/lib/PDF/Builder/Content/Text.pm
+++ b/lib/PDF/Builder/Content/Text.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Content';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Docs.pm b/lib/PDF/Builder/Docs.pm
index e247a94..bfccc4f 100644
--- a/lib/PDF/Builder/Docs.pm
+++ b/lib/PDF/Builder/Docs.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Docs;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
# originally part of Builder.pm, it was split out due to its length
diff --git a/lib/PDF/Builder/Lite.pm b/lib/PDF/Builder/Lite.pm
index 530f8f7..be42c0d 100644
--- a/lib/PDF/Builder/Lite.pm
+++ b/lib/PDF/Builder/Lite.pm
@@ -1,10 +1,13 @@
package PDF::Builder::Lite;
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
+# NOTE that this sub-package has not been tested and is not well documented!
+# It is possible that it will be deprecated and removed.
BEGIN {
diff --git a/lib/PDF/Builder/Matrix.pm b/lib/PDF/Builder/Matrix.pm
index 7c8a199..06e5af0 100644
--- a/lib/PDF/Builder/Matrix.pm
+++ b/lib/PDF/Builder/Matrix.pm
@@ -13,7 +13,7 @@ use strict;
use warnings;
use Carp;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/NamedDestination.pm b/lib/PDF/Builder/NamedDestination.pm
index 7097a2b..6c3ceef 100644
--- a/lib/PDF/Builder/NamedDestination.pm
+++ b/lib/PDF/Builder/NamedDestination.pm
@@ -3,10 +3,11 @@ package PDF::Builder::NamedDestination;
use base 'PDF::Builder::Basic::PDF::Dict';
use strict;
-no warnings qw[ recursion uninitialized ];
+use warnings;
+#no warnings qw[ recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
# TBD: do -rect and -border apply to Named Destinations (link, url, file)?
# There is nothing to implement these options. Perhaps the code was copied
diff --git a/lib/PDF/Builder/Outline.pm b/lib/PDF/Builder/Outline.pm
index e080cb0..5543a7a 100644
--- a/lib/PDF/Builder/Outline.pm
+++ b/lib/PDF/Builder/Outline.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Basic::PDF::Dict';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
use Carp qw(croak);
diff --git a/lib/PDF/Builder/Outlines.pm b/lib/PDF/Builder/Outlines.pm
index 169dbc6..02ddee7 100644
--- a/lib/PDF/Builder/Outlines.pm
+++ b/lib/PDF/Builder/Outlines.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Outline';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
diff --git a/lib/PDF/Builder/Page.pm b/lib/PDF/Builder/Page.pm
index 89f4aab..13e5483 100644
--- a/lib/PDF/Builder/Page.pm
+++ b/lib/PDF/Builder/Page.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Basic::PDF::Pages';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
use POSIX qw(floor);
diff --git a/lib/PDF/Builder/Resource.pm b/lib/PDF/Builder/Resource.pm
index a89c0d7..8e38f36 100644
--- a/lib/PDF/Builder/Resource.pm
+++ b/lib/PDF/Builder/Resource.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Basic::PDF::Dict';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
use PDF::Builder::Util qw(pdfkey);
diff --git a/lib/PDF/Builder/Resource/BaseFont.pm b/lib/PDF/Builder/Resource/BaseFont.pm
index 0b0fb87..fab924a 100644
--- a/lib/PDF/Builder/Resource/BaseFont.pm
+++ b/lib/PDF/Builder/Resource/BaseFont.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
use Compress::Zlib;
diff --git a/lib/PDF/Builder/Resource/CIDFont.pm b/lib/PDF/Builder/Resource/CIDFont.pm
index 84c517c..651ea60 100644
--- a/lib/PDF/Builder/Resource/CIDFont.pm
+++ b/lib/PDF/Builder/Resource/CIDFont.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::CIDFont;
use base 'PDF::Builder::Resource::BaseFont';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Encode qw(:all);
@@ -69,6 +70,8 @@ sub uniByCId {
return $uni;
}
+# note that cidByUni has been seen returning 'undef' in some cases. be sure
+# to handle this!
sub cidByUni {
return $_[0]->data()->{'u2g'}->{$_[1]};
}
@@ -175,7 +178,7 @@ Returns the CID-encoded string from utf8-string.
sub cidsByUtf {
my ($self, $s) = @_;
- $s = pack('n*', map { $self->cidByUni($_) } (map { $_>0x7f && $_<0xA0? uniByName(nameByUni($_)): $_ } unpack('U*', $s)));
+ $s = pack('n*', map { $self->cidByUni($_)||0 } (map { $_>0x7f && $_<0xA0? uniByName(nameByUni($_)): $_ } unpack('U*', $s)));
utf8::downgrade($s);
return $s;
}
diff --git a/lib/PDF/Builder/Resource/CIDFont/CJKFont.pm b/lib/PDF/Builder/Resource/CIDFont/CJKFont.pm
index bac04a1..eab17a5 100644
--- a/lib/PDF/Builder/Resource/CIDFont/CJKFont.pm
+++ b/lib/PDF/Builder/Resource/CIDFont/CJKFont.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::CIDFont::CJKFont;
use base 'PDF::Builder::Resource::CIDFont';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Util;
use PDF::Builder::Basic::PDF::Utils;
@@ -104,7 +105,7 @@ sub new {
$data->{'g2u'} = [ @{$cmap->{'g2u'}} ];
$class = ref $class if ref $class;
- my $self = $class->SUPER::new($pdf, $data->{'apiname'}.pdfkey());
+ my $self = $class->SUPER::new($pdf, (defined($data->{'apiname'})? $data->{'apiname'}: '').pdfkey());
$pdf->new_obj($self) if defined($pdf) && !$self->is_obj($pdf);
$self->{' data'} = $data;
diff --git a/lib/PDF/Builder/Resource/CIDFont/TrueType.pm b/lib/PDF/Builder/Resource/CIDFont/TrueType.pm
index 891911f..501858a 100644
--- a/lib/PDF/Builder/Resource/CIDFont/TrueType.pm
+++ b/lib/PDF/Builder/Resource/CIDFont/TrueType.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::CIDFont::TrueType;
use base 'PDF::Builder::Resource::CIDFont';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Resource::CIDFont::TrueType::FontFile;
@@ -61,7 +62,7 @@ sub new {
## $de->{'BaseFont'} = PDFName(pdfkey().'+'.($self->fontname()).'~'.time());
$de->{'BaseFont'} = PDFName($self->fontname());
$de->{'DW'} = PDFNum($self->missingwidth());
- if ($opts{'-noembed'} != 1) {
+ if (($opts{'-noembed'}||0) != 1) {
$des->{$self->data()->{'iscff'}? 'FontFile3': 'FontFile2'} = $ff;
}
unless ($self->issymbol()) {
diff --git a/lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm b/lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm
index efa242a..8908e29 100644
--- a/lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm
+++ b/lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::CIDFont::TrueType::FontFile;
use base 'PDF::Builder::Basic::PDF::Dict';
use strict;
-no warnings qw[ recursion uninitialized ];
+use warnings;
+#no warnings qw[ recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Carp;
use Encode qw(:all);
@@ -339,7 +340,7 @@ sub new {
$self->{' font'} = $font;
$self->{' data'} = $data;
- $data->{'noembed'} = $opts{'-noembed'}==1? 1: 0;
+ $data->{'noembed'} = ($opts{'-noembed'}||0)==1? 1: 0;
$data->{'iscff'} = (defined $font->{'CFF '})? 1: 0;
$self->{'Subtype'} = PDFName('CIDFontType0C') if $data->{'iscff'};
diff --git a/lib/PDF/Builder/Resource/ColorSpace.pm b/lib/PDF/Builder/Resource/ColorSpace.pm
index 5d5fd26..92fcd9d 100644
--- a/lib/PDF/Builder/Resource/ColorSpace.pm
+++ b/lib/PDF/Builder/Resource/ColorSpace.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::ColorSpace;
use base 'PDF::Builder::Basic::PDF::Array';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Util;
diff --git a/lib/PDF/Builder/Resource/ColorSpace/DeviceN.pm b/lib/PDF/Builder/Resource/ColorSpace/DeviceN.pm
index 3450481..4bec92b 100644
--- a/lib/PDF/Builder/Resource/ColorSpace/DeviceN.pm
+++ b/lib/PDF/Builder/Resource/ColorSpace/DeviceN.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::ColorSpace::DeviceN;
use base 'PDF::Builder::Resource::ColorSpace';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Util;
@@ -22,6 +23,8 @@ CMYK. Inherits from L<PDF::Builder::Resource::ColorSpace>
sub new {
my ($class, $pdf, $key, @opts) = @_;
+ # this is a bit odd, but the only use of ->new() has two values, $clrs
+ # and $sampled, in the argument list
my ($clrs, $sampled) = @opts;
$sampled = 2;
diff --git a/lib/PDF/Builder/Resource/ColorSpace/Indexed.pm b/lib/PDF/Builder/Resource/ColorSpace/Indexed.pm
index 4a17938..0b5a73f 100644
--- a/lib/PDF/Builder/Resource/ColorSpace/Indexed.pm
+++ b/lib/PDF/Builder/Resource/ColorSpace/Indexed.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::ColorSpace::Indexed;
use base 'PDF::Builder::Resource::ColorSpace';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.004'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Util;
diff --git a/lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile.pm b/lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile.pm
index bef9268..57ea68b 100644
--- a/lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile.pm
+++ b/lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::ColorSpace::Indexed::ACTFile;
use base 'PDF::Builder::Resource::ColorSpace::Indexed';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.004'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Util;
diff --git a/lib/PDF/Builder/Resource/ColorSpace/Indexed/Hue.pm b/lib/PDF/Builder/Resource/ColorSpace/Indexed/Hue.pm
index 4ca5a56..33b7df3 100644
--- a/lib/PDF/Builder/Resource/ColorSpace/Indexed/Hue.pm
+++ b/lib/PDF/Builder/Resource/ColorSpace/Indexed/Hue.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::ColorSpace::Indexed::Hue;
use base 'PDF::Builder::Resource::ColorSpace::Indexed';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.004'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Util;
diff --git a/lib/PDF/Builder/Resource/ColorSpace/Indexed/WebColor.pm b/lib/PDF/Builder/Resource/ColorSpace/Indexed/WebColor.pm
index d15ff89..ba42736 100644
--- a/lib/PDF/Builder/Resource/ColorSpace/Indexed/WebColor.pm
+++ b/lib/PDF/Builder/Resource/ColorSpace/Indexed/WebColor.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::ColorSpace::Indexed::WebColor;
use base 'PDF::Builder::Resource::ColorSpace::Indexed';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.004'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/ColorSpace/Separation.pm b/lib/PDF/Builder/Resource/ColorSpace/Separation.pm
index 2fc051e..4b5d3b7 100644
--- a/lib/PDF/Builder/Resource/ColorSpace/Separation.pm
+++ b/lib/PDF/Builder/Resource/ColorSpace/Separation.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::ColorSpace::Separation;
use base 'PDF::Builder::Resource::ColorSpace';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.004'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Util;
diff --git a/lib/PDF/Builder/Resource/Colors.pm b/lib/PDF/Builder/Resource/Colors.pm
index 3032568..61517c8 100644
--- a/lib/PDF/Builder/Resource/Colors.pm
+++ b/lib/PDF/Builder/Resource/Colors.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Colors;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/ExtGState.pm b/lib/PDF/Builder/Resource/ExtGState.pm
index fbccf33..b24dc32 100644
--- a/lib/PDF/Builder/Resource/ExtGState.pm
+++ b/lib/PDF/Builder/Resource/ExtGState.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::ExtGState;
use base 'PDF::Builder::Resource';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Util;
diff --git a/lib/PDF/Builder/Resource/Font.pm b/lib/PDF/Builder/Resource/Font.pm
index 1f9e413..6af62a9 100644
--- a/lib/PDF/Builder/Resource/Font.pm
+++ b/lib/PDF/Builder/Resource/Font.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::Font;
use base 'PDF::Builder::Resource::BaseFont';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.006'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Encode qw(:all);
@@ -24,9 +25,7 @@ sub encodeByData {
my $data = $self->data();
- my ($firstChar, $lastChar);
-
- if ($self->issymbol() || $encoding eq 'asis') {
+ if ($self->issymbol() || ($encoding||'') eq 'asis') {
$encoding = undef;
}
diff --git a/lib/PDF/Builder/Resource/Font/BdFont.pm b/lib/PDF/Builder/Resource/Font/BdFont.pm
index 492bb7b..d13a8ba 100644
--- a/lib/PDF/Builder/Resource/Font/BdFont.pm
+++ b/lib/PDF/Builder/Resource/Font/BdFont.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::Font::BdFont;
use base 'PDF::Builder::Resource::Font';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Util;
use PDF::Builder::Basic::PDF::Utils;
@@ -144,7 +145,8 @@ sub new {
$self->{'Resources'} = PDFDict();
$self->{'Resources'}->{'ProcSet'} = PDFArray(map { PDFName($_) } qw(PDF Text ImageB ImageC ImageI));
foreach my $w ($first .. $last) {
- $self->data()->{'uni'}->[$w] = uniByName($self->data()->{'char'}->[$w]);
+ # if not a standard glyph name, use $w as the value
+ $self->data()->{'uni'}->[$w] = (uniByName($self->data()->{'char'}->[$w]))||$w;
$self->data()->{'u2e'}->{$self->data()->{'uni'}->[$w]} = $w;
}
my @widths = ();
@@ -298,9 +300,12 @@ sub new {
sub readBDF {
my ($self, $file) = @_;
my $data = {};
- $data->{'char'} = [];
- $data->{'char2'} = [];
- $data->{'wx'} = {};
+ $data->{'char'} = []; # ENCODING is NAME from char2
+ $data->{'char2'} = []; # NAME from STARTCHAR record, E_encoding# default
+ # hex from BITMAP records as one long string,
+ # can be empty (such as space x20)
+ # BBX arrayref from BBX record
+ $data->{'wx'} = {}; # width (by name) from char2 SWIDTH record
if (! -e $file) {
die "BDF file='$file' not found.";
@@ -310,28 +315,39 @@ sub readBDF {
while ($_ = <$afmf>) {
chomp($_);
if (/^STARTCHAR/ .. /^ENDCHAR/) {
- if (/^STARTCHAR\s+(\S+)/) {
+ if (/^STARTCHAR\s+(\S+)/) { # start of one glyph
my $name = $1;
$name =~ s|^(\d+.*)$|X_$1|;
push @{$data->{'char2'}}, {'NAME' => $name};
- } elsif (/^BITMAP/ .. /^ENDCHAR/) {
+ } elsif (/^BITMAP/ .. /^ENDCHAR/) { # bitmap itself
next if(/^BITMAP/);
- if (/^ENDCHAR/) {
+ if (/^ENDCHAR/) { # done reading, finalize
+ # fallback NAME is E_<encoding #>
$data->{'char2'}->[-1]->{'NAME'} ||= 'E_'.$data->{'char2'}->[-1]->{'ENCODING'};
- $data->{'char'}->[$data->{'char2'}->[-1]->{'ENCODING'}] = $data->{'char2'}->[-1]->{'NAME'};
- ($data->{'wx'}->{$data->{'char2'}->[-1]->{'NAME'}}) = split(/\s+/, $data->{'char2'}->[-1]->{'SWIDTH'});
+ my $charName = $data->{'char2'}->[-1]->{'NAME'};
+ # char ENCODING is char2's NAME
+ $data->{'char'}->[$data->{'char2'}->[-1]->{'ENCODING'}] = $charName;
+ # width (2 element vector) from char2 SWIDTH
+ ($data->{'wx'}->{$charName}) = split(/\s+/, $data->{'char2'}->[-1]->{'SWIDTH'});
+ # bounding box (4 element vector) from char2 BBX
$data->{'char2'}->[-1]->{'BBX'} = [split(/\s+/, $data->{'char2'}->[-1]->{'BBX'})];
- } else {
+ } else { # the bitmap data record appended
$data->{'char2'}->[-1]->{'hex'} .= $_;
}
} else {
- m|^(\S+)\s+(.+)$|;
- $data->{'char2'}->[-1]->{uc($1)} .= $2;
+ # a few fields (records) here, just grab <name> <value> pairs
+ if (m|^(\S+)\s+(.+)$|) {
+ $data->{'char2'}->[-1]->{uc($1)} .= $2;
+ }
}
- ## } elsif (/^STARTPROPERTIES/ .. /^ENDPROPERTIES/) {
+ ## } elsif (/^STARTPROPERTIES/ .. /^ENDPROPERTIES/) { not implemented
} else {
- m|^(\S+)\s+(.+)$|;
- $data->{uc($1)} .= $2;
+ # all sorts of random stuff here, STARTFONT, START/END
+ # PROPERTIES, etc. just grab anything that looks like a
+ # <name> <value> record
+ if (m|^(\S+)\s+(.+)$|) {
+ $data->{uc($1)} .= $2;
+ }
}
}
close($afmf);
@@ -382,7 +398,7 @@ sub readBDF {
$data->{'underlineposition'} = -200;
$data->{'underlinethickness'} = 10;
$data->{'xheight'} = $data->{'RAW_XHEIGHT'}
- || int($data->{'FONT_XHEIGHT'} * 1000 / $data->{'upm'})
+ || int(($data->{'FONT_XHEIGHT'}||0) * 1000 / $data->{'upm'})
|| int($data->{'ascender'} / 2);
$data->{'firstchar'} = 0;
$data->{'lastchar'} = 255;
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont.pm b/lib/PDF/Builder/Resource/Font/CoreFont.pm
index 676b676..d8b1ecf 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::Font::CoreFont;
use base 'PDF::Builder::Resource::Font';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use File::Basename;
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/bankgothic.pm b/lib/PDF/Builder/Resource/Font/CoreFont/bankgothic.pm
index a57bb8d..b6a3604 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/bankgothic.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/bankgothic.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::bankgothic;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.013'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/courier.pm b/lib/PDF/Builder/Resource/Font/CoreFont/courier.pm
index 04adeb9..c7a7e80 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/courier.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/courier.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::courier;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/courierbold.pm b/lib/PDF/Builder/Resource/Font/CoreFont/courierbold.pm
index 8af3cf0..ca11bdd 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/courierbold.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/courierbold.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::courierbold;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/courierboldoblique.pm b/lib/PDF/Builder/Resource/Font/CoreFont/courierboldoblique.pm
index 88245e7..923720d 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/courierboldoblique.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/courierboldoblique.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::courierboldoblique;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/courieroblique.pm b/lib/PDF/Builder/Resource/Font/CoreFont/courieroblique.pm
index b84076e..80d76f7 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/courieroblique.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/courieroblique.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::courieroblique;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/georgia.pm b/lib/PDF/Builder/Resource/Font/CoreFont/georgia.pm
index 5c7129b..0cb4d49 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/georgia.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/georgia.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::georgia;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/georgiabold.pm b/lib/PDF/Builder/Resource/Font/CoreFont/georgiabold.pm
index 4fbb1b2..28541eb 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/georgiabold.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/georgiabold.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::georgiabold;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/georgiabolditalic.pm b/lib/PDF/Builder/Resource/Font/CoreFont/georgiabolditalic.pm
index ac79f7a..30c519c 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/georgiabolditalic.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/georgiabolditalic.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::georgiabolditalic;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/georgiaitalic.pm b/lib/PDF/Builder/Resource/Font/CoreFont/georgiaitalic.pm
index 495ba35..cd73100 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/georgiaitalic.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/georgiaitalic.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::georgiaitalic;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/helvetica.pm b/lib/PDF/Builder/Resource/Font/CoreFont/helvetica.pm
index 9462a0a..358e3f4 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/helvetica.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/helvetica.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::helvetica;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/helveticabold.pm b/lib/PDF/Builder/Resource/Font/CoreFont/helveticabold.pm
index e4161cc..f371cfd 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/helveticabold.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/helveticabold.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::helveticabold;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/helveticaboldoblique.pm b/lib/PDF/Builder/Resource/Font/CoreFont/helveticaboldoblique.pm
index 0f83d7c..c75d3e2 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/helveticaboldoblique.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/helveticaboldoblique.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::helveticaboldoblique;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/helveticaoblique.pm b/lib/PDF/Builder/Resource/Font/CoreFont/helveticaoblique.pm
index 656caf5..bf98948 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/helveticaoblique.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/helveticaoblique.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::helveticaoblique;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/symbol.pm b/lib/PDF/Builder/Resource/Font/CoreFont/symbol.pm
index 0a76dcb..2c04023 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/symbol.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/symbol.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::symbol;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/timesbold.pm b/lib/PDF/Builder/Resource/Font/CoreFont/timesbold.pm
index 97680ee..1436352 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/timesbold.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/timesbold.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::timesbold;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/timesbolditalic.pm b/lib/PDF/Builder/Resource/Font/CoreFont/timesbolditalic.pm
index a8c0ace..ab7d219 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/timesbolditalic.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/timesbolditalic.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::timesbolditalic;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/timesitalic.pm b/lib/PDF/Builder/Resource/Font/CoreFont/timesitalic.pm
index 1958b6a..3164232 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/timesitalic.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/timesitalic.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::timesitalic;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/timesroman.pm b/lib/PDF/Builder/Resource/Font/CoreFont/timesroman.pm
index faebb40..c1dfb5d 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/timesroman.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/timesroman.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::timesroman;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/trebuchet.pm b/lib/PDF/Builder/Resource/Font/CoreFont/trebuchet.pm
index 5201254..0953928 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/trebuchet.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/trebuchet.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::trebuchet;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbold.pm b/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbold.pm
index 35f8c87..13dbc26 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbold.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbold.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::trebuchetbold;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbolditalic.pm b/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbolditalic.pm
index 3bca333..2ac22b9 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbolditalic.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbolditalic.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::trebuchetbolditalic;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetitalic.pm b/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetitalic.pm
index 117126a..134a4f9 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetitalic.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetitalic.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::trebuchetitalic;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/verdana.pm b/lib/PDF/Builder/Resource/Font/CoreFont/verdana.pm
index 3c8a201..ba9e210 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/verdana.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/verdana.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::verdana;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/verdanabold.pm b/lib/PDF/Builder/Resource/Font/CoreFont/verdanabold.pm
index a9dfbc6..51e9547 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/verdanabold.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/verdanabold.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::verdanabold;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/verdanabolditalic.pm b/lib/PDF/Builder/Resource/Font/CoreFont/verdanabolditalic.pm
index 7000199..445ccd1 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/verdanabolditalic.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/verdanabolditalic.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::verdanabolditalic;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/verdanaitalic.pm b/lib/PDF/Builder/Resource/Font/CoreFont/verdanaitalic.pm
index b7b90ce..53f135e 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/verdanaitalic.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/verdanaitalic.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::verdanaitalic;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/webdings.pm b/lib/PDF/Builder/Resource/Font/CoreFont/webdings.pm
index 3f60211..7c79020 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/webdings.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/webdings.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::webdings;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/wingdings.pm b/lib/PDF/Builder/Resource/Font/CoreFont/wingdings.pm
index e4c5641..8e028bc 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/wingdings.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/wingdings.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::wingdings;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/CoreFont/zapfdingbats.pm b/lib/PDF/Builder/Resource/Font/CoreFont/zapfdingbats.pm
index d5aa671..492358c 100644
--- a/lib/PDF/Builder/Resource/Font/CoreFont/zapfdingbats.pm
+++ b/lib/PDF/Builder/Resource/Font/CoreFont/zapfdingbats.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::Font::CoreFont::zapfdingbats;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Font/Postscript.pm b/lib/PDF/Builder/Resource/Font/Postscript.pm
index a355d5d..2dd15fb 100644
--- a/lib/PDF/Builder/Resource/Font/Postscript.pm
+++ b/lib/PDF/Builder/Resource/Font/Postscript.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::Font::Postscript;
use base 'PDF::Builder::Resource::Font';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Encode qw(:all);
use IO::File qw();
@@ -23,8 +24,8 @@ PDF::Builder::Resource::Font::Postscript - support routines for using PostScript
sub new {
my ($class, $pdf, $psfile, %opts) = @_;
- my ($self,$encoding);
- my (@w,$data);
+ my ($self);
+ my ($data);
$opts{'-encode'} ||= 'asis'; # provide default encoding
if (defined $opts{'-afmfile'}) {
@@ -181,7 +182,7 @@ sub readAFM {
$bbox =~ s/\s+$//;
# Should also parse ligature data (format: L successor ligature)
$data->{'avgwidth2'} += $wx ;
- $data->{'maxwidth'} = $data->{'maxwidth'} < $wx? $wx: $data->{'maxwidth'};
+ $data->{'maxwidth'} = ($data->{'maxwidth'}||0) < $wx? $wx: $data->{'maxwidth'}||0;
$data->{'wx'}->{$name} = $wx;
$data->{'bbox'}->{$name} = [split(/\s+/,$bbox)];
if ($ch > 0) {
@@ -430,13 +431,13 @@ sub readPFM {
$data->{'stemv'} = 0;
$data->{'stemh'} = 0;
- $data->{'lastchar'} = $df{'LastChar'};
- $data->{'firstchar'} = $df{'FirstChar'};
+ $data->{'lastchar'} = $df{'LastChar'}||0; # running max
+ $data->{'firstchar'} = $df{'FirstChar'}||255; # running min
$data->{'missingwidth'} = $df{'AvgWidth'};
$data->{'maxwidth'} = $df{'MaxWidth'};
$data->{'ascender'} = $df{'Ascent'};
- $data->{'descender'} =- $df{'LowerCaseDescent'};
+ $data->{'descender'} = -$df{'LowerCaseDescent'};
$data->{'flags'} = 0;
# FixedPitch 1
@@ -462,9 +463,9 @@ sub readPFM {
$data->{'uni'} = [ unpack('U*', decode('cp1252', pack('C*',(0..255)))) ];
$data->{'char'} = [ map { nameByUni($_) || '.notdef' } @{$data->{'uni'}} ];
- $data->{'italicangle'} =- 12*$df{'Italic'};
+ $data->{'italicangle'} = -12*$df{'Italic'};
$data->{'isfixedpitch'} = ($df{'PitchAndFamily'} & 8) || ($df{'PitchAndFamily'} & 1);
- $data->{'underlineposition'} =- $df{'UnderlineOffset'};
+ $data->{'underlineposition'} = -$df{'UnderlineOffset'};
$data->{'underlinethickness'} = $df{'UnderlineWidth'};
seek($fh, $df{'ExtentTable'}, 0);
diff --git a/lib/PDF/Builder/Resource/Font/SynFont.pm b/lib/PDF/Builder/Resource/Font/SynFont.pm
index 758d7a9..e74d16b 100644
--- a/lib/PDF/Builder/Resource/Font/SynFont.pm
+++ b/lib/PDF/Builder/Resource/Font/SynFont.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::Font::SynFont;
use base 'PDF::Builder::Resource::Font';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Math::Trig; # CAUTION: deg2rad(0) = deg2rad(360) = 0!
use Unicode::UCD 'charinfo';
@@ -90,7 +91,7 @@ sub new
{
my ($class, $pdf, $font, @opts) = @_;
- my ($self, $data);
+ my ($self);
my %opts = @opts;
my $first = 1;
my $last = 255;
@@ -111,7 +112,7 @@ sub new
if (defined $opts{'-encode'}) {
if ($opts{'-encode'} =~ m/^utf/i) {
die "Invalid multibyte encoding for synfont: $opts{'-encode'}\n";
- # probably more encodings to check
+ # TBD probably more multibyte encodings to check
}
$font->encodeByName($opts{'-encode'});
}
@@ -171,7 +172,8 @@ sub new
$self->{'Resources'}->{'Font'}->{'FSN'} = $font;
foreach my $w ($first .. $last) {
$self->data()->{'char'}->[$w] = $font->glyphByEnc($w);
- $self->data()->{'uni'}->[$w] = uniByName($self->data()->{'char'}->[$w]);
+ # possible non-standard name... use $w as Unicode value
+ $self->data()->{'uni'}->[$w] = (uniByName($self->data()->{'char'}->[$w]))||$w;
$self->data()->{'u2e'}->{$self->data()->{'uni'}->[$w]} = $w;
}
@@ -319,7 +321,11 @@ sub new
$pdf->new_obj($char);
} # loop through 255 standard encoding points
- $procs->{'.notdef'} = $procs->{$font->data()->{'char'}->[32]};
+# the array as 0 elements at this point! 'space' (among others) IS defined,
+# so copy that, but TBD what kind of fallback if no such element exists?
+# $procs->{'.notdef'} = $procs->{$font->data()->{'char'}->[32]};
+ $procs->{'.notdef'} = $procs->{'space'};
+
$self->{'Widths'} = PDFArray(map { PDFNum($_) } @widths);
$self->data()->{'e2n'} = $self->data()->{'char'};
$self->data()->{'e2u'} = $self->data()->{'uni'};
diff --git a/lib/PDF/Builder/Resource/Glyphs.pm b/lib/PDF/Builder/Resource/Glyphs.pm
index f6e1562..922c12c 100644
--- a/lib/PDF/Builder/Resource/Glyphs.pm
+++ b/lib/PDF/Builder/Resource/Glyphs.pm
@@ -3,8 +3,8 @@ package PDF::Builder::Resource::Glyphs;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.013'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
=head1 NAME
@@ -28,7 +28,8 @@ sub _generate {
die 'uniglyph.txt not found' unless -f $uniglyph_file;
my $fh;
- open $fh, '<', $uniglyph_file;
+ open $fh, '<', $uniglyph_file or
+ die "Can't open input uniglyph file $uniglyph_file";
my $uuu = {};
while (my $line = <$fh>) {
next if $line =~ m|^#|;
diff --git a/lib/PDF/Builder/Resource/PaperSizes.pm b/lib/PDF/Builder/Resource/PaperSizes.pm
index aee0637..02bc6e1 100644
--- a/lib/PDF/Builder/Resource/PaperSizes.pm
+++ b/lib/PDF/Builder/Resource/PaperSizes.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::PaperSizes;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Pattern.pm b/lib/PDF/Builder/Resource/Pattern.pm
index b7dcc56..510bad4 100644
--- a/lib/PDF/Builder/Resource/Pattern.pm
+++ b/lib/PDF/Builder/Resource/Pattern.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.031'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/Shading.pm b/lib/PDF/Builder/Resource/Shading.pm
index f32d607..2b484ce 100644
--- a/lib/PDF/Builder/Resource/Shading.pm
+++ b/lib/PDF/Builder/Resource/Shading.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/UniFont.pm b/lib/PDF/Builder/Resource/UniFont.pm
index 904f930..a66c213 100644
--- a/lib/PDF/Builder/Resource/UniFont.pm
+++ b/lib/PDF/Builder/Resource/UniFont.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::UniFont;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
use Carp;
diff --git a/lib/PDF/Builder/Resource/XObject.pm b/lib/PDF/Builder/Resource/XObject.pm
index a348767..db2693a 100644
--- a/lib/PDF/Builder/Resource/XObject.pm
+++ b/lib/PDF/Builder/Resource/XObject.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.031'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
diff --git a/lib/PDF/Builder/Resource/XObject/Form.pm b/lib/PDF/Builder/Resource/XObject/Form.pm
index ae15c59..04d919c 100644
--- a/lib/PDF/Builder/Resource/XObject/Form.pm
+++ b/lib/PDF/Builder/Resource/XObject/Form.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.031'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm
index 78f5777..9b05e9f 100644
--- a/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm
+++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject::Form::Hybrid';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
use PDF::Builder::Util;
diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm
index d84f5ca..86d1f86 100644
--- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm
+++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '2.029'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm
index a77ff3b..249bedc 100644
--- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm
+++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.004'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm
index bfce92c..79bd45f 100644
--- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm
+++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm
index 49d72cf..2034676 100644
--- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm
+++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.004'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm
index ace41aa..7abd7db 100644
--- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm
+++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.004'; # manually update whenever code is changed
=head1 NAME
diff --git a/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm b/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm
index 4a881ec..42476ad 100644
--- a/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm
+++ b/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm
@@ -5,7 +5,7 @@ use base qw(PDF::Builder::Content PDF::Builder::Content::Text PDF::Builder::Reso
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Dict;
diff --git a/lib/PDF/Builder/Resource/XObject/Image.pm b/lib/PDF/Builder/Resource/XObject/Image.pm
index be9870b..fd610a7 100644
--- a/lib/PDF/Builder/Resource/XObject/Image.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
use PDF::Builder::Basic::PDF::Utils;
diff --git a/lib/PDF/Builder/Resource/XObject/Image/GD.pm b/lib/PDF/Builder/Resource/XObject/Image/GD.pm
index 7faa698..a48df58 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/GD.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/GD.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::XObject::Image::GD;
use base 'PDF::Builder::Resource::XObject::Image';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.004'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use PDF::Builder::Util;
use PDF::Builder::Basic::PDF::Utils;
diff --git a/lib/PDF/Builder/Resource/XObject/Image/GIF.pm b/lib/PDF/Builder/Resource/XObject/Image/GIF.pm
index 64cf9d5..e9f9a79 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/GIF.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/GIF.pm
@@ -3,10 +3,11 @@ package PDF::Builder::Resource::XObject::Image::GIF;
use base 'PDF::Builder::Resource::XObject::Image';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.013'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use IO::File;
use PDF::Builder::Util;
diff --git a/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm b/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm
index 3ff026a..e977b1e 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject::Image';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.017'; # manually update whenever code is changed
use IO::File;
diff --git a/lib/PDF/Builder/Resource/XObject/Image/PNG.pm b/lib/PDF/Builder/Resource/XObject/Image/PNG.pm
index 777d7f9..88bffb1 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/PNG.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/PNG.pm
@@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject::Image';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.019'; # manually update whenever code is changed
use Compress::Zlib;
diff --git a/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm b/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm
index e820cc9..e6b5879 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm
@@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject::Image';
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Compress::Zlib;
use POSIX qw(ceil floor);
@@ -83,11 +83,15 @@ channels to 8bps, permitting use on PDF 1.4 output.
transparency). The Alpha channel is ignored if the -notrans
option is given. The tRNS chunk is not permitted.
+ (5) B<RESERVED> for grayscale via palette + Alpha channel
+
(6) RGB truecolor with 8 or 16 bits per sample, with equal-sized
Alpha channel (256 or 65536 levels of transparency). The Alpha
channel is ignored if the -notrans option is given. The tRNS
chunk is not permitted.
+ (7) B<RESERVED> for truecolor via palette + Alpha channel
+
In all cases, 16 bits per sample forces PDF 1.5 (or higher) output, unless
you give the C<-force8bps> option, to "strip" 16 bit samples to 8 bits, and
permit PDF 1.4-compatible output.
@@ -458,7 +462,7 @@ sub new {
$dict->{' stream'} = '';
$self->{' stream'} = '';
# high-speed splitting out of alpha channel
- my $split = split_alpha($png);
+ my $split = $png->split_alpha();
$self->{' stream'} = $split->{'data'};
$dict->{' stream'} = $split->{'alpha'};
}
@@ -524,7 +528,7 @@ sub new {
$dict->{' stream'} = '';
$self->{' stream'} = '';
# high-speed splitting out of alpha channel
- my $split = split_alpha($png);
+ my $split = $png->split_alpha();
$self->{' stream'} = $split->{'data'};
$dict->{' stream'} = $split->{'alpha'};
}
@@ -582,7 +586,7 @@ need to know in advance.
=cut
sub usesLib {
- my ($self) = shift;
+ my ($self) = @_;
# should be 0 for Image::PNG::Libpng not installed, or -1 for is installed,
# but not using it
return $self->{'usesIPL'}->val();
diff --git a/lib/PDF/Builder/Resource/XObject/Image/PNM.pm b/lib/PDF/Builder/Resource/XObject/Image/PNM.pm
index 02a218c..40d17ec 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/PNM.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/PNM.pm
@@ -5,10 +5,11 @@ package PDF::Builder::Resource::XObject::Image::PNM;
use base 'PDF::Builder::Resource::XObject::Image';
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use IO::File;
use PDF::Builder::Util;
diff --git a/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm b/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm
index cf5df90..57711d6 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm
@@ -5,10 +5,10 @@ use base 'PDF::Builder::Resource::XObject::Image';
use strict;
use warnings;
-no warnings 'uninitialized';
+#no warnings 'uninitialized';
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Compress::Zlib;
@@ -272,7 +272,8 @@ sub read_tiff {
$self->{'Interpolate'} = PDFBool(1);
$self->bits_per_component($tif->{'bitsPerSample'});
- if ($tif->{'whiteIsZero'} == 1 && $tif->{'filter'} ne 'CCITTFaxDecode') {
+ if (($tif->{'whiteIsZero'}||0) == 1 &&
+ ($tif->{'filter'}||'') ne 'CCITTFaxDecode') {
$self->{'Decode'} = PDFArray(PDFNum(1), PDFNum(0));
}
diff --git a/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm b/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm
index fabde88..f0d8a6d 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::XObject::Image::TIFF::File;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.001'; # manually update whenever code is changed
use IO::File;
diff --git a/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm b/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm
index a4aae2d..8271290 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm
@@ -3,7 +3,7 @@ package PDF::Builder::Resource::XObject::Image::TIFF::File_GT;
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
use IO::File;
diff --git a/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm b/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm
index f0deae4..00fb893 100644
--- a/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm
+++ b/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm
@@ -5,10 +5,10 @@ use base 'PDF::Builder::Resource::XObject::Image';
use strict;
use warnings;
-no warnings 'uninitialized';
+#no warnings 'uninitialized';
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.020'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
use Compress::Zlib;
@@ -16,7 +16,8 @@ use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Resource::XObject::Image::TIFF::File_GT;
use PDF::Builder::Util;
use Scalar::Util qw(weaken);
-use Graphics::TIFF 7 ':all'; # have already confirmed that this exists
+#use Graphics::TIFF 7 ':all'; # have already confirmed that this exists
+use Graphics::TIFF ':all'; # have already confirmed that this version exists
=head1 NAME
@@ -27,6 +28,8 @@ PDF::Builder::Resource::XObject::Image::TIFF_GT - TIFF image support
=over
+=item $res = PDF::Builder::Resource::XObject::Image::TIFF_GT->new($pdf, $file, $name, %opts)
+
=item $res = PDF::Builder::Resource::XObject::Image::TIFF_GT->new($pdf, $file, $name)
=item $res = PDF::Builder::Resource::XObject::Image::TIFF_GT->new($pdf, $file)
@@ -39,10 +42,40 @@ If the Graphics::TIFF package is installed, and its use is not suppressed via
the C<-nouseGT> flag (see Builder documentation for C<image_tiff>), the TIFF_GT
library will be used. Otherwise, the TIFF library will be used instead.
+Options:
+
+=over
+
+=item -notrans => 1
+
+Ignore any alpha layer (transparency) and make the image fully opaque.
+
+=back
+
+TIFF support (when using Graphics::TIFF) is for C<PhotometricInterpretation>
+values of 0 (bilevel/gray, white is 0), 1 (bilevel/gray, black is 0), 2 (RGB),
+and 3 (Palette color). It currently does I<not> support 4 (transparency mask),
+5 (separated CMYK), 6 (YCbCr), 8 (CIELab), or higher. There is limited support
+for an Alpha (transparency) channel (due to extremely limited test cases).
+Some tags are not supported, and a PlanarConfiguration of 2 is unknown until
+we get some test cases.
+
+Some applications seem to take odd liberties with TIFF tags, such as adding a
+SamplePerPixel without specifying ExtraSamples type. In such cases, we treat
+one extra sample (not otherwise defined) as an Alpha channel, and hope for
+the best!
+
+If there are invalid tags or field values within a tag, the Graphics::TIFF
+library will attempt to pop-up a warning dialog, rather than just ignoring
+invalid things. If we can find a switch to disable this behavior, we will
+look into adding it as an option. According to Graphic::TIFF's owner
+(ticket RT 133955), this is coming directly from libtiff (as write to STDERR),
+so he can't do anything about it!
+
=cut
sub new {
- my ($class, $pdf, $file, $name) = @_;
+ my ($class, $pdf, $file, $name, %opts) = @_;
my $self;
@@ -59,7 +92,39 @@ sub new {
$self->{' apipdf'} = $pdf;
weaken $self->{' apipdf'};
- $self->read_tiff($pdf, $tif);
+ # set up dict stream for any Alpha channel to be split out from $buffer
+ my $dict = PDFDict();
+
+ # let's try to clarify various strange tag combinations
+ # one extra SamplesPerPixel (2/4) and no ExtraSamples (or is 0)?
+ # treat as an Alpha channel with ExtraSamples 2 (unassociated alpha)
+ if ($tif->{'colorSpace'} eq 'DeviceGray' &&
+ $tif->{'SamplesPerPixel'} == 2 &&
+ (!defined $tif->{'ExtraSamples'} || $tif->{'ExtraSamples'} == 0)) {
+ # let's assume it's realy SPP 1 with ExtraSamples UNASSOC_ALPHA
+ $tif->{'SamplesPerPixel'} = 1;
+ $tif->{'ExtraSamples'} = EXTRASAMPLE_UNASSALPHA; # 2
+ #print " changed SPP 2 to 1, ES 0 to 2, to treat as GA\n";
+ }
+ if ($tif->{'colorSpace'} eq 'DeviceRGB' &&
+ $tif->{'SamplesPerPixel'} == 4 &&
+ (!defined $tif->{'ExtraSamples'} || $tif->{'ExtraSamples'} == 0)) {
+ # let's assume it's realy SPP 3 with ExtraSamples UNASSOC_ALPHA
+ $tif->{'SamplesPerPixel'} = 3;
+ $tif->{'ExtraSamples'} = EXTRASAMPLE_UNASSALPHA; # 2
+ #print " changed SPP 4 to 3, ES 0 to 2, to treat as RGBA\n";
+ }
+ # otherwise ExtraSamples is in order, but have "extra" sample
+ if ($tif->{'colorSpace'} eq 'DeviceGray' &&
+ $tif->{'SamplesPerPixel'} == 2) {
+ $tif->{'SamplesPerPixel'} = 1;
+ }
+ if ($tif->{'colorSpace'} eq 'DeviceRGB' &&
+ $tif->{'SamplesPerPixel'} == 4) {
+ $tif->{'SamplesPerPixel'} = 3;
+ }
+
+ $self->read_tiff($pdf, $tif, %opts);
$tif->close();
@@ -74,7 +139,7 @@ installed but not used (-nouseGT option given to C<image_tiff>).
B<Caution:> this method can only be used I<after> the image object has been
created. It can't tell you whether Graphics::TIFF is available in
advance of actually using it, in case you want to use some functionality
-available only in TIFF_GT. See the <PDF::Builder> LA_GT() call if you
+available only in TIFF_GT. See the L<PDF::Builder> LA_GT() call if you
need to know in advance.
=back
@@ -88,10 +153,16 @@ sub usesLib {
}
sub handle_generic {
- my ($self, $pdf, $tif) = @_;
+ my ($self, $pdf, $tif, %opts) = @_;
my ($stripcount, $buffer);
$self->filters('FlateDecode');
+ # colorspace DeviceGray or DeviceRGB already set in read_tiff()
+ # bits_per_component 1 2 4 8 16? already set in read_tiff()
+ my $dict = PDFDict();
+ $self->{'DecodeParms'} = PDFArray($dict);
+ $dict->{'BitsPerComponent'} = PDFNum($tif->{'bitsPerSample'});
+ $dict->{'Colors'} = PDFNum($tif->{'colorSpace'} eq 'DeviceGray'?1 :3);
$stripcount = $tif->{'object'}->NumberOfStrips();
$buffer = '';
@@ -99,24 +170,412 @@ sub handle_generic {
$buffer .= $tif->{'object'}->ReadEncodedStrip($i, -1);
}
- if ($tif->{'SamplesPerPixel'} == $tif->{'bitsPerSample'} + 1) {
- if ($tif->{'ExtraSamples'} == EXTRASAMPLE_ASSOCALPHA) {
- if ($tif->{'bitsPerSample'} == 1) {
- $buffer = sample_greya_to_a($buffer);
- } else {
- warn "Don't know what to do with RGBA image\n";
- }
- } else {
- warn "Don't know what to do with alpha layer in TIFF\n";
+ my $transparency = (defined $opts{'-notrans'} && $opts{'-notrans'} == 1)? 0: 1;
+ my $alpha;
+
+ # handle any Alpha channel/layer
+ my $h = $tif->{'imageHeight'}; # in pixels
+ my $w = $tif->{'imageWidth'};
+ $dict->{'Columns'} = PDFNum($w);
+ my $samples = 1; # fallback
+
+# # code common to associated and unassociated alpha
+# if (defined $tif->{'ExtraSamples'} &&
+# ($tif->{'ExtraSamples'} == EXTRASAMPLE_ASSOCALPHA ||
+# $tif->{'ExtraSamples'} == EXTRASAMPLE_UNASSALPHA)) {
+##print STDERR "This file has Alpha layer\n";
+# }
+
+ if (defined $tif->{'ExtraSamples'} &&
+ $tif->{'ExtraSamples'} == EXTRASAMPLE_ASSOCALPHA) {
+ # Gray or RGB pre-multiplication will likely have to be backed out
+ if ($tif->{'colorSpace'} eq 'DeviceGray') {
+ # Gray or Bilevel (pre-multiplied) + Alpha
+ $samples = 1;
+ } elsif ($tif->{'colorSpace'} eq 'DeviceRGB') {
+ # RGB (pre-multiplied) + Alpha
+ $samples = 3;
+ } else {
+ warn "Invalid TIFF file, requested Alpha for $tif->{'colorSpace'}".
+ ", PDF will likely be defective!\n";
+ }
+ ($buffer, $alpha) = split_alpha($buffer, $samples, $tif->{'bitsPerSample'}, $w*$h);
+ $buffer = descale($buffer, $samples, $tif->{'bitsPerSample'}, $alpha, $w*$h);
+ } elsif (defined $tif->{'ExtraSamples'} &&
+ $tif->{'ExtraSamples'} == EXTRASAMPLE_UNASSALPHA) {
+ # Gray or RGB at full value, no adjustment needed
+ if ($tif->{'colorSpace'} eq 'DeviceGray') {
+ # Gray or Bilevel + Alpha
+ $samples = 1;
+ } elsif ($tif->{'colorSpace'} eq 'DeviceRGB') {
+ # RGB + Alpha
+ $samples = 3;
+ } else {
+ warn "Invalid TIFF file, requested Alpha for $tif->{'colorSpace'}".
+ ", PDF will likely be defective!\n";
}
+ ($buffer, $alpha) = split_alpha($buffer, $samples, $tif->{'bitsPerSample'}, $w*$h);
}
+
$self->{' stream'} .= $buffer;
+ # $alpha is undef if no alpha layer found
+ if (defined $alpha) {
+ # an alpha layer was found. use it?
+ if (!$transparency) {
+ # suppress any transparency (alpha layer)?
+ $alpha = undef;
+ } else {
+ # we will have transparency
+ $pdf->new_obj($dict);
+ $dict->{'Type'} = PDFName('XObject');
+ $dict->{'Subtype'} = PDFName('Image');
+ $dict->{'Width'} = PDFNum($w);
+ $dict->{'Height'} = PDFNum($h);
+ $dict->{'ColorSpace'} = PDFName('DeviceGray'); # Alpha is always
+ $dict->{'BitsPerComponent'} = PDFNum($tif->{'bitsPerSample'});
+ $self->{'SMask'} = $dict;
+ delete $self->{' nofilt'};
+ $dict->{' stream'} = $alpha;
+ }
+ }
+
+ # compress all but short streams
+ if (length($self->{' stream'}) > 32) {
+ $self->{' stream'} = Compress::Zlib::compress($self->{' stream'});
+ $self->filters('FlateDecode'); # tell reader it's compressed...
+ $self->{' nofilt'} = 1; # ...but writer not to compress on the fly
+ } else {
+ # too short to bother compressing. '/Filter [ /FlateDecode ] '
+ # takes up 25 bytes all by itself
+ delete $self->{'Filter'};
+ $self->{' nofilt'} = 1;
+ }
+ if (defined $dict->{' stream'}) { # there is transparency?
+ if (length($dict->{' stream'}) > 32) {
+ $dict->{' stream'} = Compress::Zlib::compress($dict->{' stream'});
+ $dict->filters('FlateDecode'); # tell reader it's compressed...
+ $dict->{' nofilt'} = 1; # ...but writer not to compress on the fly
+ } else {
+ # too short to bother compressing. '/Filter [ /FlateDecode ] '
+ # takes up 25 bytes all by itself
+ delete $dict->{'Filter'};
+ $dict->{' nofilt'} = 1;
+ }
+ }
return $self;
+} # end of handle_generic()
+
+# split alpha from buffer (both strings)
+# bps = width of a sample in bits, samples 1 (G) or 3 (RGB)
+# returns $buffer and $alpha strings
+# TBD: fill order or other directional issues?
+sub split_alpha {
+ my ($inbuf, $samples, $bps, $count) = @_;
+ my $outbuf = '';
+ my $alpha = '';
+
+## debug
+#my @slice; # TEMP
+#if ($count == 999*1056) {
+# # French text pag1.tif
+# @slice = (823*999, 823*999+125); # row 824/1056
+#}elsif($count == 1000*568) {
+# # Lorem ipsum alpha.tif
+# @slice = (283*1000, 283*1000+125); # row 284/568
+#}else{
+# @slice = (-1, -1);
+#}
+
+## debug
+## upon entry, what is raw input row? # TEMP
+#if ($slice[0]>-1 && $bps==16){
+# print "bps==16 raw input slice: ";
+# for (my $i=$slice[0]; $i<$slice[1]; $i++){
+# my $pixel = substr($inbuf, $i*($samples+1)*2, ($samples+1)*2);
+# my @pixelbytes = split //, $pixel;
+# foreach (@pixelbytes) {printf("%02X", ord($_));}
+# print " ";
+# }
+# print "\n";
+#}
+#if ($slice[0]>-1 && $bps==8){
+# print "bps==8 raw input slice: ";
+# for (my $i=$slice[0]; $i<$slice[1]; $i++){
+# my $pixel = substr($inbuf, $i*($samples+1), $samples+1);
+# my @pixelbytes = split //, $pixel;
+# foreach (@pixelbytes) {printf("%02X", ord($_));}
+# print " ";
+# }
+# print "\n";
+#}
+## bps<8 is ugly to dump and not worth doing
+
+ # this could be pretty slow. test of concept. TBD
+ # COULD have different number of bits per sample, unless GT prevents this
+ if ($bps == 16) {
+ # full double bytes to work with (not sure if 16bps in TIFF)
+ for (my $i=0; $i<$count; $i++) {
+ substr($outbuf, $i*$samples*2, $samples*2) =
+ substr($inbuf, $i*($samples+1)*2, $samples*2);
+ substr($alpha, $i*2, 2) =
+ substr($inbuf, $i*($samples+1)*2+$samples*2, 2);
+ }
+ } elsif ($bps == 8) {
+ # full bytes to work with
+ for (my $i=0; $i<$count; $i++) {
+ substr($outbuf, $i*$samples, $samples) =
+ substr($inbuf, $i*($samples+1), $samples);
+ substr($alpha, $i, 1) =
+ substr($inbuf, $i*($samples+1)+$samples, 1);
+ }
+ } else {
+ # fractional bytes (bps < 8) possible to have not 2**N?
+ my $strideBits = $bps*($samples+1);
+ my @inBits = (); # bits from inbuf string
+ my @outBits = (); # bits to outbuf string (starts empty)
+ my @outABits = (); # build alpha string (starts empty)
+ my $inByte = 0;
+ my $outByte = 0;
+ my $outAByte = 0;
+ for (my $i=0; $i<$count; $i++) {
+ # i-th pixel is next 2 or more bits in inBits
+ # build up enough bits in inBits
+ while (scalar(@inBits) < $strideBits) {
+ push @inBits, split(//, unpack('B8', substr($inbuf, $inByte++, 1)));
+ }
+ # now have enough bits in inBits array for adding to output buffer
+ push @outBits, splice(@inBits, 0, $samples*$bps);
+ # now have enough bits in inBits array for adding to alpha buffer
+ push @outABits, splice(@inBits, 0, $bps);
+ # do we have at least one full byte to output to outbuf?
+ while (scalar(@outBits) >= 8) {
+ substr($outbuf, $outByte++, 1) = pack('B8', join('', splice(@outBits, 0, 8)));
+ }
+ # do we have at least one full byte to output to alpha?
+ while (scalar(@outABits) >= 8) {
+ substr($alpha, $outAByte++, 1) = pack('B8', join('', splice(@outABits, 0, 8)));
+ }
+ # there may be leftover bits (for next pixel) in inBits
+ # outBits and outABits may also have partial content yet to write
+ }
+ # got to the end. anything not yet written in @outBits and @outABits?
+ if (scalar(@outBits)) {
+ # pad out to 8 bits in length (should be no more than 7)
+ while (scalar(@outBits) < 8) {
+ push @outBits, 0;
+ }
+ substr($outbuf, $outByte++, 1) = pack('B8', join('', @outBits));
+ }
+ if (scalar(@outABits)) {
+ # pad out to 8 bits in length (should be no more than 7)
+ while (scalar(@outABits) < 8) {
+ push @outABits, 0;
+ }
+ substr($alpha, $outAByte++, 1) = pack('B8', join('', @outABits));
+ }
+ } # end of fractional byte (bits) handling
+
+## debug
+## upon exit, what is output data row? # TEMP
+#if ($slice[0]>-1 && $bps==16){
+# print "bps==16 output data slice: ";
+# for (my $i=$slice[0]; $i<$slice[1]; $i++){
+# my $pixel = substr($outbuf, $i*$samples*2, $samples*2);
+# my @pixelbytes = split //, $pixel;
+# foreach (@pixelbytes) {printf("%02X", ord($_));}
+# print " ";
+# }
+# print "\n";
+#}
+#if ($slice[0]>-1 && $bps==8){
+# print "bps==8 output data slice: ";
+# for (my $i=$slice[0]; $i<$slice[1]; $i++){
+# my $pixel = substr($outbuf, $i*$samples, $samples);
+# my @pixelbytes = split //, $pixel;
+# foreach (@pixelbytes) {printf("%02X", ord($_));}
+# print " ";
+# }
+# print "\n";
+#}
+## upon exit, what is output alpha row? # TEMP
+#if ($slice[0]>-1 && $bps==16){
+# print "bps==16 output alpha slice: ";
+# for (my $i=$slice[0]; $i<$slice[1]; $i++){
+# my $pixel = substr($alpha, $i*2, 2);
+# my @pixelbytes = split //, $pixel;
+# foreach (@pixelbytes) {printf("%02X", ord($_));}
+# print " ";
+# }
+# print "\n";
+#}
+#if ($slice[0]>-1 && $bps==8){
+# print "bps==8 output alpha slice: ";
+# for (my $i=$slice[0]; $i<$slice[1]; $i++){
+# my $pixel = substr($alpha, $i, 1);
+# my @pixelbytes = split //, $pixel;
+# foreach (@pixelbytes) {printf("%02X", ord($_));}
+# print " ";
+# }
+# print "\n";
+#}
+
+ return ($outbuf, $alpha);
+} # end of split_alpha()
+
+# bps = width of a sample in bits, samples 1 (G) or 3 (RGB)
+# return updated buffer WARNING: not tested!
+sub descale {
+ my ($inbuf, $samples, $bps, $alpha, $count) = @_;
+ my $outbuf = '';
+ if ($bps == 1) {
+ # 1 bps no effect
+ $outbuf = $inbuf;
+ return $outbuf;
+ }
+ # 1. assuming alpha is 0.0 fully transparent to 1.0 fully opaque
+ # 2. sample has already been multiplied by alpha (0 if fully transparent)
+ # 3. if alpha is 0, leave sample as 0. otherwise...
+ # 4. convert sample and alpha to decimal 0.0..1.0
+ # 5. sample = sample/alpha
+ # 6. round, integerize, and clamp sample to 0..max val range
+ my $maxVal = 2**$bps - 1;
+ my ($pixR, @samplesR, @samplesC, $alphaR);
+
+ # items used for fractional byte (bits)
+ my $strideBits = $bps*$samples;
+ my @inBits = (); # bits from inbuf string
+ my @outBits = (); # bits to outbuf string (starts empty)
+ my @inABits = (); # bits from alpha string
+ my $inByte = 0; # 1 or 3 samples only, not changing alpha values
+ my $outByte = 0;
+ my $inAByte = 0;
+
+ for (my $pix = 0; $pix < $count; $pix++) {
+ if ($bps == 16) { # not sure if TIFF does 16bps
+ @samplesC = split //, substr($alpha, $pix, 2);
+ $alphaR = (ord($samplesC[0])*256 + ord($samplesC[1]))*1.0/$maxVal;
+ if ($alphaR > 0.0) {
+ @samplesC = split //, substr($inbuf, $pix*$samples*2, $samples*2);
+ for (my $i=0; $i<$samples; $i++) {
+ $pixR = (ord($samplesC[2*$i])*256+ord($samplesC[2*$i+1]))*1.0/$maxVal;
+ $pixR /= $alphaR;
+ $pixR = int($pixR * $maxVal);
+ $outbuf .= chr($pixR>>8);
+ $outbuf .= chr($pixR%256);
+ }
+ } else {
+ # alpha is 0 for this pixel, so just use original value
+ $outbuf .= substr($inbuf, $pix*$samples*2, $samples*2);
+ }
+ } elsif ($bps == 8) {
+ $alphaR = ord(substr($alpha, $pix, 1))*1.0/$maxVal;
+ if ($alphaR > 0.0) {
+ @samplesC = split //, substr($inbuf, $pix*$samples, $samples);
+ foreach (@samplesC) {
+ $pixR = ord($_)*1.0/$maxVal;
+ $pixR /= $alphaR;
+ $outbuf .= chr(int($pixR * $maxVal));
+ }
+ } else {
+ # alpha is 0 for this pixel, so just use original value
+ $outbuf .= substr($inbuf, $pix*$samples, $samples);
+ }
+ } else { # 1 < $bps < 8. $pix-th pixel, $samples 1 or 3
+ # fractions of a byte per sample
+ # pix-th pixel is next 2 or more bits in inBits
+
+ # build up enough bits in inBits to get full pixel data
+ while (scalar(@inBits) < $strideBits) {
+ push @inBits, split(//, unpack('B8', substr($inbuf, $inByte++, 1)));
+ }
+ my @Bits = ();
+ for (my $i=0; $i<$samples; $i++) {
+ push @Bits, [splice(@inBits, 0, $bps)];
+ }
+ # now have enough bits in Bits array for recalculating or
+ # adding to output buffer (if skip due to alpha)
+
+ # build up enough bits in inABits to get next alpha
+ while (scalar(@inABits) < $bps) {
+ push @inABits, split(//, unpack('B8', substr($alpha, $inAByte++, 1)));
+ }
+ # now have enough bits in inABits array for calculating alpha
+ my @ABits = splice(@inABits, 0, $bps);
+ $alphaR = ba2ui(@ABits)*1.0/$maxVal;
+
+ # calculate alpha, and if > 0, make real 0.0-1.0...
+ if ($alphaR > 0.0) {
+ # ...turn sample(s) into reals 0.0-1.0, divide by alpha
+ # turn samples back into ints, then bits to add to outBits
+ for (my $i=0; $i<$samples; $i++) {
+ $pixR = ba2ui(@{ $Bits[$i] })*1.0/$maxVal;
+ $pixR /= $alphaR;
+ $Bits[$i] = ui2ba(int($pixR*$maxVal), $bps);
+ }
+ }
+
+ # @Bits returned to outBits, whether original or recalculated
+ for (my $i=0; $i<$samples; $i++) {
+ push @outBits, @{ $Bits[$i] };
+ }
+
+ # do we have at least one full byte to output to outbuf?
+ while (scalar(@outBits) >= 8) {
+ substr($outbuf, $outByte++, 1) = pack('B8', join('', splice(@outBits, 0, 8)));
+ }
+ # there may be leftover bits (for next pixel) in inBits
+ # outBits may also have partial content yet to write
+
+ } # end of fractional byte section
+ } # loop through pixels ($pix)
+
+ # fractional bytes, anything waiting to be written out?
+ # @outBits should be empty for bps=8/16, may be empty otherwise
+ if (scalar(@outBits)) {
+ # pad out to 8 bits in length (should be no more than 7)
+ while (scalar(@outBits) < 8) {
+ push @outBits, 0;
+ }
+ substr($outbuf, $outByte++, 1) = pack('B8', join('', @outBits));
+ }
+
+ # not changing Alpha array at all
+ return $outbuf;
+} # end of descale()
+
+# binary bit stream array to unsigned integer
+sub ba2ui {
+ my @inArray = @_;
+
+ my $value = 0;
+ foreach (@inArray) {
+ $value = 2*$value + $_;
+ }
+ return $value;
+}
+
+# unsigned integer to binary bit stream array
+sub ui2ba {
+ my ($inVal, $maxBits) = @_;
+
+ my $maxVal = 2**$maxBits-1; # not to exceed this value
+ if ($inVal > $maxVal) { $inVal = $maxVal; }
+ if ($inVal < 0) { $inVal = 0; }
+
+ my @array = ();
+ my $bit;
+ foreach (1 .. $maxBits) {
+ $bit = $inVal%2;
+ unshift @array, $bit;
+ $inVal >>= 1;
+ }
+
+ return @array;
}
sub handle_ccitt {
- my ($self, $pdf, $tif) = @_;
+ my ($self, $pdf, $tif, %opts) = @_;
my ($stripcount);
$self->{' nofilt'} = 1;
@@ -160,7 +619,7 @@ sub handle_ccitt {
for my $j ( 0 .. length($self->{' stream'}) ) {
# swapping j-th byte of stream
$oldByte = ord(substr($self->{' stream'}, $j, 1));
- if ($oldByte eq 0 || $oldByte eq 255) { next; }
+ if ($oldByte == 0 || $oldByte == 255) { next; }
$newByte = 0;
if ($oldByte & 0x01) { $newByte |= 0x80; }
if ($oldByte & 0x02) { $newByte |= 0x40; }
@@ -176,13 +635,20 @@ sub handle_ccitt {
}
return $self;
-}
+} # end of handle_ccitt()
sub read_tiff {
- my ($self, $pdf, $tif) = @_;
+ my ($self, $pdf, $tif, %opts) = @_;
+
+ # not sure why blackIsZero needs to be flipped around???
+ if (defined $tif->{'blackIsZero'}) {
+ $tif->{'blackIsZero'} = $tif->{'blackIsZero'} == 1? 0: 1;
+ $tif->{'whiteIsZero'} = $tif->{'blackIsZero'} == 1? 0: 1;
+ }
$self->width($tif->{'imageWidth'});
$self->height($tif->{'imageHeight'});
+
if ($tif->{'colorSpace'} eq 'Indexed') {
my $dict = PDFDict();
$pdf->new_obj($dict);
@@ -196,26 +662,36 @@ sub read_tiff {
$dict->{' stream'} .= pack('C', ($blue->[$i]/256));
}
} else {
+ # DeviceGray or DeviceRGB
$self->colorspace($tif->{'colorSpace'});
}
$self->{'Interpolate'} = PDFBool(1);
$self->bits_per_component($tif->{'bitsPerSample'});
- if ($tif->{'whiteIsZero'} == 1 && $tif->{'filter'} ne 'CCITTFaxDecode') {
+ if (($tif->{'whiteIsZero'}||0) == 1 &&
+ ($tif->{'filter'}||'') ne 'CCITTFaxDecode') {
$self->{'Decode'} = PDFArray(PDFNum(1), PDFNum(0));
}
+## debug dump $tif
+#foreach (sort keys %$tif) {
+# if (defined $tif->{$_}) {
+# print "\$tif->{'$_'} = '$tif->{$_}'\n";
+# } else {
+# print "\$tif->{'$_'} = ?\n";
+# }
+#}
# check filters and handle separately
if (defined $tif->{'filter'} and $tif->{'filter'} eq 'CCITTFaxDecode') {
- $self->handle_ccitt($pdf, $tif);
+ $self->handle_ccitt($pdf, $tif, %opts);
} else {
- $self->handle_generic($pdf, $tif);
+ $self->handle_generic($pdf, $tif, %opts);
}
$self->{' tiff'} = $tif;
return $self;
-}
+} # end of read_tiff()
1;
diff --git a/lib/PDF/Builder/UniWrap.pm b/lib/PDF/Builder/UniWrap.pm
index 96112d9..71a8b99 100644
--- a/lib/PDF/Builder/UniWrap.pm
+++ b/lib/PDF/Builder/UniWrap.pm
@@ -1,10 +1,11 @@
package PDF::Builder::UniWrap;
use strict;
-no warnings qw[ deprecated recursion uninitialized ];
+use warnings;
+#no warnings qw[ deprecated recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.010'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
=head1 NAME
@@ -31,7 +32,6 @@ our $DEBUG = 0;
our $columns = 75;
my %classified;
-my $procedural_self;
my $txt;
use constant PROHIBITED => 0; ## no critic
@@ -147,7 +147,7 @@ sub text_properties {
# Returns a list of breaking properties for the provided breaking classes
sub class_properties {
my $self = ref($_[0])? shift(): self();
- no warnings 'uninitialized';
+# no warnings 'uninitialized';
my @breaks;
my $last_class = $_[0];
@@ -218,7 +218,7 @@ sub find_breaks {
my $self = ref($_[0])? shift(): self();
my $text = shift;
- no warnings 'uninitialized'; # since we do a lot of subscript +/- 1 checks
+# no warnings 'uninitialized'; # since we do a lot of subscript +/- 1 checks
my @characters = split(//, $text);
diff --git a/lib/PDF/Builder/Util.pm b/lib/PDF/Builder/Util.pm
index 47ab37b..6229d75 100644
--- a/lib/PDF/Builder/Util.pm
+++ b/lib/PDF/Builder/Util.pm
@@ -1,10 +1,11 @@
package PDF::Builder::Util;
use strict;
-no warnings qw[ recursion uninitialized ];
+use warnings;
+#no warnings qw[ recursion uninitialized ];
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
# note: $a and $b are "Magic variables" according to perlcritic, and so it
# has conniptions over using them as variable names (even with "my"). so, I
@@ -71,7 +72,7 @@ PDF::Builder::Util - utility package for often-used methods across the package.
%colors = PDF::Builder::Resource::Colors->get_colors();
%PaperSizes = PDF::Builder::Resource::PaperSizes->get_paper_sizes();
- no warnings qw[ recursion uninitialized ];
+# no warnings qw[ recursion uninitialized ];
$key_var = 'CBA';
diff --git a/t/00-all-usable.t b/t/00-all-usable.t
index 9d803f9..4e4a639 100644
--- a/t/00-all-usable.t
+++ b/t/00-all-usable.t
@@ -3,9 +3,11 @@ use warnings;
use strict;
use Test::More;
-
use File::Find;
+my $GrTFversion = 7; # minimum version of Graphics::TIFF
+my $LpngVersion = 0.56; # minimum version of Image::PNG::Libpng
+
# Test all of the modules to make sure that a simple "use Module"
# won't result in a crash.
@@ -42,6 +44,11 @@ foreach my $file (@files) {
};
if (!defined $rc) { $rc = 0; } # else is 1
if ($rc) {
+ if ($Graphics::TIFF::VERSION < $GrTFversion) {
+ # installed, but back-level... skip
+ push @opt_modules, $file;
+ next;
+ }
# fall through to use test
} else {
push @opt_modules, $file;
@@ -57,6 +64,11 @@ foreach my $file (@files) {
};
if (!defined $rc) { $rc = 0; } # else is 1
if ($rc) {
+ if ($Image::PNG::Libpng::VERSION < $LpngVersion) {
+ # installed, but back-level... skip
+ push @opt_modules, $file;
+ next;
+ }
# fall through to use test
} else {
push @opt_modules, $file;
@@ -72,7 +84,7 @@ TODO: {
local $TODO = q{skipped due to optional library not installed};
foreach my $file (@opt_modules) {
- ok($file);
+ ok(1, $file);
}
}
diff --git a/t/deprecations.t b/t/deprecations.t
index a7b9346..8679eb5 100644
--- a/t/deprecations.t
+++ b/t/deprecations.t
@@ -4,7 +4,7 @@ use warnings;
use Test::More tests => 1;
-no warnings 'deprecated'; ## no critic
+#no warnings 'deprecated'; ## no critic
use PDF::Builder;
use PDF::Builder::Resource::XObject::Image::JPEG;
diff --git a/t/gif.t b/t/gif.t
index 1252df8..f0a5f2f 100644
--- a/t/gif.t
+++ b/t/gif.t
@@ -25,7 +25,8 @@ like($pdf->stringify(), qr/q 216 0 0 288 72 144 cm \S+ Do Q/,
# Filehandle
$pdf = PDF::Builder->new();
-open my $fh, '<', 't/resources/1x1.gif';
+open my $fh, '<', 't/resources/1x1.gif' or
+ die "Can't open file t/resources/1x1.gif";
$gif = $pdf->image_gif($fh);
isa_ok($gif, 'PDF::Builder::Resource::XObject::Image::GIF',
q{$pdf->image_gif(filehandle)});
diff --git a/t/png.t b/t/png.t
index 80fe26b..8367146 100644
--- a/t/png.t
+++ b/t/png.t
@@ -35,7 +35,8 @@ like($pdf->stringify(), qr/q 216 0 0 288 72 144 cm \S+ Do Q/,
# Filehandle 2 tests
$pdf = PDF::Builder->new();
-open my $fh, '<', 't/resources/1x1.png';
+open my $fh, '<', 't/resources/1x1.png' or
+ die "Can't open file t/resources/1x1.png";
$png = $pdf->image_png($fh);
if ($png->usesLib() == 1) {
isa_ok($png, 'PDF::Builder::Resource::XObject::Image::PNG_IPL',
diff --git a/t/pnm.t b/t/pnm.t
index 88d6d09..f923578 100644
--- a/t/pnm.t
+++ b/t/pnm.t
@@ -25,7 +25,8 @@ like($pdf->stringify(), qr/q 216 0 0 288 72 144 cm \S+ Do Q/,
# Filehandle
$pdf = PDF::Builder->new();
-open my $fh, '<', 't/resources/1x1.pbm';
+open my $fh, '<', 't/resources/1x1.pbm' or
+ die "Can't open file t/resources/1x1.pbm";
$pnm = $pdf->image_pnm($fh);
isa_ok($pnm, 'PDF::Builder::Resource::XObject::Image::PNM',
q{$pdf->image_pnm(filehandle)});
diff --git a/t/rt120397.t b/t/rt120397.t
index 99aa785..9cb23fd 100644
--- a/t/rt120397.t
+++ b/t/rt120397.t
@@ -10,7 +10,8 @@ my ($result, $remainder);
sub readval {
my ($read, $unread, %options) = @_;
- open my $fh, '<', \$unread;
+ open my $fh, '<', \$unread or
+ die "Can't open 'unread' for input";
my $parser = { ' INFILE' => $fh };
bless $parser, 'PDF::Builder::Basic::PDF::File';
my ($result, $remainder) = $parser->readval($read, %options);
diff --git a/t/tiff.t b/t/tiff.t
index 6d1103a..f407333 100644
--- a/t/tiff.t
+++ b/t/tiff.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
-use English qw' -no_match_vars ';
+use English qw( -no_match_vars );
use IPC::Cmd qw(can_run);
use Test::More tests => 12;
@@ -37,7 +37,8 @@ like($pdf->stringify(), qr/q 216 0 0 288 72 144 cm \S+ Do Q/,
# Filehandle (old library only) 2 tests
$pdf = PDF::Builder->new();
-open my $fh, '<', 't/resources/1x1.tif';
+open my $fh, '<', 't/resources/1x1.tif' or
+ die "Couldn't open file t/resources/1x1.tif";
$tiff = $pdf->image_tiff($fh, -nouseGT => 1);
isa_ok($tiff, 'PDF::Builder::Resource::XObject::Image::TIFF',
q{$pdf->image_tiff(filehandle)});
diff --git a/tools/1_pc.pl b/tools/1_pc.pl
index 36e33ed..805dcc7 100644
--- a/tools/1_pc.pl
+++ b/tools/1_pc.pl
@@ -7,8 +7,8 @@
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
-my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
+our $VERSION = '3.021'; # VERSION
+my $LAST_UPDATE = '3.021'; # manually update whenever code is changed
# command line:
# -5 run perlcritic -5 . (should be clean)
@@ -30,9 +30,12 @@ my @ignore_list = (
# should not ignore any level 5 warnings
"Use IO::Interactive::is_interactive",
# not a core module!
+
# common level 4 warnings to ignore
- "Code before warnings", # due to use of "no warnings" pragma
- "Warnings disabled at", # due to use of "no warnings" pragma
+# removed 'no warnings' in 3.021. remove next line 3.022 or later
+# "Code before warnings", # due to use of "no warnings" pragma
+# removed 'no warnings' in 3.021. remove next line 3.022 or later
+# "Warnings disabled at", # due to use of "no warnings" pragma
"Close filehandles as soon as possible",
# it thinks there is no "close" on an open
# filehandle, due to either too many lines for
@@ -40,20 +43,50 @@ my @ignore_list = (
"Always unpack ", # Always unpack @_ first at line
# not using @_ or $_[n] directly is good practice,
# but it doesn't seem to recognize legitimate uses
+# 'default' in Builder.pm would have to be deprecated, and changed to defaultB
+# Perl 'default' (CORE::) not used
+# 'close' in Content-Lite.pm would have to be deprecated, and changed to
+# closePath. Perl 'close' (CORE::) not used in Content-Lite.pm
+# 'print' in Lite.pm would have to be deprecated, and changed to
+# printB. Perl 'print' (CORE::) not used in Lite.pm
+# 'link' in NamedDestination.pm would have to be deprecated, and changed to
+# linkPage. Perl 'link' (CORE::) not used in NamedDestination.pm
+# 'next', 'last' in Outline.pm is undocumented internal routine, can rename
+# 'open' in Outline.pm would have to be deprecated, and changed to openB.
+# Perl 'open' (CORE::) not used
+# 'open' in File.pm would have to be deprecated, and changed to openB
+# Perl 'open' (CORE::) is ALSO used
"Subroutine name is a homonym for builtin function",
# e.g., we define "open" when there is already a
# system (CORE::) open (ambiguous unless CORE::
- # added)
+ # added) TBD consider removing
"Symbols are exported by default",
# it doesn't like something about our use of
# @EXPORT and @EXPORT_OK
+# 4 'use constant' for conversion factors in Boxes.pl, 3 in RMtutorial.pl
"Pragma \"constant\" used at", # will have to investigate why "use constant"
# is flagged. TBD
+
# common level 3 warnings to ignore for now
'"die" used instead of "croak"', #
'"warn" used instead of "carp"', #
'Regular expression without "/x" flag', #
- "Backtick operator used", #
+ "Backtick operator used", # what's the problem?
+ "high complexity score", #
+ "Cascading if-elsif chain", #
+ "Hard tabs used at", # consider updating (ViM editor [ ] likes to
+ #replace spaces with tabs)
+ '"local" variable not initialized', # variable set in next line --
+ # no problem
+ "Reused variable name in lexical scope", # what's the problem?
+ 'in condition for an "unless"',
+ # doesn't like inequality tests in "unless" for some reason
+ # perhaps it's confusing in this "negative" test?
+ "Unrestricted '## no critic' annotation",
+ # need documentation [ ] on how to restrict policies
+ "Ambiguously named variable",
+ # bitches about last, left, right as "ambiguous". sigh.
+ # Return value of eval not tested, can't depend on $@. should fix [ ]
);
# Note that level 4 includes any level 5 errors, etc.
diff --git a/tools/2_t-tests.pl b/tools/2_t-tests.pl
index d708b93..5b32b33 100644
--- a/tools/2_t-tests.pl
+++ b/tools/2_t-tests.pl
@@ -7,7 +7,7 @@
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.016'; # manually update whenever code is changed
# command line flags, mutually exclusive:
diff --git a/tools/3_examples.pl b/tools/3_examples.pl
index 423b26d..3c54d26 100644
--- a/tools/3_examples.pl
+++ b/tools/3_examples.pl
@@ -7,7 +7,7 @@
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.018'; # manually update whenever code is changed
# dependent on optional packages:
@@ -59,7 +59,7 @@ my (@example_list, @example_results);
push @example_results, "create examples/024_bdffonts.<font name>.pdf, showing one page of 256 glyphs\n and a page of Lorem Ipsum text.\n";
push @example_list, "025_unifonts";
- push @example_results, "create examples/025_unifonts.pdf, with the first 45 lines of an attached PDF-J\n file in four different Western+CJK fonts.\n";
+ push @example_results, "create examples/025_unifonts.pdf, with the first 45 lines of an attached PDF-J\n file in four different Western + CJK fonts. Don't worry about long lines\n running off the right margin.\n";
push @example_list, "026_unifont2";
push @example_results, "create examples/026_unifont2.pdf, showing pages with labeled sections and\n full descriptive name on each character.\n";
diff --git a/tools/4_contrib.pl b/tools/4_contrib.pl
index 30d4349..7728876 100644
--- a/tools/4_contrib.pl
+++ b/tools/4_contrib.pl
@@ -7,7 +7,7 @@
use strict;
use warnings;
-our $VERSION = '3.020'; # VERSION
+our $VERSION = '3.021'; # VERSION
my $LAST_UPDATE = '3.013'; # manually update whenever code is changed
# command line:
diff --git a/tools/TTFdump.pl b/tools/TTFdump.pl
index 4987edd..d33749c 100644
--- a/tools/TTFdump.pl
+++ b/tools/TTFdump.pl
@@ -37,7 +37,7 @@ use PDF::Builder;
use PDF::Builder::Util;
use Unicode::UCD 'charinfo';
-my ($gfx, $tx, $pdf, $page, $y);
+my ($pdf);
# loop through command line list of font file names
die "Need one or more TTF file names on command line!\n" if !scalar(@ARGV);