diff -Nru libpdf-builder-perl-3.022/Changes libpdf-builder-perl-3.023/Changes --- libpdf-builder-perl-3.022/Changes 2021-03-27 16:21:00.000000000 +0000 +++ libpdf-builder-perl-3.023/Changes 2021-07-15 19:11:47.000000000 +0000 @@ -1,86 +1,196 @@ -See also INFO/Changes-ver_2 for changes released for PDF::API2, and -incorporated into PDF::Builder. -See also INFO/Changes_2020 for earlier version 3 release logs. - -3.022 2021-03-27 - - docs/buildDoc.pl add "end of page" (###) marker to make it clear that - you're seeing the bottom of the HTML page. - - Update build process to ensure consistent "unix" formatting of most - human-readable files (#150). Some non-CPAN builds were complaining - about MS-DOS format (CRLF line ends) on some files. - - t/tiff.t, lib/PDF/Builder/Resource/XObject/Image/TIFF-TIFF_GT.pm - Per #148, update by carygravel to stop converting LZW-compressed TIFFs - to Flate compression (unnecessary, as PDF directly supports LZW, and - there were supposedly some edge-case bugs in the code). - == REMOVED == still problems, development under way - - t/tiff.t per #143, update by carygravel to enable proper TIFF testing - on all platforms including Windows. - - lib/PDF/Builder/Content-Lite.pm, INFO/DEPRECATED, t/content.t - Per PDF::API2, deprecated lead() and replace by leading(). Lite's - textlead() deprecated and replaced by textleading(). - - t/text.t - Per PDF::API2 add two tests for charspace and wordspace override, and - 18 more tests for basic text calls. - - lib/PDF/Builder/Content/Text.pm, INFO/KNOWN_INCOMP - Per PDF::API2, add paragraphs() as an alias for section(). Document some - minor inconsistencies in option names and behavior introduced with - these changes. - - lib/PDF/Builder/Annotation.pm, lib/PDF/Builder/Basic/PDF/Dict-File.pm, - lib/PDF/Builder/Resource/Font/SynFont.pm, examples/041_annot_fileattach, - examples/060_transparency, examples/resources/sample_55.pdf, - examples/resources/HarfBuzz_example.pdf - Output 'endobj' starting its own line. Some PDF validators raise a - stink if endobj continues a line with other commands on it. - While we're at it, put 'stream' starting its own line, too. - Fix two examples that failed to validate. There is a third failure, but - it appears to be an issue with PDF/A disallowed content (embedded files), - not a bug in PDF production here. - - lib/PDF/Builder/Resource/Font/SynFont.pm, INFO/DEPRECATED, - examples/025_unifonts, lib/PDF/Builder/Docs.pm - Fix uninitialized value (missingwidth), remove -slant (deprecated). - - lib/PDF/Builder/Resource/XObject/Image/TIFF.pm - Corrected some bilevel color inverts. - - lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm, - lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm - Some improvements to deal with inverted colors (black/white) on certain - TIFF images. Now G3 and G4 (CCITT Fax) get flipped to the correct - colors, as does uncompressed bilevel. There are still some TIFF cases - which are not fully properly dealt with; we are still working on them. - - lib/PDF/Builder/Annotation.pm, examples/040_annotation, - examples/041_annot_fileattach - Add "-opacity" option to control the opacity (opaqueness) of the icon, - where the default of 1.0 is fully opaque, and 0.0 is fully transparent. - Add "markup" method to implement "highlighted" text annotations, per - [GitHub #142]. These include "Highlight" (in the manner of a highlighter - marker), "Squiggly" (squiggly underline), "Underline", and "StrikeOut". - These behave like a "text" annotation, but instead of an icon, the - document text is highlighted. - - lib/PDF/Builder/Content.pm improve -strikethru placement - - INFO/LICENSE, README.md, lib/PDF/Builder/Basic/PDF/Array-Bool-Dict- - File-Filter-Name-Null-Number-Objind-Page-Pages-String-Utils.pm - Update file headers on code originally written by Martin Hosken to - reflect that he has granted permission to use the MIT license instead - of the Perl Artistic License on his code. This change was made so - that Red Hat could have licensing compatible with LGPL for releasing - PDF::Builder as part of Fedora. - - INFO/Changes_2020, Changes, MANIFEST, lib/PDF/Builder.pm, README.md, - INFO/LICENSE - 2021 copyright, archive 2020 changes. - -(see INFO/Changes_2020 for earlier changes) -(see INFO/Changes-ver_2 for changes to PDF::API2 up through 2.033) +See also INFO/Changes-ver_2 for changes released for PDF::API2, and +incorporated into PDF::Builder. +See also INFO/Changes_2020 for earlier version 3 release logs. + +3.023 2021-07-15 + + lib/PDF/Builder.pm, INFO/DEPRECATED + FUTURE: Builder.pm's "default()" method may need to be renamed. + Some time after Perl 5.26, Perl::Critic started flagging "default" as a + reserved keyword. This needs to be further investigated. + + .github/workflows/test.yml Update PATH for new ImageMagick level. + + lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm, t/tiff.t + Fix for ticket #154 by @carygravel, and add a test for bilevel+alpha + where rows are not filling out a full array of bytes. + + version (for distribution build), README.md, lib/PDF/Builder.pm, + t/00-all-usable.t, .gitignore + Modified to prereq Perl 5.22 instead of 5.20 (is 6 years old now). Also + Graphics::TIFF minimum upped to 16 and Image::PNG::Libpng to 0.57 due + to changes. Keep files up to date on GitHub so can successfully run + without full build. Put "version" in GitHub as it's now fairly involved + and I don't want to accidentally lose it! + + Makefile.PL, MANIFEST, META.json (add), META.yml (add), .perl-version + (deleted), optional_update.pl (add), README.md + Modify build process to have optional prereqs properly installed. Also + ensure that mandatory and optional prereqs are consistently updated and + handled. Since the vast majority of users will use the default of + installing all optional prereqs, the selection process has been moved + from Makefile.PL to optional_update.pl (for those manually running + Makefile.PL). optional_update.pl updates Makefile.PL, META.json, and + META.yml upon selection of which (if any) optional prerequisites are to + be installed on a manual run of Makefile.PL. I don't want to risk + getting META.json and META.yml (needed for properly installing the + "recommends" optionals) out of sync by failing to update them at install + from Makefile.PL, so all are now shipped with all optionals selected. + + .gitattributes, .github/workflows/test.yml + Added .gitattributes to stop certain line-end changes that were causing + CI tests to fail, add Windows tests to CI. From @carygravel. + + lib/PDF/Builder/Content.pm + Problem with use of "pi" constant caused a warning on compile in one + CPAN smoke test (Perl 5.20 for one tester). Changed "-pi" in one + expression to "-1*pi" and hopefully that will silence the messages. + + lib/PDF/Builder.pm, lib/PDF/Builder/Page.pm, INFO/DEPRECATED, + t/annotate-deprecations.t + Per PDF::API2, simplify Builder's ' fixed' to ' opened'. Rename + 'openpage()' to 'open_page()' and deprecate old name. + + INFO/Changes-ver_2, t/pdf.t + Per changes in PDF::API2, sync up with 2.040 release. There are still + a small number of changes not implemented (yet) in PDF::Builder, which + either appear to be unnecessary, or the underlying code has changed too + much to cleanly port the changes without a massive rewrite. + + t/deprecations.t + Update for new PDF::API2 t-tests and a number of other deprecated items. + Test both deprecated interfaces and their replacements. + + lib/PDF/Builder/Content/Text.pm, examples/BarCode-Boxes-Content- + ContentText-Rotated.pl, examples/021_synfonts-022_truefonts- + 022_truefonts_diacrits_utf8-023_cjkfonts-024_bdffonts-040_annotation + Per 3.022 change of lead() to leading(), update examples to use leading() + instead of lead(). + + In releases 3.020 through 3.022, INFO/DEPRECATED erroneously listed + PDFStr() and PDFUtf() as being scheduled for removal after October 2022. + These two routines ARE deprecated (use PDFString() instead), but there + are currently no plans to REMOVE them. + + .gitignore, lib/PDF/Builder.pm, lib/PDF/Builder/Basic/PDF/File.pm, t/tiff.t + Some minor cleanup, fix TIFF tests because grouped skips don't seem to + work properly on Strawberry Perl, initialize $xmin in File.pm to prevent + error message. + + lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm, lib/PDF/Builder.pm, + lib/PDF/Builder/Resource/XObject/Image/TIFF-TIFF_GT.pm, + lib/PDF/Builder/Resource/XObject/Image/TIFF/File-File_GT.pm, + t/filter-lzwdecode.t, t/tiff.t, t/00-all-usable.t, Makefile.PL + Further improvements to TIFF LZW file handling [ref GH 151 and PR 156] for + single and multi-strip, and horizontal predictor. Continuation of work + to stop converting LZW-compressed TIFF to Flate. Code by @carygravel. + Increase required Graphics::TIFF version to 10 due to fix in GT. + + examples/README, examples/examples.output + Discuss the issue of close, heavy lines in the example bar codes appearing + to merge or "blot" together. This is at least partially a consequence of + lower resolution display screens (rounding errors), and although the bars + separate when printed, I'm still concerned that they will not be reliably + scannable. + + All files (.pm and .pl) containing $LAST_UPDATE can now access this + string from outside the file, in the same manner as $VERSION. The + variable declarator has been changed from 'my' to 'our' during package + build. + + INFO/Changes-ver_2, /lib/PDF/Builder/Basic/PDF/String.pm, t/string.t + Per PDF::API2 changes related to [RT 134957], change some regex flags + to fix encoding of \n in a PDF string. + + t/tiff.t add version check (not just if installed) for ImageMagick and + Ghostscript. Some smoke tests apparently blew up for using too low + level versions. If too low version, or any problems determining the + version, tiff.t fails gracefully by skipping those tests. From + @carygravel. + + t/tiff.t use a temporary directory for various test files, enabling use + from a Read-Only directory and/or running tests in parallel (from + @ppisar, #153). + +3.022 2021-03-27 + + docs/buildDoc.pl add "end of page" (###) marker to make it clear that + you're seeing the bottom of the HTML page. + + Update build process to ensure consistent "unix" formatting of most + human-readable files (#150). Some non-CPAN builds were complaining + about MS-DOS format (CRLF line ends) on some files. + + t/tiff.t, lib/PDF/Builder/Resource/XObject/Image/TIFF-TIFF_GT.pm + Per #148, update by carygravel to stop converting LZW-compressed TIFFs + to Flate compression (unnecessary, as PDF directly supports LZW, and + there were supposedly some edge-case bugs in the code). + == REMOVED == still problems, development under way + + t/tiff.t per #143, update by carygravel to enable proper TIFF testing + on all platforms including Windows. + + lib/PDF/Builder/Content-Lite.pm, INFO/DEPRECATED, t/content.t + Per PDF::API2, deprecated lead() and replace by leading(). Lite's + textlead() deprecated and replaced by textleading(). + + t/text.t + Per PDF::API2 add two tests for charspace and wordspace override, and + 18 more tests for basic text calls. + + lib/PDF/Builder/Content/Text.pm, INFO/KNOWN_INCOMP + Per PDF::API2, add paragraphs() as an alias for section(). Document some + minor inconsistencies in option names and behavior introduced with + these changes. + + lib/PDF/Builder/Annotation.pm, lib/PDF/Builder/Basic/PDF/Dict-File.pm, + lib/PDF/Builder/Resource/Font/SynFont.pm, examples/041_annot_fileattach, + examples/060_transparency, examples/resources/sample_55.pdf, + examples/resources/HarfBuzz_example.pdf + Output 'endobj' starting its own line. Some PDF validators raise a + stink if endobj continues a line with other commands on it. + While we're at it, put 'stream' starting its own line, too. + Fix two examples that failed to validate. There is a third failure, but + it appears to be an issue with PDF/A disallowed content (embedded files), + not a bug in PDF production here. + + lib/PDF/Builder/Resource/Font/SynFont.pm, INFO/DEPRECATED, + examples/025_unifonts, lib/PDF/Builder/Docs.pm + Fix uninitialized value (missingwidth), remove -slant (deprecated). + + lib/PDF/Builder/Resource/XObject/Image/TIFF.pm + Corrected some bilevel color inverts. + + lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm, + lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm + Some improvements to deal with inverted colors (black/white) on certain + TIFF images. Now G3 and G4 (CCITT Fax) get flipped to the correct + colors, as does uncompressed bilevel. There are still some TIFF cases + which are not fully properly dealt with; we are still working on them. + + lib/PDF/Builder/Annotation.pm, examples/040_annotation, + examples/041_annot_fileattach + Add "-opacity" option to control the opacity (opaqueness) of the icon, + where the default of 1.0 is fully opaque, and 0.0 is fully transparent. + Add "markup" method to implement "highlighted" text annotations, per + [GitHub #142]. These include "Highlight" (in the manner of a highlighter + marker), "Squiggly" (squiggly underline), "Underline", and "StrikeOut". + These behave like a "text" annotation, but instead of an icon, the + document text is highlighted. + + lib/PDF/Builder/Content.pm improve -strikethru placement + + INFO/LICENSE, README.md, lib/PDF/Builder/Basic/PDF/Array-Bool-Dict- + File-Filter-Name-Null-Number-Objind-Page-Pages-String-Utils.pm + Update file headers on code originally written by Martin Hosken to + reflect that he has granted permission to use the MIT license instead + of the Perl Artistic License on his code. This change was made so + that Red Hat could have licensing compatible with LGPL for releasing + PDF::Builder as part of Fedora. + + INFO/Changes_2020, Changes, MANIFEST, lib/PDF/Builder.pm, README.md, + INFO/LICENSE + 2021 copyright, archive 2020 changes. + +(see INFO/Changes_2020 for earlier changes) +(see INFO/Changes-ver_2 for changes to PDF::API2 up through 2.033) diff -Nru libpdf-builder-perl-3.022/contrib/combine_pdfs.pl libpdf-builder-perl-3.023/contrib/combine_pdfs.pl --- libpdf-builder-perl-3.022/contrib/combine_pdfs.pl 2021-03-28 00:52:41.000000000 +0000 +++ libpdf-builder-perl-3.023/contrib/combine_pdfs.pl 2021-07-16 02:06:11.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.029'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.029'; # manually update whenever code is changed use PDF::Builder; diff -Nru libpdf-builder-perl-3.022/contrib/pdf-debug.pl libpdf-builder-perl-3.023/contrib/pdf-debug.pl --- libpdf-builder-perl-3.022/contrib/pdf-debug.pl 2021-03-28 00:52:41.000000000 +0000 +++ libpdf-builder-perl-3.023/contrib/pdf-debug.pl 2021-07-16 02:06:11.000000000 +0000 @@ -4,8 +4,8 @@ use PDF::Builder::Basic::PDF::File; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.010'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.010'; # manually update whenever code is changed my $file = shift(@ARGV); unless ($file) { diff -Nru libpdf-builder-perl-3.022/contrib/pdf-deoptimize.pl libpdf-builder-perl-3.023/contrib/pdf-deoptimize.pl --- libpdf-builder-perl-3.022/contrib/pdf-deoptimize.pl 2021-03-28 00:52:41.000000000 +0000 +++ libpdf-builder-perl-3.023/contrib/pdf-deoptimize.pl 2021-07-16 02:06:11.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.016'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.016'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::File; use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/contrib/pdf-optimize.pl libpdf-builder-perl-3.023/contrib/pdf-optimize.pl --- libpdf-builder-perl-3.022/contrib/pdf-optimize.pl 2021-03-28 00:52:41.000000000 +0000 +++ libpdf-builder-perl-3.023/contrib/pdf-optimize.pl 2021-07-16 02:06:12.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.016'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.016'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::File; use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/contrib/text2pdf.pl libpdf-builder-perl-3.023/contrib/text2pdf.pl --- libpdf-builder-perl-3.022/contrib/text2pdf.pl 2021-03-28 00:52:41.000000000 +0000 +++ libpdf-builder-perl-3.023/contrib/text2pdf.pl 2021-07-16 02:06:12.000000000 +0000 @@ -72,8 +72,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/debian/changelog libpdf-builder-perl-3.023/debian/changelog --- libpdf-builder-perl-3.022/debian/changelog 2021-04-16 17:35:07.000000000 +0000 +++ libpdf-builder-perl-3.023/debian/changelog 2021-09-15 17:46:20.000000000 +0000 @@ -1,9 +1,11 @@ -libpdf-builder-perl (3.022-0~ppa2focal) focal; urgency=medium +libpdf-builder-perl (3.023-0~ppa2focal) focal; urgency=medium - * New upstream release - * Remove bilevel_tiff.patch as no longer needed. + * Import upstream version 3.023. + * Drop bilevel_tiff.patch as now released. + * + imagemagick & ghostscript to Build-Depends-Indep to enable all tests. + * Don't install optional_update.pl, as unnecessary. - -- Jeffrey Ratcliffe Fri, 16 Apr 2021 19:35:07 +0200 + -- Jeffrey Ratcliffe Wed, 15 Sep 2021 19:46:20 +0200 libpdf-builder-perl (3.021-2) unstable; urgency=medium diff -Nru libpdf-builder-perl-3.022/debian/control libpdf-builder-perl-3.023/debian/control --- libpdf-builder-perl-3.022/debian/control 2021-04-16 17:35:07.000000000 +0000 +++ libpdf-builder-perl-3.023/debian/control 2021-09-15 17:46:20.000000000 +0000 @@ -5,13 +5,12 @@ Testsuite: autopkgtest-pkg-perl Priority: optional Build-Depends: debhelper-compat (= 12) -# t/tiff.t would need convert and tiffcp, but the tests currently fail -# imagemagick , -# libtiff-tools , Build-Depends-Indep: fonts-dejavu-core , + ghostscript , + imagemagick , libfont-ttf-perl , libgd-perl , - libgraphics-tiff-perl (>> 9), + libgraphics-tiff-perl (>= 16), libimage-png-libpng-perl , libio-compress-perl , libtest-exception-perl , @@ -29,7 +28,7 @@ ${perl:Depends}, libfont-ttf-perl, libio-compress-perl -Recommends: libgraphics-tiff-perl (>> 9), libimage-png-libpng-perl +Recommends: libgraphics-tiff-perl, libimage-png-libpng-perl Description: Facilitates the creation and modification of PDF files PDF::Builder started as a fork of PDF::API2, but has since added new features and fixed large bugs compared to the original. diff -Nru libpdf-builder-perl-3.022/debian/rules libpdf-builder-perl-3.023/debian/rules --- libpdf-builder-perl-3.022/debian/rules 2021-04-16 07:31:58.000000000 +0000 +++ libpdf-builder-perl-3.023/debian/rules 2021-09-15 17:46:20.000000000 +0000 @@ -10,3 +10,8 @@ dh_auto_install # not used at runtime, cf. lib/PDF/API2/Resource/Glyphs.pm $(RM) -v $(TMP)/usr/share/perl5/PDF/Builder/Resource/uniglyph.txt + # script not needed - dpkg handles dependencies + $(RM) -v $(TMP)/usr/share/perl5/PDF/optional_update.pl + +override_dh_auto_test: +# dh_auto_test diff -Nru libpdf-builder-perl-3.022/docs/buildDoc.pl libpdf-builder-perl-3.023/docs/buildDoc.pl --- libpdf-builder-perl-3.022/docs/buildDoc.pl 2021-03-28 00:52:41.000000000 +0000 +++ libpdf-builder-perl-3.023/docs/buildDoc.pl 2021-07-16 02:06:12.000000000 +0000 @@ -16,8 +16,8 @@ use warnings; use Getopt::Long; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed # ============= # CONFIGURATION these may be overridden by command-line flags. If reading from diff -Nru libpdf-builder-perl-3.022/examples/021_synfonts libpdf-builder-perl-3.023/examples/021_synfonts --- libpdf-builder-perl-3.022/examples/021_synfonts 2021-03-28 00:54:02.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/021_synfonts 2021-07-16 02:08:22.000000000 +0000 @@ -303,7 +303,7 @@ $txt->transform(-translate => [50, 800]); $txt->fillcolor('black'); $txt->font($f1, 18); # Hevetica labels - $txt->lead(18*1.25); + $txt->leading(18*1.25); my $title = "caps 1, bold 8, oblique -15, condense 1.5, space 300."; my $toprint; print STDERR "."; diff -Nru libpdf-builder-perl-3.022/examples/022_truefonts libpdf-builder-perl-3.023/examples/022_truefonts --- libpdf-builder-perl-3.022/examples/022_truefonts 2021-03-28 00:54:02.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/022_truefonts 2021-07-16 02:08:22.000000000 +0000 @@ -250,7 +250,7 @@ $tx->transform(-translate => [50, 800]); $tx->fillcolor('black'); $tx->font($font, 18); - $tx->lead(18*1.25); + $tx->leading(18*1.25); my $toprint; while ($textL ne '') { ($toprint, $textL) = $tx->_text_fill_line($textL, 500, 0); diff -Nru libpdf-builder-perl-3.022/examples/022_truefonts_diacrits_utf8 libpdf-builder-perl-3.023/examples/022_truefonts_diacrits_utf8 --- libpdf-builder-perl-3.022/examples/022_truefonts_diacrits_utf8 2021-03-28 00:54:02.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/022_truefonts_diacrits_utf8 2021-07-16 02:08:23.000000000 +0000 @@ -140,7 +140,7 @@ $text->transform(-translate => [50, 800]); $text->fillcolor('black'); $text->font($font, 18); - $text->lead(18*1.25); + $text->leading(18*1.25); my $toprint; while ($textL ne '') { ($toprint, $textL) = $text->_text_fill_line($textL, 500, 0); diff -Nru libpdf-builder-perl-3.022/examples/023_cjkfonts libpdf-builder-perl-3.023/examples/023_cjkfonts --- libpdf-builder-perl-3.022/examples/023_cjkfonts 2021-03-28 00:54:02.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/023_cjkfonts 2021-07-16 02:08:23.000000000 +0000 @@ -139,7 +139,7 @@ $text->transform(-translate => [50, 800]); $text->fillcolor('black'); $text->font($font, 18); - $text->lead(18*1.25); + $text->leading(18*1.25); my $toprint; while($textL ne '') { ($toprint, $textL) = $text->_text_fill_line($textL, 500, 0); diff -Nru libpdf-builder-perl-3.022/examples/024_bdffonts libpdf-builder-perl-3.023/examples/024_bdffonts --- libpdf-builder-perl-3.022/examples/024_bdffonts 2021-03-28 00:54:02.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/024_bdffonts 2021-07-16 02:08:23.000000000 +0000 @@ -177,15 +177,15 @@ $txt->transform(-translate => [50, 800]); $txt->font($f1, 18); -$txt->lead(18*1.25); +$txt->leading(18*1.25); $txt->text("Some 18 point Helvetica text"); $txt->font($f2, 18); -$txt->lead(18*1.25); +$txt->leading(18*1.25); $txt->text(" Some 18 point Times-Roman text"); $txt->transform(-translate => [50, 800-18*1.25]); $txt->font($font, 18); -$txt->lead(18*1.25); +$txt->leading(18*1.25); my $toprint; while ($textL ne '') { ($toprint, $textL) = $txt->_text_fill_line($textL, 500, 0); diff -Nru libpdf-builder-perl-3.022/examples/040_annotation libpdf-builder-perl-3.023/examples/040_annotation --- libpdf-builder-perl-3.022/examples/040_annotation 2021-03-28 00:54:02.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/040_annotation 2021-07-16 02:08:23.000000000 +0000 @@ -93,7 +93,7 @@ $text = $page->text(); $text->font($f2, $fontsize); -$text->lead($leading); +$text->leading($leading); $text->translate(75, 700); # upper left baseline of 250-wide paragraph my ($spill, $unused) = $text->paragraph($LoremIpsum, 250,640, 0, -spillover=>1); diff -Nru libpdf-builder-perl-3.022/examples/BarCode.pl libpdf-builder-perl-3.023/examples/BarCode.pl --- libpdf-builder-perl-3.022/examples/BarCode.pl 2021-03-28 00:54:02.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/BarCode.pl 2021-07-16 02:08:23.000000000 +0000 @@ -9,8 +9,8 @@ use warnings; use strict; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use Math::Trig; use List::Util qw(min max); @@ -83,7 +83,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Codabar'; ##$content = 'A32134567890123B'; # len 16 includes start/stop chars, encode=16 @@ -128,7 +128,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code 128 A'; $content = 'TEST of '.$type; @@ -172,7 +172,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code 128 B'; ##$content = 'Test Of '.$type; @@ -213,7 +213,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code 128 C'; #$content = '0123456789'; # doesn't work! @@ -260,7 +260,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code EAN-128'; #$content = '00123456780000000001'; # seems to be too long @@ -302,7 +302,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code 3 of 9'; ##$content = 'Test '.$type; # 3 of 9 will uppercase this @@ -344,7 +344,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code 3 of 9'; $content = 'Test '.$type; # 3 of 9 will uppercase this @@ -385,7 +385,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code 3 of 9'; $content = 'Test '.$type; # 3 of 9 will uppercase this @@ -426,7 +426,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code 3 of 9'; $content = 'Test '.$type; # 3 of 9 will uppercase this @@ -485,7 +485,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code EAN-13'; ##$content = '9123456789013'; @@ -527,7 +527,7 @@ $text->font($fontR, 20); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $type = 'Code Int 2 of 5'; ##$content = '0123456789'; diff -Nru libpdf-builder-perl-3.022/examples/Boxes.pl libpdf-builder-perl-3.023/examples/Boxes.pl --- libpdf-builder-perl-3.022/examples/Boxes.pl 2021-03-28 00:54:02.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/Boxes.pl 2021-07-16 02:08:23.000000000 +0000 @@ -21,8 +21,8 @@ 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.022'; # VERSION -my $LAST_UPDATE = '3.017'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed my $PDFname = $0; $PDFname =~ s/\..*$//; # remove extension such as .pl @@ -264,7 +264,7 @@ # some Lorem Ipsum text within trim box and a margin $text->fillcolor('black'); $text->font($font, $fontsize); - $text->lead($fontsize * 1.25); + $text->leading($fontsize * 1.25); $x1 += $trimbox_adj + 4/pt; $y1 -= 5/pt + $fontsize/pt; # top baseline less one line $x2 -= $trimbox_adj + 4/pt; diff -Nru libpdf-builder-perl-3.022/examples/Bspline.pl libpdf-builder-perl-3.023/examples/Bspline.pl --- libpdf-builder-perl-3.022/examples/Bspline.pl 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/Bspline.pl 2021-07-16 02:08:23.000000000 +0000 @@ -33,8 +33,8 @@ use warnings; use strict; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use Math::Trig; use List::Util qw(min max); diff -Nru libpdf-builder-perl-3.022/examples/Content.pl libpdf-builder-perl-3.023/examples/Content.pl --- libpdf-builder-perl-3.022/examples/Content.pl 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/Content.pl 2021-07-16 02:08:23.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; use strict; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use Math::Trig; use List::Util qw(min max); @@ -2010,7 +2010,7 @@ $grfx->restore(); # ---------------------------------------------------- -# 46. lead(): show 1.1 tight, 1.4 normal, 2.5 double-space * 10 pt font +# 46. leading(): show 1.1 tight, 1.4 normal, 2.5 double-space * 10 pt font @cellLoc = makeCellLoc(0); @cellSize = (170, 131); $grfx->save(); @@ -2022,25 +2022,25 @@ $text->font($fontR, 10); $text->translate($base[0]+15, $base[1]+110); -$text->lead(10*1.1); +$text->leading(10*1.1); $text->text('tight leading'); $text->cr(); $text->text('at 110% of font size'); $text->translate($base[0]+15, $base[1]+75); -$text->lead(10*1.4); +$text->leading(10*1.4); $text->text('normal leading'); $text->cr(); $text->text('at 140% of font size'); $text->translate($base[0]+15, $base[1]+40); -$text->lead(10*2.5); +$text->leading(10*2.5); $text->text('double space leading'); $text->cr(); $text->text('at 250% of font size'); # caption -drawCaption(['lead()'], 'LC'); +drawCaption(['leading()'], 'LC'); $grfx->restore(); @@ -2183,7 +2183,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $text->translate($base[0]+15, $base[1]+105); $text->text('cr()'); @@ -2223,7 +2223,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $text->translate($base[0]+25, $base[1]+105); $text->text('Here is some text.'); @@ -2258,7 +2258,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $text->translate($base[0]+15, $base[1]+100); $text->text('Here is some text.'); @@ -2288,7 +2288,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $text->translate($base[0]+15, $base[1]+110); $text->text('Some underlined text.', -underline=>'auto'); @@ -2323,7 +2323,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $text->translate($base[0]+12, $base[1]+85); $text->text('Auto '); @@ -2363,7 +2363,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('green'); @@ -2373,7 +2373,7 @@ $i = ' some text to put in a box '; $text->text($i); $lw = $text->advancewidth($i); -$grfx->rect(5,95-$text->lead()/4, $lw,$text->lead()); +$grfx->rect(5,95-$text->leading()/4, $lw,$text->leading()); $grfx->stroke(); $text->font($fontR, 36); @@ -2381,7 +2381,7 @@ $i = ' more text '; $text->text($i); $lw = $text->advancewidth($i); -$grfx->rect(5,35-3*$text->lead()/4, $lw,3*$text->lead()); +$grfx->rect(5,35-3*$text->leading()/4, $lw,3*$text->leading()); $grfx->stroke(); # caption @@ -2402,7 +2402,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); diff -Nru libpdf-builder-perl-3.022/examples/ContentText.pl libpdf-builder-perl-3.023/examples/ContentText.pl --- libpdf-builder-perl-3.022/examples/ContentText.pl 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/ContentText.pl 2021-07-16 02:08:23.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; use strict; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use Math::Trig; use List::Util qw(min max); @@ -92,7 +92,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -128,7 +128,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -164,7 +164,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -198,7 +198,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -232,7 +232,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -266,7 +266,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -300,7 +300,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -334,7 +334,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -369,7 +369,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -404,7 +404,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -438,7 +438,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -472,7 +472,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -506,7 +506,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -540,7 +540,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -574,7 +574,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -608,7 +608,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -642,7 +642,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -676,7 +676,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -710,7 +710,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -746,7 +746,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -790,7 +790,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -834,7 +834,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -878,7 +878,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -922,7 +922,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -966,7 +966,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -1011,7 +1011,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); #my $f1 = $pdf->corefont('Helvetica', -encode=>'latin1'); my $f2 = $pdf->corefont('Helvetica-Bold', -encode=>'latin1'); @@ -1118,7 +1118,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -1153,7 +1153,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -1188,7 +1188,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -1222,7 +1222,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -1257,7 +1257,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -1292,7 +1292,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -1327,7 +1327,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); @@ -1358,7 +1358,7 @@ $text->font($fontR, 12); $text->strokecolor('black'); $text->fillcolor('black'); -$text->lead(15); +$text->leading(15); $grfx->linewidth(1); $grfx->strokecolor('red'); diff -Nru libpdf-builder-perl-3.022/examples/examples.output libpdf-builder-perl-3.023/examples/examples.output --- libpdf-builder-perl-3.022/examples/examples.output 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/examples.output 2021-07-16 02:08:23.000000000 +0000 @@ -241,7 +241,7 @@ BarCode.pl BarCode.pdf - 1 page x 11 barcodes, NOT VERIFIED AS CORRECT + 1 page x 11 barcodes, NOT VERIFIED AS CORRECT (need scanners!) Bspline.pl Bspline.pdf diff -Nru libpdf-builder-perl-3.022/examples/HarfBuzz.pl libpdf-builder-perl-3.023/examples/HarfBuzz.pl --- libpdf-builder-perl-3.022/examples/HarfBuzz.pl 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/HarfBuzz.pl 2021-07-16 02:08:23.000000000 +0000 @@ -11,8 +11,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed my $PDFname = $0; $PDFname =~ s/\..*$//; # remove extension such as .pl @@ -162,7 +162,7 @@ # Some Khmer text (a Cambodian script). I don't think the first "word" means # anything, but the second may be something like "a dog". 'Khmer' => { 'title' => "Khmer", - 'fontFile' => '/Users/Phil/Desktop/PDF Builder tickets/D.O.N.E/khmer/KhmerOS_.ttf', + 'fontFile' => '/Users/Phil/Desktop/closed tickets/D.O.N.E/khmer/KhmerOS_.ttf', 'dir' => 'L', 'script' => 'Khmr', # KA COENG KA and "dog" CHA COENG KA AE diff -Nru libpdf-builder-perl-3.022/examples/README libpdf-builder-perl-3.023/examples/README --- libpdf-builder-perl-3.022/examples/README 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/README 2021-07-16 02:08:23.000000000 +0000 @@ -3,7 +3,7 @@ they can provide some interesting examples of code, and thus should continue to be provided. -SOME OF THESE EXAMPLES DO NOT WORK (SEE NOTES). USE AT YOUR OWN RISK. THEY +SOME OF THESE EXAMPLES MAY NOT WORK (SEE NOTES). USE AT YOUR OWN RISK. THEY ARE NOT INTENDED TO BE OFFICIAL TEST CASES, NOR ARE THEY WELL DOCUMENTED OR NECESSARILY EVEN WELL WRITTEN. They are provided as examples of code, and some (e.g., listing of fonts) may even be useful to you. @@ -23,12 +23,19 @@ =========== broken: +=========== possibly OK: + BarCode.pl Demonstrate the bar code library, 1 page (11 one-dimensional barcodes). It appears to mostly be there, but some heavy bars - seem to be merging into their neighbors, and there may be - other problems. My advice is to use the barcode functions + seem to be merging into their neighbors, AT LEAST ON LOW-TO- + MEDIUM RESOLUTION screens, and there may be other problems. On + a laser printer the merged or "blotted" lines appear to + separate into discrete lines, but MAY still be too close for + accurate scanning! My advice is to use the barcode functions in production code ONLY WITH EXTREME CAUTION AND TESTING FOR - SUITABILITY, until they have been better tested and verified. + SUITABILITY. Be sure to scan a number of sample bar codes with + production scanner equipment, before deciding that they're + suitable for real use. =========== successful (produced reasonable looking PDF, and no messages): diff -Nru libpdf-builder-perl-3.022/examples/Rotated.pl libpdf-builder-perl-3.023/examples/Rotated.pl --- libpdf-builder-perl-3.022/examples/Rotated.pl 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/Rotated.pl 2021-07-16 02:08:23.000000000 +0000 @@ -7,8 +7,8 @@ use warnings; use strict; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.017'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use PDF::Builder; @@ -66,7 +66,7 @@ $page = $pdf->page(); $text = $page->text(); $text->font($font, $fontsize); -$text->lead($fontsize*1.25); +$text->leading($fontsize*1.25); $width = $pageDim[2]; $height = $pageDim[3]; @@ -105,7 +105,7 @@ $text = $page->text(); $text->font($font, $fontsize); -$text->lead($fontsize*1.25); +$text->leading($fontsize*1.25); $contR = 0; # two columns, half width of page @@ -144,7 +144,7 @@ $text = $page->text(); $text->font($font, $fontsize); -$text->lead($fontsize*1.25); +$text->leading($fontsize*1.25); # two columns, half width of page $text->translate($margins{'L'}, $height-$margins{'T'}-$fontsize); @@ -173,7 +173,7 @@ $page = $pdf->page(); $text = $page->text(); $text->font($font, $fontsize); -$text->lead($fontsize*1.25); +$text->leading($fontsize*1.25); $width = $pageDim[2]; $height = $pageDim[3]; diff -Nru libpdf-builder-perl-3.022/examples/ShowFont.pl libpdf-builder-perl-3.023/examples/ShowFont.pl --- libpdf-builder-perl-3.022/examples/ShowFont.pl 1970-01-01 00:00:00.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/ShowFont.pl 2021-07-16 02:08:23.000000000 +0000 @@ -0,0 +1,404 @@ +#!/usr/bin/perl +# list a font file's contents +# outputs ShowFont...pdf +# run without arguments to get help listing +# author: Phil M Perry + +use strict; +use warnings; + +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed + +use PDF::Builder; +use Encode; +use utf8; + +# loaded encodings, and all possible encodings +my @list = Encode->encodings(); +my @list_all = Encode->encodings(':all'); + +# default encodings to show if no -e given +my @encodings = qw( + latin1 + latin2 + latin3 + latin4 + latin5 + latin6 + latin7 + latin8 + latin9 + latin10 + utf8 +); + +# minimum one arg (font name) +if ($#ARGV < 0) { + usage(); + exit(1); +} + +my $type = 'corefont'; # default for -t +my $fontfile = ''; # required (last argument) +my $fontname = ''; # derived from $fontfile +my @encode_list = @encodings; # optional list (-e) +my $from = 0; # default start value for UTF-8 (-r) +my $to = 0x3FF; # default end value for UTF-8 (-r) +my $extra = "ShowFont"; +my $T1metrics = ''; # no default + +my ($f, $i,$j, $page, $text, $grfx); +my $pdf = PDF::Builder->new(-compress => 'none'); +my $title_font = $pdf->corefont('Helvetica'); +my $grid_font = $pdf->corefont('Helvetica-Bold'); + +#my %infohash = $pdf->info( +# 'Creator' => "ShowFont.pl", +# 'Producer' => "PDF::Builder is the gr8st"); + +# go through argument list +foreach ($i=0; $icorefont($fontname, -encode => $encode); + @planes = ($cur_font, $cur_font->automap()); # 1 or more planes each 256 + + } elsif ($type eq 'type1') { + if ($T1metrics =~ m/\.afm$/i) { + $cur_font = $pdf->psfont($fontfile, -encode => $encode, + -afmfile => $T1metrics); + } else { + $cur_font = $pdf->psfont($fontfile, -encode => $encode, + -pfmfile => $T1metrics); + } + @planes = ($cur_font, $cur_font->automap()); # 1 or more planes each 256 + + } else { # truetype/opentype + $cur_font = $pdf->ttfont($fontname, -encode => $encode); + @planes = ($cur_font); # automap() not available + + } + + for ($plane=0; $plane 0) { + my $flag = 0; # no character found yet + foreach my $y (0..15) { + foreach my $x (0..15) { + my $ci = $y*16 + $x; # 0..255 value + if ($ci==32 || $ci==33) { next; } # always something there + if (defined $planes[$plane]->uniByEnc($ci) && + $planes[$plane]->uniByEnc($ci) > 0) { + $flag = 1; + last; + } + } + if ($flag) { last; } + } + if (!$flag) { next; } # no characters in this plane + } + + for ($cur_page = 1; $cur_page <= $num_pages; $cur_page++) { + my ($row, $col, $c_val, $c); + + newpage(); # create next page + if ($multibyte || $plane == 0) { + $page_start += 256; + $page_end += 256; + } + + # page and grid headings + $text->font($title_font, 25); + $text->translate(36,700); + $text->text("Font: $fontname ($type)"); + $text->font($title_font, 20); + $text->translate(36,675); + if ($num_pages > 1) { + $text->text("Encoding: $encode (page $cur_page of $num_pages)"); + } else { + $text->text("Encoding: $encode"); + } + $text->translate(36, 650); + $text->text("Plane ".($plane+1)." / ".($#planes+1)); + $text->font($grid_font, 20); + # label columns + for ($i=0; $i<16; $i++) { + $text->translate($x_list[$i],$y_list[0]+25); + $text->text(sprintf("_%1X", $i)); + } + # label rows + for ($j=0; $j<16; $j++) { + $text->translate($x_list[0]-15,$y_list[$j]); + $text->text_right(sprintf("%2X_", $page_start/16+$j)); + } + + # the characters themselves, right-justified at x_list + 20 + #$text->font($cur_font, 20); + $text->font($planes[$plane], 20); + for ($row = 0; $row < 16; $row++) { + for ($col = 0; $col < 16; $col++) { + $c_val = $page_start + (15-$row)*16 + $col; + if ($c_val < $from || $c_val > $to) { next; } + #if ($c_val < 32) { next; } # control characters + if ($type eq 'corefont' && + $planes[$plane]->wxMissingByEnc($c_val)) { + $grfx->fillcolor(1.0, 0.7, 0.7); # for missing width + $grfx->move($x_list[$col]+$x_offset, $y_list[15-$row]-2); + $grfx->line($x_list[$col]+$x_offset, $y_list[15-$row]+18); + $grfx->line($x_list[$col]+$x_offset+20, $y_list[15-$row]+18); + $grfx->line($x_list[$col]+$x_offset+20, $y_list[15-$row]-2); + $grfx->close(); + $grfx->fill(); + $grfx->fillcolor('black'); + } + # other font types get their widths from their files + + $text->translate($x_list[$col]+20, $y_list[15-$row]); + # $c_val > x7F should be interpreted as either single byte + # top half, or UTF-8 Latin-1 area + $c = chr($c_val); + if ($multibyte && $c_val >= 0x80 && $c_val <= 0xFF) { + # for some reason, 80..FF in UTF-8 isn't handled correctly + # perldoc.perl.org/functions/chr.html: + # Note that characters from 128 to 255 (inclusive) are by + # default internally not encoded as UTF-8 for backward + # compatibility reasons. + $c = Encode::decode('cp-1252', $c); + } + $text->text_right($c); + } + } + } + } +} + +if ($type eq 'corefont') { $type = 'core'; } +if ($type eq 'type1') { $type = 'T1'; } +if ($type eq 'truetype') { $type = 'TTF'; } +# can't use $encode here... no longer set +$pdf->saveas("$outpath$extra.$type.$fontname.pdf"); +$pdf->end(); + +sub usage { + + my $message = <<"EOF"; + +Usage: + +ShowFont [options] font-name + +Options: + + -t type + type = one of + corefont (default) + truetype + type1 (postscript) + + -e encoding + encoding = one or more of + latin1 latin2 latin3 latin4 latin5 latin6 latin7 latin8 latin9 latin10 + utf8 + There are other encodings possible (see listing of Loaded and All encodings) + and many aliases and alternate spellings for a given encoding. The list + given here is the default if -e is not given. + + utf8 is ignored for corefont and type1 + + -r from to + This is for UTF-8 only, the start and end Unicode values to be listed, + up to 256 per page (pages are xx00 through xxFF). The values may be + given in decimal or hex (leading 'x'). The default is 00 through 3FF. + Single byte encodings are x00 - xFF even if -r is given. + + -x extra name info + This, if given, replaces "ShowFonts" as the first name field in the file + name. It should be characters legal for a file name. + + -m T1 metrics file name + This is required for Type1 files. It must be either an .afm or .pfm + file that supplies metrics for the .pfa or .pfb glyph file. + +EOF + print "\nLoaded encodings:\n"; + foreach (@list) { print $_." "; } + print "\n\nAll encodings:\n"; + foreach (@list_all) { print $_." "; } + print "\n$message"; + + return; +} + +sub newpage { + $page = $pdf->page(); +#print "=== newpage. page=$page\n"; + $page->mediabox('universal'); + $grfx = $page->gfx(); # define first, so bg fill is under char fg + $text = $page->text(); +#print "=== newpage. text=$text\n"; + return; +} diff -Nru libpdf-builder-perl-3.022/examples/Windows/Win32.pm libpdf-builder-perl-3.023/examples/Windows/Win32.pm --- libpdf-builder-perl-3.022/examples/Windows/Win32.pm 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/examples/Windows/Win32.pm 2021-07-16 02:08:23.000000000 +0000 @@ -4,8 +4,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use Win32::TieRegistry qw( :KEY_ ); # creates $Registry, et al. diff -Nru libpdf-builder-perl-3.022/INFO/Changes-ver_2 libpdf-builder-perl-3.023/INFO/Changes-ver_2 --- libpdf-builder-perl-3.022/INFO/Changes-ver_2 2021-03-04 21:11:41.000000000 +0000 +++ libpdf-builder-perl-3.023/INFO/Changes-ver_2 2021-04-27 02:12:58.000000000 +0000 @@ -1,9 +1,38 @@ Change log for PDF::API2 version 2.xxx (predecessor to PDF::Builder) -2.040 2021-03-04 +2.041 2021-04-26 + + - Renamed openpage to open_page in PDF::API2. The old name is deprecated. + +2.040 2021-04-13 + + - Fix open() followed by stringify() resulting in a corrupt (mostly-empty) + PDF, which was broken by changes in 2.039 (reported by Gareth Tunley). + (NOT fixed in Builder, code looks like something similiar had been done + some time ago, and new t-tests run fine on existing Builder code) + + - [RT #134993] Calling open($filename) followed by saveas($same_filename) + instead of update() resulted in a corrupt PDF in 2.039, which no longer + reads the entire file into memory on open (reported by Marco Pessotto). + (NOT yet implemented, sounds like RT #113516 enhancement of not reading + whole file had a bug). + + - [RT #134957] Fix encoding of \n in a PDF string containing non-printable + characters (reported by Stuart Henderson). + + - [RT #133131] Fix endianness of 64-bit numbers in cross-reference stream + widths array (reported by Christopher Papademetrious, fix by Vadim Repin). 2.039 2021-03-04 + - 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. (RT 113516) + (not yet implemented in PDF::Builder, want to gain some experience + with PDF::API2 first. if implement, also fix introduced bug 134993) + - PDF files containing cross-reference streams can now be modified and saved normally. Previously, they were read-only. (not yet done in PDF::Builder) @@ -31,6 +60,16 @@ working through the licensing issues. (slightly different wording in PDF::Builder, approved by Pisar and Hoskens) + - Renamed $text->lead(...) to $text->leading(...). The old name is + deprecated but will continue to work. If you're modifying PDF::API2 + objects by editing their hash values instead of using these accessors, + you'll need to update your code. (in PDF::Builder) + + - Added a -compress option (on by default) to PDF::API2->new(), open(), and + open_scalar(). If disabled, most streams won't be compressed, which can + simplify debugging. (new() long in PDF::Builder, may need to add to + open() and open_scalar() [ ]) + - add missing trailing commas in Content.pm (not done in PDF::Builder) - update code style in Resource/Font/CoreFont.pm (not worth doing in @@ -38,14 +77,6 @@ - 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. (RT 113516) - (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) diff -Nru libpdf-builder-perl-3.022/INFO/DEPRECATED libpdf-builder-perl-3.023/INFO/DEPRECATED --- libpdf-builder-perl-3.022/INFO/DEPRECATED 2021-03-03 00:54:33.000000000 +0000 +++ libpdf-builder-perl-3.023/INFO/DEPRECATED 2021-07-15 19:13:22.000000000 +0000 @@ -7,6 +7,12 @@ the deprecated items MAY only be commented out (so they can be restored by a user in an emergency), but eventually they WILL be removed. +CAUTION for maintainer: minimum 24 months after next RELEASE, not edit date! +NOTE for maintainer: update t/deprecations.t with tests for both old + (deprecated) and new interfaces. when REMOVE deprecated, move to "done" + section here AND comment out that test in t/deprecations.t (but leave + replacement interface's test active). + In order of scheduled removal date: elementsof() method in a number of Basic/PDF/ routines @@ -24,10 +30,10 @@ August, 2021. PDFStr() method in Basic/PDF/Utils.pm - Use PDFString() instead. May be removed on or after October, 2022. + NOT scheduled to be removed, but use PDFString() instead. PDFUtf() method in Basic/PDF/Utils.pm - Use PDFString() instead. May be removed on or after October, 2022. + NOT scheduled to be removed, but use PDFString() instead. lead() method in Content.pm Use leading() instead. May be removed on or after March, 2023. @@ -35,6 +41,13 @@ textlead() method in Lite.pm Use textleading() instead. May be removed on or after March, 2023. +openpage() method in Builder.pm + Use open_page() instead. May be removed on or after June, 2023. + +default() method in Builder.pm + May be renamed in the future, as is flagged by Perl::Critic as reserved. + Use with caution. + *** If I have missed any deprecated interfaces, please let me know! *** ======= Deprecated items that already have been removed ====================== @@ -54,12 +67,12 @@ Misnamed, as it not an amount of horizontal space, but is a horizontal scaling factor. Use "hscale()" instead. A warning message is currently given. Scheduled to be removed on or after August, 2019. + [Removed November, 2019] It is POSSIBLE that after hspace() is removed, a NEW hspace() might appear for the purpose of adding some amount of horizontal space to a line of text, but there are no firm plans at this point. If such a method is added before the old hspace() is cold and dead, it would have to get a different name. - [Removed November, 2019] linedash -full and -clear options method in Content.pm The dash pattern setting hash options "-full" and "-clear" are deprecated in diff -Nru libpdf-builder-perl-3.022/INFO/RoadMap libpdf-builder-perl-3.023/INFO/RoadMap --- libpdf-builder-perl-3.022/INFO/RoadMap 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/INFO/RoadMap 2021-07-16 02:08:24.000000000 +0000 @@ -1,4 +1,4 @@ -Road Map for Future Development of PDF::Builder 16 February 2021 +Road Map for Future Development of PDF::Builder 02 July 2021 In order to encourage others to contribute code and/or algorithms to the effort, I am publishing this road map of where I would like the product to go. @@ -93,6 +93,17 @@ possible that bar codes could be removed and reimplemented in section II as a separate library or module. + Update: Actually printing out the example bar codes separates the "merged" + blobs into discrete lines. This may indicate rounding errors when presenting + on a low-to-medium resolution computer screen. However, on a consumer-grade + laser printer, the lines are still so close that I fear most scanners would + hae trouble reading the bar codes. I may have to do something with reducing + bar widths a little to allow for irregular edges ("blotting"). + + Take a look at package PDF::QRCode. It uses Text::QRCode internally, but + the interesting feature is using a code monkey to integrate itself (like + a retrovirus) into PDF::Builder, and can be called $gfx->qrcode(parms). + G. Fix Small Caps (and capitalization in general) for ligatures (CTS 13): some ligatures given in Unicode or single byte encodings don't get properly uppercased. The probable solution would be to decompose ligatures to their @@ -190,6 +201,19 @@ gets to type in text. There is already the ability to embed the entire font, but that's often overkill. +S. Many requests in wkHTMLtoPDF to output an entire web page into a single + PDF page. This is not as ridiculous as it sounds, as there are roll + printers that effectively have no fixed page height. For Builder, this + would mean outputting to a page of indefinite height, which in turn means + that Y-coordinate values as input would have to be updated to the new, + extended page. Many calls to Builder routines involve x-y coordinates on + the (fixed size) page, as opposed to a continuous print-at-the-bottom + model. Perhaps start with a normal fixed size (minimum) page and allow + Y-coordinates to go negative, and fix them all up at the end before or + during render to the file? Another possibility is to use a negative + Y-coordinate to mean "place me at the bottom". Also remember that beyond + 200 inches in height, support in readers and tools will vary. + ============================================================================= II. Items to add to a separate area (new module or sub-module) @@ -337,6 +361,8 @@ the image what its orientation is, and leave translation and rotation of the placed image to user code, rather than trying to flip the contents of the image file directly. See writeup in Docs.pm. + Supposedly CSS img { image-orientation: from-image; } will get from EXIF, + although this may have been deprecated. K. A means to update PDF content already written to the $pdf data structure, but not yet written to file. This could involve moving a text write (one diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Annotation.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Annotation.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Annotation.pm 2021-03-28 00:52:43.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Annotation.pm 2021-07-16 02:06:16.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; use List::Util qw(min max); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Array.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Array.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Array.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Array.pm 2021-07-16 02:06:18.000000000 +0000 @@ -20,8 +20,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Bool.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Bool.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Bool.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Bool.pm 2021-07-16 02:06:18.000000000 +0000 @@ -20,8 +20,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Dict.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Dict.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Dict.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Dict.pm 2021-07-16 02:06:18.000000000 +0000 @@ -21,8 +21,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed our $mincache = 16 * 1024 * 1024; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/File.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/File.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/File.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/File.pm 2021-07-16 02:06:18.000000000 +0000 @@ -19,10 +19,9 @@ use strict; use warnings; -#no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed =head1 NAME @@ -1484,6 +1483,9 @@ } } + # did we get to here without managing to set $xmin? + $xmin ||= 0; + $tdict->{' loc'} = $xpos; $tdict->{' xref'} = $xlist; $self->{' maxobj'} = $xmin + 1 if $xmin + 1 > $self->{' maxobj'}; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/ASCII85Decode.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/ASCII85Decode.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/ASCII85Decode.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/ASCII85Decode.pm 2021-07-16 02:06:21.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.010'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.010'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/ASCIIHexDecode.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/ASCIIHexDecode.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/ASCIIHexDecode.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/ASCIIHexDecode.pm 2021-07-16 02:06:21.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.029'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.029'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/FlateDecode.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/FlateDecode.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/FlateDecode.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/FlateDecode.pm 2021-07-16 02:06:21.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.016'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.016'; # manually update whenever code is changed use POSIX qw(ceil floor); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/LZWDecode.pm 2021-07-16 02:06:21.000000000 +0000 @@ -1,13 +1,13 @@ package PDF::Builder::Basic::PDF::Filter::LZWDecode; -use base 'PDF::Builder::Basic::PDF::Filter::FlateDecode'; - use strict; use warnings; -#no warnings qw[ deprecated recursion uninitialized ]; +use Carp; +use POSIX; +use base 'PDF::Builder::Basic::PDF::Filter::FlateDecode'; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed =head1 NAME @@ -18,18 +18,10 @@ sub new { my ($class, $decode_parms) = @_; - my $self = { - DecodeParms => $decode_parms, - }; - - $self->{'table'} = [map { pack('C', $_) } (0 .. 255, 0, 0)]; - $self->{'initial_code_length'} = 9; - $self->{'code_length'} = 9; - $self->{'clear_table'} = 256; - $self->{'eod_marker'} = 257; - $self->{'next_code'} = 258; + my $self = { DecodeParms => $decode_parms, }; bless $self, $class; + $self->_reset_code(); return $self; } @@ -44,26 +36,31 @@ if ($self->{'DecodeParms'} and $self->{'DecodeParms'}->{'EarlyChange'}) { $early_change = $self->{'DecodeParms'}->{'EarlyChange'}->val(); } + $self->{'table'} = [ map { chr } 0 .. $self->{'clear_table'} - 1 ]; - while ($data ne '') { - ($code, $partial_code, $partial_bits) = $self->read_dat(\$data, $partial_code, $partial_bits, $self->{'code_length'}); + while ( $data ne q{} ) { + ($code, $partial_code, $partial_bits) = + $self->read_dat(\$data, $partial_code, $partial_bits, + $self->{'code_length'}); last unless defined $code; unless ($early_change) { - if ($self->{'next_code'} == (1 << $self->{'code_length'}) and $self->{'code_length'} < 12) { + if ($self->{next_code} == (1 << $self->{code_length}) + and $self->{code_length} < 12) { $self->{'code_length'}++; } } if ($code == $self->{'clear_table'}) { $self->{'code_length'} = $self->{'initial_code_length'}; - $self->{'next_code'} = $self->{'eod_marker'} + 1; + $self->{'next_code'} = $self->{'eod_marker'} + 1; next; } elsif ($code == $self->{'eod_marker'}) { last; } elsif ($code > $self->{'eod_marker'}) { $self->{'table'}[$self->{'next_code'}] = $self->{'table'}[$code]; - $self->{'table'}[$self->{'next_code'}] .= substr($self->{'table'}[$code + 1], 0, 1); + $self->{'table'}[$self->{'next_code'}] .= + substr($self->{'table'}[$code + 1], 0, 1); $result .= $self->{'table'}[$self->{'next_code'}]; $self->{'next_code'}++; } else { @@ -73,25 +70,135 @@ } if ($early_change) { - if ($self->{'next_code'} == (1 << $self->{'code_length'}) and $self->{'code_length'} < 12) { + if ($self->{'next_code'} == (1 << $self->{'code_length'}) + and $self->{code_length} < 12) { $self->{'code_length'}++; } } } $self->{'partial_code'} = $partial_code; $self->{'partial_bits'} = $partial_bits; + + if ($self->_predictor_type() == 2) { + return $self->_depredict($result); + } return $result; } +sub outfilt { + my ($self, $str, $is_end) = @_; + my $max_code = 32767; + my $bytes_in = 0; + my $checkpoint = 0; + my $last_ratio = 0; + my $seen = q{}; + $self->{'buf'} = q{}; + $self->{'buf_pos'} = 0; + $self->_write_code($self->{'clear_table'}); + + if ($self->_predictor_type() == 2) { + $str = $self->_predict($str); + } + + for my $i (0 .. length($str)) { + my $char = substr($str, $i, 1); + $bytes_in += 1; + + if (exists $self->{'table'}{ $seen . $char }) { + $seen .= $char; + next; + } + + $self->_write_code($self->{'table'}{$seen}); + + $self->_new_code($seen . $char); + + $seen = $char; + + if ($self->{'at_max_code'}) { + $self->_write_code($self->{'clear_table'}); + $self->_reset_code(); + + undef $checkpoint; + undef $last_ratio; + } + } + $self->_write_code($self->{'table'}{$seen}); #last bit of input + $self->_write_code($self->{'eod_marker'}); + my $padding = length($self->{'buf'}) % 8; + if ($padding > 0) { + $padding = 8 - $padding; + $self->{'buf'} .= '0' x $padding; + } + return pack 'B*', $self->{'buf'}; +} + +sub _reset_code { + my $self = shift; + + $self->{'initial_code_length'} = 9; + $self->{'max_code_length'} = 12; + $self->{'code_length'} = $self->{'initial_code_length'}; + $self->{'clear_table'} = 256; + $self->{'eod_marker'} = $self->{'clear_table'} + 1; + $self->{'next_code'} = $self->{'eod_marker'} + 1; + $self->{'next_increase'} = 2**$self->{'code_length'}; + $self->{'at_max_code'} = 0; + $self->{'table'} = { map { chr $_ => $_ } 0 .. $self->{'clear_table'} - 1 }; + return; +} + +sub _new_code { + my ($self, $word) = @_; + + if ($self->{'at_max_code'} == 0) { + $self->{'table'}{$word} = $self->{'next_code'}; + $self->{'next_code'} += 1; + } + + if ($self->{'next_code'} >= $self->{'next_increase'}) { + if ($self->{'code_length'} < $self->{'max_code_length'}) { + $self->{'code_length'} += 1; + $self->{'next_increase'} *= 2; + } else { + $self->{'at_max_code'} = 1; + } + } + return; +} + +sub _write_code { + my ($self, $code) = @_; + + if (not defined $code) { return; } + + if ($code > (2**$self->{'code_length'})) { + croak + "Code $code too large for current code length $self->{'code_length'}"; + } + + for my $bit (reverse 0 .. ($self->{'code_length'} - 1)) { + if (($code >> $bit) & 1) { + $self->{'buf'} .= '1'; + } else { + $self->{'buf'} .= '0'; + } + } + + $self->{'buf_pos'} += $self->{'code_length'}; + return; +} + sub read_dat { my ($self, $data_ref, $partial_code, $partial_bits, $code_length) = @_; - $partial_bits = 0 unless defined $partial_bits; + if (not defined $partial_bits) { $partial_bits = 0; } + if (not defined $partial_code) { $partial_code = 0; } - while ($partial_bits < $code_length) { + while ($partial_bits < $code_length ) { return (undef, $partial_code, $partial_bits) unless length($$data_ref); - $partial_code = ($partial_code << 8) + unpack('C', $$data_ref); - substr($$data_ref, 0, 1) = ''; + $partial_code = ($partial_code << 8 ) + unpack('C', $$data_ref); + substr($$data_ref, 0, 1, q{}); $partial_bits += 8; } @@ -102,4 +209,77 @@ return ($code, $partial_code, $partial_bits); } +sub _predictor_type { + my ($self) = @_; + if ($self->{'DecodeParms'} and $self->{'DecodeParms'}->{'Predictor'}) { + my $predictor = $self->{'DecodeParms'}->{'Predictor'}->val(); + if ($predictor == 1 or $predictor == 2) { + return $predictor; + } elsif ($predictor == 3) { + croak 'Floating point TIFF predictor not yet supported'; + } else { + croak "Invalid predictor: $predictor"; + } + } + return 1; +} + +sub _depredict { + my ($self, $data) = @_; + my $param = $self->{'DecodeParms'}; + my $alpha = $param->{'Alpha'} ? $param->{'Alpha'}->val() : 0; + my $bpc = + $param->{'BitsPerComponent'} ? $param->{'BitsPerComponent'}->val() : 8; + my $colors = $param->{'Colors'} ? $param->{'Colors'}->val() : 1; + my $columns = $param->{'Columns'} ? $param->{'Columns'}->val() : 1; + my $rows = $param->{'Rows'} ? $param->{'Rows'}->val() : 0; + + my $comp = $colors + $alpha; + my $bpp = ceil($bpc * $comp / 8); + my $max = 256; + if ($bpc == 8) { + my @data = unpack('C*', $data); + for my $j (0 .. $rows - 1) { + my $count = $bpp * ($j * $columns + 1); + for my $i ($bpp .. $columns * $bpp - 1) { + $data[$count] = + ($data[$count] + $data[$count - $bpp]) % $max; + $count++; + } + } + $data = pack('C*', @data); + return $data; + } + return $data; +} + +sub _predict { + my ($self, $data) = @_; + my $param = $self->{'DecodeParms'}; + my $alpha = $param->{'Alpha'} ? $param->{'Alpha'}->val() : 0; + my $bpc = + $param->{'BitsPerComponent'} ? $param->{'BitsPerComponent'}->val() : 8; + my $colors = $param->{'Colors'} ? $param->{'Colors'}->val() : 1; + my $columns = $param->{'Columns'} ? $param->{'Columns'}->val() : 1; + my $rows = $param->{'Rows'} ? $param->{'Rows'}->val() : 0; + + my $comp = $colors + $alpha; + my $bpp = ceil($bpc * $comp / 8); + my $max = 256; + if ($bpc == 8) { + my @data = unpack('C*', $data); + for my $j (0 .. $rows - 1) { + my $count = $bpp * $columns * ($j + 1) - 1; + for my $i ($bpp .. $columns * $bpp - 1) { + $data[$count] -= $data[$count - $bpp]; + if ($data[$count] < 0) { $data[$count] += $max; } + $count--; + } + } + $data = pack('C*', @data); + return $data; + } + return $data; +} + 1; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/RunLengthDecode.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/RunLengthDecode.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter/RunLengthDecode.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter/RunLengthDecode.pm 2021-07-16 02:06:21.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.029'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.029'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Filter.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Filter.pm 2021-07-16 02:06:19.000000000 +0000 @@ -18,8 +18,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Filter::ASCII85Decode; use PDF::Builder::Basic::PDF::Filter::ASCIIHexDecode; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Literal.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Literal.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Literal.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Literal.pm 2021-07-16 02:06:19.000000000 +0000 @@ -6,8 +6,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Filter; use PDF::Builder::Basic::PDF::Name; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Name.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Name.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Name.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Name.pm 2021-07-16 02:06:19.000000000 +0000 @@ -20,8 +20,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Null.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Null.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Null.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Null.pm 2021-07-16 02:06:19.000000000 +0000 @@ -20,8 +20,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Number.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Number.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Number.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Number.pm 2021-07-16 02:06:19.000000000 +0000 @@ -20,8 +20,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Objind.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Objind.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Objind.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Objind.pm 2021-07-16 02:06:20.000000000 +0000 @@ -19,8 +19,8 @@ use warnings; use Scalar::Util 'isweak'; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Page.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Page.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Page.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Page.pm 2021-07-16 02:06:20.000000000 +0000 @@ -20,8 +20,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Dict; use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Pages.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Pages.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Pages.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Pages.pm 2021-07-16 02:06:20.000000000 +0000 @@ -20,8 +20,8 @@ use base 'PDF::Builder::Basic::PDF::Dict'; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Array; use PDF::Builder::Basic::PDF::Dict; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/String.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/String.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/String.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/String.pm 2021-07-16 02:06:20.000000000 +0000 @@ -20,8 +20,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed =head1 NAME @@ -198,11 +198,11 @@ $str = join('', map { sprintf('%04X' , $_) } unpack('U*', $str) ); return ""; } else { - if ($str =~ m/[^\n\r\t\b\f\040-\176\200-\377]/oi) { - $str =~ s/(.)/sprintf('%02X', ord($1))/oge; + if ($str =~ m/[^\n\r\t\b\f\040-\176\200-\377]/) { + $str =~ s/(.)/sprintf('%02X', ord($1))/sge; return "<$str>"; } else { - $str =~ s/([\n\r\t\b\f\\()])/\\$out_trans{$1}/ogi; + $str =~ s/([\n\r\t\b\f\\()])/\\$out_trans{$1}/g; return "($str)"; } } diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Utils.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Utils.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF/Utils.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF/Utils.pm 2021-07-16 02:06:20.000000000 +0000 @@ -18,8 +18,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Basic/PDF.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Basic/PDF.pm 2021-07-16 02:06:18.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.020'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.020'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Content/Hyphenate_basic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Content/Hyphenate_basic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Content/Hyphenate_basic.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Content/Hyphenate_basic.pm 2021-07-16 02:06:21.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Content/Text.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Content/Text.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Content/Text.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Content/Text.pm 2021-07-16 02:06:22.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed =head1 NAME @@ -742,11 +742,11 @@ B $txt->font($font,$fontsize); - $txt->lead($lead); + $txt->leading($leading); $txt->translate($x,$y); $overflow = $txt->paragraph( 'long paragraph here ...', $width, - $y+$lead-$bottom_margin ); + $y+$leading-$bottom_margin ); B if you need to change any text treatment I a paragraph (B or I text, for instance), this can not handle it. Only @@ -766,7 +766,7 @@ my @line = (); my $nwidth = 0; - my $lead = $self->lead(); + my $leading = $self->leading(); my $align = 'l'; # default left if (defined($opts{'-align'})) { if ($opts{'-align'} =~ /^l/i) { $align = 'l'; } @@ -790,7 +790,7 @@ if ($indent < 0 && !$first_line) { $lw += $indent*$em; } # now, need to indent (move line start) right for 'l' and 'j' if ($lw < $width && ($align eq 'l' || $align eq 'j')) { - $self->cr($lead); # go UP one line + $self->cr($leading); # go UP one line $self->nl(88*abs($indent)); # come down to right line and move right } @@ -808,7 +808,7 @@ $first_line = 0; # bail out and just return remaining $text if run out of vertical space - last if ($height -= $lead) < 0; + last if ($height -= $leading) < 0; } if (wantarray) { diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Content.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Content.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Content.pm 2021-03-28 00:52:43.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Content.pm 2021-07-16 02:06:16.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw( deprecated recursion uninitialized ); -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use Carp; use Compress::Zlib qw(); @@ -2060,7 +2060,7 @@ $result = $ptheta - $dtheta; } else { # into bottom quadrants $dtheta += $max; # remaining CCW amount from -pi - $result = -pi - $dtheta; + $result = -1*pi - $dtheta; # -pi caused some problems } } } else { # p in QIII or QIV diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Docs.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Docs.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Docs.pm 2021-03-28 00:52:43.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Docs.pm 2021-07-16 02:06:16.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.020'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed # originally part of Builder.pm, it was split out due to its length @@ -520,6 +520,15 @@ anywhere it occurs to "Builder". See the INFO/KNOWN_INCOMP known incompatibilities file for further information. +=head3 Thanks... + +Many users have helped out by reporting bugs and requesting enhancements. A +special shout out goes to those who have contributed code and tests, or +coordinated their package development with the needs of PDF::Builder: +Ben Bullock, Cary Gravel, Gregor Herrmann, Petr Pisar, Jeffrey Ratcliffe, +Steve Simms (via PDF::API2 fixes), and Johan Vromans. +Drop me a line if I've overlooked your contribution! + =head1 DETAILED NOTES ON METHODS =head2 After saving a file... diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Lite.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Lite.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Lite.pm 2021-03-28 00:52:43.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Lite.pm 2021-07-16 02:06:16.000000000 +0000 @@ -4,8 +4,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # 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. diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Matrix.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Matrix.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Matrix.pm 2021-03-28 00:52:43.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Matrix.pm 2021-07-16 02:06:16.000000000 +0000 @@ -13,8 +13,8 @@ use warnings; use Carp; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.020'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.020'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/NamedDestination.pm libpdf-builder-perl-3.023/lib/PDF/Builder/NamedDestination.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/NamedDestination.pm 2021-03-28 00:52:43.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/NamedDestination.pm 2021-07-16 02:06:17.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $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 -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Outline.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Outline.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Outline.pm 2021-03-28 00:52:43.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Outline.pm 2021-07-16 02:06:17.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.020'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.020'; # manually update whenever code is changed use Carp qw(croak); use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Outlines.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Outlines.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Outlines.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Outlines.pm 2021-07-16 02:06:17.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.029'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.029'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Page.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Page.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Page.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Page.pm 2021-07-16 02:06:17.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.017'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use POSIX qw(floor); use Scalar::Util qw(weaken); @@ -63,7 +63,7 @@ #=item $page = PDF::Builder::Page->coerce($pdf, $pdfpage) # -#Returns a page object converted from $pdfpage (called from $pdf->openpage()). +#Returns a page object converted from $pdfpage (called from $pdf->open_page()). # #=cut diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/BaseFont.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/BaseFont.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/BaseFont.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/BaseFont.pm 2021-07-16 02:06:22.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed use Compress::Zlib; use Encode qw(:all); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/CIDFont/CJKFont.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/CIDFont/CJKFont.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/CIDFont/CJKFont.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/CIDFont/CJKFont.pm 2021-07-16 02:06:24.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Util; use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/CIDFont/TrueType/FontFile.pm 2021-07-16 02:06:24.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use Carp; use Encode qw(:all); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/CIDFont/TrueType.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/CIDFont/TrueType.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/CIDFont/TrueType.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/CIDFont/TrueType.pm 2021-07-16 02:06:24.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; use PDF::Builder::Resource::CIDFont::TrueType::FontFile; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/CIDFont.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/CIDFont.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/CIDFont.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/CIDFont.pm 2021-07-16 02:06:22.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use Encode qw(:all); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/DeviceN.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/DeviceN.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/DeviceN.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/DeviceN.pm 2021-07-16 02:06:25.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Indexed/ACTFile.pm 2021-07-16 02:06:25.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Indexed/Hue.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Indexed/Hue.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Indexed/Hue.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Indexed/Hue.pm 2021-07-16 02:06:25.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Indexed/WebColor.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Indexed/WebColor.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Indexed/WebColor.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Indexed/WebColor.pm 2021-07-16 02:06:26.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Indexed.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Indexed.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Indexed.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Indexed.pm 2021-07-16 02:06:25.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Separation.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Separation.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace/Separation.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace/Separation.pm 2021-07-16 02:06:25.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ColorSpace.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ColorSpace.pm 2021-07-16 02:06:22.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Colors.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Colors.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Colors.pm 2021-03-28 00:52:45.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Colors.pm 2021-07-16 02:06:22.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.029'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.029'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ExtGState.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ExtGState.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/ExtGState.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/ExtGState.pm 2021-07-16 02:06:23.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/BdFont.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/BdFont.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/BdFont.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/BdFont.pm 2021-07-16 02:06:26.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Util; use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/bankgothic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/bankgothic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/bankgothic.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/bankgothic.pm 2021-07-16 02:06:27.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.013'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.013'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/courierboldoblique.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/courierboldoblique.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/courierboldoblique.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/courierboldoblique.pm 2021-07-16 02:06:27.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/courierbold.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/courierbold.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/courierbold.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/courierbold.pm 2021-07-16 02:06:27.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/courieroblique.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/courieroblique.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/courieroblique.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/courieroblique.pm 2021-07-16 02:06:27.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/courier.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/courier.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/courier.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/courier.pm 2021-07-16 02:06:27.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/georgiabolditalic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/georgiabolditalic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/georgiabolditalic.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/georgiabolditalic.pm 2021-07-16 02:06:28.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/georgiabold.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/georgiabold.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/georgiabold.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/georgiabold.pm 2021-07-16 02:06:28.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/georgiaitalic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/georgiaitalic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/georgiaitalic.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/georgiaitalic.pm 2021-07-16 02:06:28.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/georgia.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/georgia.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/georgia.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/georgia.pm 2021-07-16 02:06:28.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/helveticaboldoblique.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/helveticaboldoblique.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/helveticaboldoblique.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/helveticaboldoblique.pm 2021-07-16 02:06:29.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/helveticabold.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/helveticabold.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/helveticabold.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/helveticabold.pm 2021-07-16 02:06:29.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/helveticaoblique.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/helveticaoblique.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/helveticaoblique.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/helveticaoblique.pm 2021-07-16 02:06:29.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/helvetica.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/helvetica.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/helvetica.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/helvetica.pm 2021-07-16 02:06:28.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/symbol.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/symbol.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/symbol.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/symbol.pm 2021-07-16 02:06:29.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/timesbolditalic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/timesbolditalic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/timesbolditalic.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/timesbolditalic.pm 2021-07-16 02:06:29.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/timesbold.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/timesbold.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/timesbold.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/timesbold.pm 2021-07-16 02:06:29.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/timesitalic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/timesitalic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/timesitalic.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/timesitalic.pm 2021-07-16 02:06:30.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/timesroman.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/timesroman.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/timesroman.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/timesroman.pm 2021-07-16 02:06:30.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbolditalic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbolditalic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbolditalic.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbolditalic.pm 2021-07-16 02:06:31.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbold.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbold.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbold.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetbold.pm 2021-07-16 02:06:30.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetitalic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetitalic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetitalic.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/trebuchetitalic.pm 2021-07-16 02:06:31.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/trebuchet.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/trebuchet.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/trebuchet.pm 2021-03-28 00:52:48.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/trebuchet.pm 2021-07-16 02:06:30.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/verdanabolditalic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/verdanabolditalic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/verdanabolditalic.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/verdanabolditalic.pm 2021-07-16 02:06:31.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/verdanabold.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/verdanabold.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/verdanabold.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/verdanabold.pm 2021-07-16 02:06:31.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/verdanaitalic.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/verdanaitalic.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/verdanaitalic.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/verdanaitalic.pm 2021-07-16 02:06:31.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/verdana.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/verdana.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/verdana.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/verdana.pm 2021-07-16 02:06:31.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/webdings.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/webdings.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/webdings.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/webdings.pm 2021-07-16 02:06:32.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.029'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.029'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/wingdings.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/wingdings.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/wingdings.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/wingdings.pm 2021-07-16 02:06:32.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.029'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.029'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/zapfdingbats.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/zapfdingbats.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont/zapfdingbats.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont/zapfdingbats.pm 2021-07-16 02:06:32.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/CoreFont.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/CoreFont.pm 2021-07-16 02:06:26.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use File::Basename; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/Postscript.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/Postscript.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/Postscript.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/Postscript.pm 2021-07-16 02:06:26.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use Encode qw(:all); use IO::File qw(); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/SynFont.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/SynFont.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font/SynFont.pm 2021-03-28 00:52:47.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font/SynFont.pm 2021-07-16 02:06:26.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.022'; # manually update whenever code is changed use Math::Trig; # CAUTION: deg2rad(0) = deg2rad(360) = 0! use Unicode::UCD 'charinfo'; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Font.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Font.pm 2021-07-16 02:06:23.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use Encode qw(:all); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Glyphs.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Glyphs.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Glyphs.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Glyphs.pm 2021-07-16 02:06:23.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/PaperSizes.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/PaperSizes.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/PaperSizes.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/PaperSizes.pm 2021-07-16 02:06:23.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.020'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.020'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Pattern.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Pattern.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Pattern.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Pattern.pm 2021-07-16 02:06:23.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.031'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.031'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Shading.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Shading.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/Shading.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/Shading.pm 2021-07-16 02:06:24.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.029'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.029'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/UniFont.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/UniFont.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/UniFont.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/UniFont.pm 2021-07-16 02:06:24.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.016'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.016'; # manually update whenever code is changed use Carp; use Encode qw(:all); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm 2021-07-16 02:06:33.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.029'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.029'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm 2021-07-16 02:06:33.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.004'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.004'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm 2021-07-16 02:06:33.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.017'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.017'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm 2021-07-16 02:06:33.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.004'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.004'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm 2021-07-16 02:06:34.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.004'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.004'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm 2021-07-16 02:06:32.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.010'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.010'; # manually update whenever code is changed use PDF::Builder::Util; use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm 2021-07-16 02:06:33.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.016'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.016'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Dict; use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Form.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Form.pm 2021-07-16 02:06:32.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.031'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.031'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/GD.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/GD.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/GD.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/GD.pm 2021-07-16 02:06:34.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use PDF::Builder::Util; use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/GIF.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/GIF.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/GIF.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/GIF.pm 2021-07-16 02:06:34.000000000 +0000 @@ -6,8 +6,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use IO::File; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm 2021-07-16 02:06:34.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.017'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.017'; # manually update whenever code is changed use IO::File; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm 2021-07-16 02:06:34.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use Compress::Zlib; use POSIX qw(ceil floor); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/PNG.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/PNG.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/PNG.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/PNG.pm 2021-07-16 02:06:34.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.019'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.019'; # manually update whenever code is changed use Compress::Zlib; use POSIX qw(ceil floor); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/PNM.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/PNM.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/PNM.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/PNM.pm 2021-07-16 02:06:35.000000000 +0000 @@ -8,8 +8,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed use IO::File; use PDF::Builder::Util; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm 2021-03-28 00:52:51.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm 2021-07-16 02:06:35.000000000 +0000 @@ -3,11 +3,11 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use IO::File; -use Graphics::TIFF 7 ':all'; # already confirmed to be installed +use Graphics::TIFF ':all'; # already confirmed to be installed =head1 NAME @@ -176,7 +176,7 @@ # may also be known as T6Options or Group4Options $self->{'g4Options'} = $self->{'object'}->GetField(TIFFTAG_GROUP4OPTIONS); - $self->{'lzwPredictor'} = $self->{'object'}->GetField(TIFFTAG_PREDICTOR); + $self->{'Predictor'} = $self->{'object'}->GetField(TIFFTAG_PREDICTOR); $self->{'imageId'} = $self->{'object'}->GetField(TIFFTAG_OPIIMAGEID); # TIFFTAG_SUBFILETYPE = 3 bits for various subfiles within image file # TIFFTAG_OSUBFILETYPE = 3 values concerning image types diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm 2021-03-28 00:52:51.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm 2021-07-16 02:06:35.000000000 +0000 @@ -3,8 +3,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.001'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use IO::File; @@ -233,7 +233,7 @@ $self->{'colorMapSamples'} = $valCount; $self->{'colorMapLength'} = $valCount*2; # shorts! } elsif ($valTag == 317) { - $self->{'lzwPredictor'} = $valOffset; + $self->{'Predictor'} = $valOffset; } elsif ($valTag == 0x800d) { # imageID my $here = $fh->tell(); diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm 2021-07-16 02:06:35.000000000 +0000 @@ -5,10 +5,8 @@ use strict; use warnings; -#no warnings 'uninitialized'; - -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use Compress::Zlib; @@ -16,8 +14,7 @@ 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 ':all'; # have already confirmed that this version exists +use Graphics::TIFF ':all'; # have already confirmed the appropriate version exists =head1 NAME @@ -152,45 +149,25 @@ return $self->{'usesGT'}->val(); } -# non-CCITT compression methods -sub handle_generic { - 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); - - # uncompressed bilevel needs to be flipped - if (!defined $tif->{'filter'} && $tif->{'bitsPerSample'} == 1) { - $self->{'Decode'} = PDFArray(PDFNum(1), PDFNum(0)); - } - $stripcount = $tif->{'object'}->NumberOfStrips(); - $buffer = ''; - for my $i (0 .. $stripcount - 1) { - $buffer .= $tif->{'object'}->ReadEncodedStrip($i, -1); +sub decode_all_strips { + my ($self, $tif) = @_; + $self->{' stream'} = ''; + for my $i (0 .. $tif->{object}->NumberOfStrips() - 1) { + $self->{' stream'} .= $tif->{object}->ReadEncodedStrip($i, -1); } + return; +} +sub handle_alpha { + my ($self, $pdf, $tif, %opts) = @_; my $transparency = (defined $opts{'-notrans'} && $opts{'-notrans'} == 1)? 0: 1; - my $alpha; + my ($alpha, $dict); # 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 @@ -204,68 +181,81 @@ 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); + ($self->{' stream'}, $alpha) = + split_alpha($self->{' stream'}, $samples, $tif->{'bitsPerSample'}, $w, $h); + $self->{' stream'} = + descale($self->{' stream'}, $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 + # Gray or Bilevel + Alpha $samples = 1; } elsif ($tif->{'colorSpace'} eq 'DeviceRGB') { - # RGB + Alpha + # 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'}, $alpha) = + split_alpha($self->{' stream'}, $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; - } - } + if (defined $alpha and $transparency) { + $dict = PDFDict(); + $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; + $dict->{' stream'} = $alpha; + } + return $dict; +} + +# non-CCITT compression methods +sub handle_generic { + my ($self, $pdf, $tif, %opts) = @_; + + # 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); + + # uncompressed bilevel needs to be flipped + if (!defined $tif->{'filter'} && $tif->{'bitsPerSample'} == 1) { + $self->{'Decode'} = PDFArray(PDFNum(1), PDFNum(0)); + } + $self->decode_all_strips($tif); + my $alpha = $self->handle_alpha($pdf, $tif, %opts); # 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 + $self->{' nofilt'} = 1; + if (defined $alpha and $alpha->{' stream'}) { # there is transparency? + if (length($alpha->{' stream'}) > 32) { + $alpha->{' stream'} = Compress::Zlib::compress($alpha->{' stream'}); + $alpha->filters('FlateDecode'); # tell reader it's compressed... } else { # too short to bother compressing. '/Filter [ /FlateDecode ] ' # takes up 25 bytes all by itself - delete $dict->{'Filter'}; - $dict->{' nofilt'} = 1; + delete $alpha->{'Filter'}; } + $alpha->{' nofilt'} = 1; } return $self; @@ -276,7 +266,8 @@ # returns $buffer and $alpha strings # TBD: fill order or other directional issues? sub split_alpha { - my ($inbuf, $samples, $bps, $count) = @_; + my ($inbuf, $samples, $bps, $w, $h) = @_; + my $count = $w * $h; my $outbuf = ''; my $alpha = ''; @@ -316,7 +307,6 @@ #} ## 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) @@ -337,48 +327,32 @@ } 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; + my $inbits = unpack('B*', $inbuf); # bits from inbuf string + my $outbits = ''; # bits to outbuf string (starts empty) + my $outbits_a = ''; # build alpha string (starts empty) + my $index = 0; + for my $row (0 .. $h-1) { + my $rowbuf = ''; + my $rowbuf_a = ''; + for my $column (0 .. $w-1) { + $rowbuf .= substr($inbits, $index, $samples*$bps); + $index += $samples*$bps; + $rowbuf_a .= substr($inbits, $index, $bps); + $index += $bps; } - 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)); + + # padding for input could be different from output, e.g. width = 4 + # requires no padding on input, but 4 on output. + $index += $w*$samples*($bps+1) % 8; + + # given that bilevel images with a width that is not divisible by 8 + # are padded to make a whole number of bytes per row, the padding + # must be adjusted when deinterleaving the alpha layer. + $outbits .= $rowbuf . pad_buffer($rowbuf, $samples, $bps); + $outbits_a .= $rowbuf_a . pad_buffer($rowbuf_a, 1, $bps); } + $outbuf = pack('B*', $outbits); + $alpha = pack('B*', $outbits_a); } # end of fractional byte (bits) handling ## debug @@ -428,6 +402,19 @@ return ($outbuf, $alpha); } # end of split_alpha() +sub pad_buffer { + my ($buf, $samples, $bps) = @_; + my $padbuf = ''; + my $pad = length($buf) % 8; + if ($pad) { + $pad = 8 - $pad; + } + for (0..$samples*$bps*$pad-1) { + $padbuf .= '0'; + } + return $padbuf; +} + # bps = width of a sample in bits, samples 1 (G) or 3 (RGB) # return updated buffer WARNING: not tested! sub descale { @@ -588,7 +575,8 @@ my $decode = PDFDict(); $self->{'DecodeParms'} = PDFArray($decode); # DecodeParms.K 0 if G3 or there are G3 options with bit 0 set, -1 for G4 - $decode->{'K'} = (($tif->{'ccitt'} == 4 || (defined $tif->{'g3Options'} && $tif->{'g3Options'} & 0x1))? PDFNum(-1): PDFNum(0)); + $decode->{'K'} = ($tif->{'ccitt'} == 4 || + (defined $tif->{'g3Options'} && $tif->{'g3Options'} & 0x1))? PDFNum(-1): PDFNum(0); $decode->{'Columns'} = PDFNum($tif->{'imageWidth'}); $decode->{'Rows'} = PDFNum($tif->{'imageHeight'}); $decode->{'BlackIs1'} = PDFBool($tif->{'whiteIsZero'} == 1? 1: 0); @@ -643,6 +631,53 @@ return $self; } # end of handle_ccitt() +sub handle_lzw { + my ($self, $pdf, $tif, %opts) = @_; + + # colorspace DeviceGray or DeviceRGB already set in read_tiff() + # bits_per_component 1 2 4 8 16? already set in read_tiff() + $self->{' nofilt'} = 1; + $self->{'Filter'} = PDFArray(PDFName('LZWDecode')); + my $dict = PDFDict(); + $self->{'DecodeParms'} = PDFArray($dict); + $dict->{'Columns'} = PDFNum($tif->{'imageWidth'}); + $dict->{'Rows'} = PDFNum($tif->{'imageHeight'}); + # colorspace DeviceGray or DeviceRGB already set in read_tiff() + # bits_per_component 1 2 4 8 16? already set in read_tiff() + $dict->{'BitsPerComponent'} = PDFNum($tif->{'bitsPerSample'}); + $dict->{'Colors'} = PDFNum($tif->{'colorSpace'} eq 'DeviceGray'?1 :3); + if (defined $tif->{'Predictor'} and $tif->{'Predictor'} > 1) { + $dict->{'Predictor'} = PDFNum($tif->{'Predictor'}); + } + + # have to decode in case we have alpha to split out + $self->decode_all_strips($tif); + my $alpha = $self->handle_alpha($pdf, $tif, %opts); + + # bilevel must be flipped + if ($alpha and $tif->{'bitsPerSample'} == 1) { + $self->{'Decode'} = PDFArray(PDFNum(1), PDFNum(0)); + } + + my $filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new($dict); + $self->{' stream'} = $filter->outfilt($self->{' stream'}); + + if (defined $alpha and defined $alpha->{' stream'}) { # there is transparency? + if (length($alpha->{' stream'}) > 32) { + my $filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); + $alpha->{' stream'} = $filter->outfilt($alpha->{' stream'}); + $alpha->filters('LZWDecode'); # tell reader it's compressed... + } else { + # too short to bother compressing. '/Filter [ /LZWDecode ] ' + # takes up 25 bytes all by itself + delete $alpha->{Filter}; + } + $alpha->{' nofilt'} = 1; # ...but writer not to compress on the fly + } + + return $self; +} # end of handle_lzw() + sub read_tiff { my ($self, $pdf, $tif, %opts) = @_; @@ -652,7 +687,8 @@ if ($tif->{'colorSpace'} eq 'Indexed') { my $dict = PDFDict(); $pdf->new_obj($dict); - $self->colorspace(PDFArray(PDFName($tif->{'colorSpace'}), PDFName('DeviceRGB'), PDFNum(2**$tif->{'bitsPerSample'}-1), $dict)); + $self->colorspace(PDFArray(PDFName($tif->{'colorSpace'}), + PDFName('DeviceRGB'), PDFNum(2**$tif->{'bitsPerSample'}-1), $dict)); $dict->{'Filter'} = PDFArray(PDFName('FlateDecode')); my ($red, $green, $blue) = @{$tif->{'colorMap'}}; $dict->{' stream'} = ''; @@ -678,6 +714,8 @@ # check filters and handle separately if (defined $tif->{'filter'} and $tif->{'filter'} eq 'CCITTFaxDecode') { $self->handle_ccitt($pdf, $tif, %opts); + } elsif (defined $tif->{'filter'} and $tif->{'filter'} eq 'LZWDecode') { + $self->handle_lzw($pdf, $tif, %opts); } else { $self->handle_generic($pdf, $tif, %opts); } diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm 2021-03-28 00:52:50.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm 2021-07-16 02:06:35.000000000 +0000 @@ -5,10 +5,8 @@ use strict; use warnings; -#no warnings 'uninitialized'; - -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed use Compress::Zlib; @@ -95,55 +93,6 @@ return $self->{'usesGT'}->val(); } -sub deLZW { - my ($ibits, $stream) = @_; - - my $bits = $ibits; - my $resetcode = 1 << ($ibits - 1); - my $endcode = $resetcode + 1; - my $nextcode = $endcode + 1; - my $ptr = 0; - $stream = unpack('B*', $stream); - my $maxptr = length($stream); - my $tag; - my $out = ''; - my $outptr = 0; - - # print STDERR "reset=$resetcode\nend=$endcode\nmax=$maxptr\n"; - - my @d = map { chr($_) } (0 .. $resetcode-1); - - while ($ptr+$bits <= $maxptr) { - $tag = 0; - foreach my $off (reverse 1 .. $bits) { - $tag <<= 1; - $tag |= substr($stream, $ptr+$bits-$off, 1); - } - # print STDERR "ptr=$ptr,tag=$tag,bits=$bits,next=$nextcode\n"; - # print STDERR "tag to large\n" if($tag>$nextcode); - $ptr += $bits; - if ($tag == $resetcode) { - $bits = $ibits; - $nextcode = $endcode+1; - next; - } elsif ($tag == $endcode) { - last; - } elsif ($tag < $resetcode) { - $d[$nextcode] = $d[$tag]; - $out .= $d[$nextcode]; - $nextcode++; - } elsif ($tag > $endcode) { - $d[$nextcode] = $d[$tag]; - $d[$nextcode] .= substr($d[$tag+1], 0, 1); - $out .= $d[$nextcode]; - $nextcode++; - } - $bits++ if $nextcode == (1 << $bits); - } - - return $out; -} - sub handle_generic { my ($self, $pdf, $tif) = @_; @@ -200,31 +149,34 @@ sub handle_lzw { my ($self, $pdf, $tif) = @_; - $self->filters('FlateDecode'); - my $imageWidth = $tif->{'imageWidth'}; - my $mod = $imageWidth%8; - if ($mod > 0) { - $imageWidth += 8-$mod; + $self->{' nofilt'} = 1; + $self->{'Filter'} = PDFArray(PDFName('LZWDecode')); + my $decode = PDFDict(); + $self->{'DecodeParms'} = PDFArray($decode); + $decode->{'Columns'} = PDFNum($tif->{'imageWidth'}); + $decode->{'Rows'} = PDFNum($tif->{'imageHeight'}); + $decode->{'DamagedRowsBeforeError'} = PDFNum(100); + $decode->{'EndOfLine'} = PDFBool(1); + $decode->{'EncodedByteAlign'} = PDFBool(1); + if (defined $tif->{'Predictor'} and $tif->{'Predictor'} > 1) { + $decode->{'Predictor'} = PDFNum($tif->{'Predictor'}); } - my $max_raw_strip = $imageWidth*$tif->{'bitsPerSample'}*$tif->{'RowsPerStrip'}/8; if (ref($tif->{'imageOffset'})) { $self->{' stream'} = ''; my $d = scalar @{$tif->{'imageOffset'}}; foreach (1 .. $d) { - my $buf; $tif->{'fh'}->seek(shift(@{$tif->{'imageOffset'}}), 0); + my $buf; $tif->{'fh'}->read($buf, shift(@{$tif->{'imageLength'}})); - $buf = deLZW(9, $buf); - if (length($buf) > $max_raw_strip) { - $buf = substr($buf, 0, $max_raw_strip); - } - $self->{' stream'} .= $buf; + my $filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); + $self->{' stream'} .= $filter->infilt($buf); } + my $filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); + $self->{' stream'} = $filter->outfilt($self->{' stream'}); } else { $tif->{'fh'}->seek($tif->{'imageOffset'}, 0); $tif->{'fh'}->read($self->{' stream'}, $tif->{'imageLength'}); - $self->{' stream'} = deLZW(9, $self->{' stream'}); } return $self; @@ -236,10 +188,12 @@ $self->{' nofilt'} = 1; $self->{'Filter'} = PDFName('CCITTFaxDecode'); $self->{'DecodeParms'} = PDFDict(); - $self->{'DecodeParms'}->{'K'} = (($tif->{'ccitt'} == 4 || (($tif->{'g3Options'}||0) & 0x1))? PDFNum(-1): PDFNum(0)); + $self->{'DecodeParms'}->{'K'} = ($tif->{'ccitt'} == 4 || + (($tif->{'g3Options'}||0) & 0x1))? PDFNum(-1): PDFNum(0); $self->{'DecodeParms'}->{'Columns'} = PDFNum($tif->{'imageWidth'}); $self->{'DecodeParms'}->{'Rows'} = PDFNum($tif->{'imageHeight'}); - $self->{'DecodeParms'}->{'BlackIs1'} = PDFBool($tif->{'whiteIsZero'} == 0? 1: 0); + $self->{'DecodeParms'}->{'BlackIs1'} = + PDFBool(($tif->{'whiteIsZero'}||0) == 0? 1: 0); if (defined($tif->{'g3Options'}) && ($tif->{'g3Options'} & 0x4)) { $self->{'DecodeParms'}->{'EndOfLine'} = PDFBool(1); $self->{'DecodeParms'}->{'EncodedByteAlign'} = PDFBool(1); @@ -265,14 +219,16 @@ if ($tif->{'colorSpace'} eq 'Indexed') { my $dict = PDFDict(); $pdf->new_obj($dict); - $self->colorspace(PDFArray(PDFName($tif->{'colorSpace'}), PDFName('DeviceRGB'), PDFNum(2**$tif->{'bitsPerSample'}-1), $dict)); + $self->colorspace(PDFArray(PDFName($tif->{'colorSpace'}), + PDFName('DeviceRGB'), PDFNum(2**$tif->{'bitsPerSample'}-1), $dict)); $dict->{'Filter'} = PDFArray(PDFName('FlateDecode')); $tif->{'fh'}->seek($tif->{'colorMapOffset'}, 0); my $colormap; my $straight; $tif->{'fh'}->read($colormap, $tif->{'colorMapLength'}); $dict->{' stream'} = ''; - $straight .= pack('C', ($_/256)) for unpack($tif->{'short'} . '*', $colormap); + $straight .= pack('C', ($_/256)) for + unpack($tif->{'short'} . '*', $colormap); foreach my $c (0 .. (($tif->{'colorMapSamples'}/3)-1)) { $dict->{' stream'} .= substr($straight, $c, 1); $dict->{' stream'} .= substr($straight, $c + ($tif->{'colorMapSamples'}/3), 1); @@ -359,6 +315,7 @@ } =back + =cut 1; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject/Image.pm 2021-03-28 00:52:49.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject/Image.pm 2021-07-16 02:06:32.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.017'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.017'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource/XObject.pm 2021-03-28 00:52:46.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource/XObject.pm 2021-07-16 02:06:24.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '2.031'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '2.031'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Resource.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Resource.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Resource.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Resource.pm 2021-07-16 02:06:17.000000000 +0000 @@ -5,8 +5,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.017'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.017'; # manually update whenever code is changed use PDF::Builder::Util qw(pdfkey); use PDF::Builder::Basic::PDF::Utils; # PDFName diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/UniWrap.pm libpdf-builder-perl-3.023/lib/PDF/Builder/UniWrap.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/UniWrap.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/UniWrap.pm 2021-07-16 02:06:17.000000000 +0000 @@ -4,8 +4,8 @@ use warnings; #no warnings qw[ deprecated recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed =head1 NAME diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder/Util.pm libpdf-builder-perl-3.023/lib/PDF/Builder/Util.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder/Util.pm 2021-03-28 00:52:44.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder/Util.pm 2021-07-16 02:06:18.000000000 +0000 @@ -4,8 +4,8 @@ use warnings; #no warnings qw[ recursion uninitialized ]; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $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 diff -Nru libpdf-builder-perl-3.022/lib/PDF/Builder.pm libpdf-builder-perl-3.023/lib/PDF/Builder.pm --- libpdf-builder-perl-3.022/lib/PDF/Builder.pm 2021-03-28 00:52:43.000000000 +0000 +++ libpdf-builder-perl-3.023/lib/PDF/Builder.pm 2021-07-16 02:06:15.000000000 +0000 @@ -2,15 +2,14 @@ use strict; 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.022'; # VERSION -my $LAST_UPDATE = '3.022'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed -my $GrTFversion = 7; # minimum version of Graphics::TIFF -my $LpngVersion = 0.56; # minimum version of Image::PNG::Libpng +my $GrTFversion = 16; # minimum version of Graphics::TIFF +my $LpngVersion = 0.57; # minimum version of Image::PNG::Libpng use Carp; use Encode qw(:all); @@ -61,7 +60,7 @@ $page = $pdf->page(); # Retrieve an existing page - $page = $pdf->openpage($page_number); + $page = $pdf->open_page($page_number); # Set the page size $page->mediabox('Letter'); @@ -705,6 +704,10 @@ =back +B Perl::Critic (tools/1_pc.pl) has started flagging the name +"default" as a reserved keyword in higher Perl versions. Use with caution, and +be aware that this name I have to be changed in the future. + =cut sub default { @@ -1245,7 +1248,7 @@ return $page; } # end of page() -=item $page = $pdf->openpage($page_number) +=item $page = $pdf->open_page($page_number) Returns the L object of page $page_number. This is similar to C<< $page = $pdf->page() >>, except that C<$page> is @@ -1257,14 +1260,14 @@ B $pdf = PDF::Builder->open('our/99page.pdf'); - $page = $pdf->openpage(1); # returns the first page - $page = $pdf->openpage(99); # returns the last page - $page = $pdf->openpage(-1); # returns the last page - $page = $pdf->openpage(999); # returns undef + $page = $pdf->open_page(1); # returns the first page + $page = $pdf->open_page(99); # returns the last page + $page = $pdf->open_page(-1); # returns the last page + $page = $pdf->open_page(999); # returns undef =cut -sub openpage { +sub open_page { my $self = shift(); my $index = shift() || 0; my ($page, $rotate, $media, $trans); @@ -1285,8 +1288,7 @@ weaken $page->{' apipdf'}; weaken $page->{' api'}; $self->{'pdf'}->out_obj($page); - if ((not defined($page->{' fixed'}) or $page->{' fixed'} < 1) and - ($rotate = $page->find_prop('Rotate')) ) { + if (($rotate = $page->find_prop('Rotate')) and not $page->{' opened'}) { $rotate = ($rotate->val() + 360) % 360; if ($rotate != 0 and not $self->default('nounrotate')) { @@ -1316,7 +1318,7 @@ $trans = ''; } - if (defined $page->{'Contents'} and (not defined($page->{' fixed'}) or $page->{' fixed'} < 1)) { + if (defined $page->{'Contents'} and not $page->{' opened'}) { $page->fixcontents(); my $uncontent = delete $page->{'Contents'}; my $content = $page->gfx(); @@ -1333,20 +1335,16 @@ $content->{' stream'} .= ' Q '; } - ## $content->{'Length'} = PDFNum(length($content->{' stream'})); - # this will be fixed by the following code or content or filters - - ## if we like compress we will do it now to do quicker saves + # if we like compress we will do it now to do quicker saves if ($self->{'forcecompress'} eq 'flate' || $self->{'forcecompress'} =~ m/^[1-9]\d*$/) { - # $content->compressFlate(); $content->{' stream'} = dofilter($content->{'Filter'}, $content->{' stream'}); $content->{' nofilt'} = 1; delete $content->{'-docompress'}; $content->{'Length'} = PDFNum(length($content->{' stream'})); } } - $page->{' fixed'} = 1; + $page->{' opened'} = 1; } $self->{'pdf'}->out_obj($page); @@ -1359,6 +1357,17 @@ return $page; } # end of openpage() +=item $page = $pdf->openpage($page_number) + +B Will be removed on or after June, 2023. Use C call +instead. + +=cut + +sub openpage { return open_page(@_); } ## no critic + +# internal utility + sub _walk_obj { my ($object_cache, $source_pdf, $target_pdf, $source_object, @keys) = @_; @@ -1450,7 +1459,7 @@ if (ref($s_idx) eq 'PDF::Builder::Page') { $s_page = $s_idx; } else { - $s_page = $s_pdf->openpage($s_idx); + $s_page = $s_pdf->open_page($s_idx); } $self->{'apiimportcache'} ||= {}; @@ -1485,22 +1494,22 @@ # create a whole content stream ## technically it is possible to submit an unfinished ## (e.g., newly created) source-page, but that's nonsense, - ## so we expect a page fixed by openpage and die otherwise - die "page not processed via openpage ..." unless $s_page->{' fixed'} == 1; + ## so we expect a page fixed by open_page and die otherwise + unless ($s_page->{' opened'}) { + croak join(' ', + "Pages may only be imported from a complete PDF.", + "Save and reopen the source PDF object first."); + } - # since the source page comes from openpage it may already - # contain the required starting 'q' without the final 'Q' - # if forcecompress is in effect if (defined $s_page->{'Contents'}) { $s_page->fixcontents(); $xo->{' stream'} = ''; - # openpage pages only contain one stream + # open_page pages only contain one stream my ($k) = $s_page->{'Contents'}->elements(); $k->realise(); if ($k->{' nofilt'}) { - # we have a finished stream here - # so we unfilter + # we have a finished stream here, so we unfilter $xo->add('q', unfilter($k->{'Filter'}, $k->{' stream'}), 'Q'); } else { # stream is an unfinished/unfiltered content @@ -1566,7 +1575,7 @@ if (ref($s_idx) eq 'PDF::Builder::Page') { $s_page = $s_idx; } else { - $s_page = $s_pdf->openpage($s_idx); + $s_page = $s_pdf->open_page($s_idx); } if (ref($t_idx) eq 'PDF::Builder::Page') { diff -Nru libpdf-builder-perl-3.022/Makefile.PL libpdf-builder-perl-3.023/Makefile.PL --- libpdf-builder-perl-3.022/Makefile.PL 2021-03-28 00:52:41.000000000 +0000 +++ libpdf-builder-perl-3.023/Makefile.PL 2021-07-16 02:06:10.000000000 +0000 @@ -2,141 +2,111 @@ use strict; use warnings; -use 5.020000; -use ExtUtils::MakeMaker 6.5503; +use 5.022000; +use ExtUtils::MakeMaker 6.66; -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.022'; # PDFbuild.pl updates from 'version' file - -# optional libraries... prompt user whether or not to install -# nice to have but not vital for many users -# if one fails to install, it might alarm the user, but installation of -# PDF::Builder can still proceed -# user can remove any optional installed library if they don't need it -# and want to reclaim the space -# update t/00-all-usable.t to exclude modules using these libraries! -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. 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. -); - -# EVERY RELEASE: check https://www.cpan.org/src/ "First release in each branch -# of Perl" (NOT "Latest releases in each branch of Perl"!) and subtract -# 6 years to get date of oldest release, and then go one release before that. -# Update the required Perl minimum here and in .perl-version, dist.ini[.old], -# and .travis.yml[.HOLD], and commit to repository. -# Can't fully automate, since "use $PERL_version;" is invalid (eval?). -# Would be nice to read cpan First Release and figure out min Perl version. -# -# Perhaps build Makefile.PL (and some other files?) during build process, -# so proper Perl version can be inserted into a template then? Perl version -# could come from .perl-version (reformatted), or scraped from cpan.org page. +my $PERL_version = '5.022000'; # Both here and in "use" statement above, + # PDFbuild.pl updates from 'version' file +my $MakeMaker_version = '6.66'; +my $version = '3.023'; # PDFbuild.pl updates from 'version' file + +# optional libraries... most users will attempt to install full set. they are +# nice to have but not vital for many users. if one fails to install, it might +# alarm the user, but installation of PDF::Builder can still proceed. the +# user can remove any optional installed library if they don't need it and +# want to reclaim the space. or, they can run optional_update.pl to select +# optional libraries, before running Makefile.PL. # for future consideration #my $master = 'lib/PDF/Builder.pm'; #my $version = MM->parse_version($master); -# prompt routine lifted from IO::Socket::SSL, and modified to allow -# arbitrary choices (not just y and n). NOT checked: that default is -# among choices, and default is lowercase! -# for the original Y/n, choices 'yn' max 1 default 'y' or 'n' -local $| = 1; - -my $make_choice = sub { - my ($msg, $choices, $max, $default) = @_; - return $default if defined $default && $ENV{PERL_MM_USE_DEFAULT}; - # Taken from ExtUtils::MakeMaker 6.16 (Michael Schwern) so that - # the prompt() function can be emulated for older versions of ExtUtils::MakeMaker. - while ( -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT))) { - print "$msg "; - my $choice = <>; - $choice =~ s/\s//g; # strip off whitespace - if (length($choice) > $max) { next; } # too many entries? - $choice ||= $default; - next if $choice !~ m/^([$choices]+)$/i; - return lc($1); - } - - return $default; -}; - my %WriteMakefileArgs = ( - NAME => "PDF::Builder", - DISTNAME => "PDF-Builder", - VERSION => $version, + NAME => "PDF::Builder", + DISTNAME => "PDF-Builder", +# VERSION_FROM => $master, + VERSION => $version, # ABSTRACT_FROM => $master, - ABSTRACT => "Facilitates the creation and modification of PDF files", + ABSTRACT => "Facilitates the creation and modification of PDF files", - AUTHOR => 'Phil Perry', - LICENSE => "lgpl", - MIN_PERL_VERSION => $PERL_version, - INSTALLDIRS => "site", + AUTHOR => 'Phil Perry', + LICENSE => "lgpl_2_1", # some files also MIT license + MIN_PERL_VERSION => $PERL_version, + INSTALLDIRS => "site", - CONFIGURE_REQUIRES => { + CONFIGURE_REQUIRES => { "ExtUtils::MakeMaker" => $MakeMaker_version, - }, + }, # BUILD_REQUIRES => { # mandatory prereqs listed here # }, - TEST_REQUIRES => { + TEST_REQUIRES => { "Test::Exception" => 0, "Test::Memory::Cycle" => 1.0, - }, + }, - PREREQ_PM => { + PREREQ_PM => { "Compress::Zlib" => 1.0, "Font::TTF" => 1.04, # === found in CORE, so no need to explicitly list - #"utf8" => 0, - #"File::Temp" => 0, - #"File::Basename" => 0, + #"Carp" => 0, + #"constant" => 0, + #"Encode" => 0, + #"Exporter" =>0, + #"FileHandle" => 0, #"File::Find" => 0, - #"Scalar::Util" => 0, + #"File::Basename" => 0, + #"File::Temp" => 0, #"IO::File" => 0, - #"Unicode::UCD" => 0, - #"warnings" => 0, - #"Math::Trig" => 0, #"List::Util" => 0, + #"Math::Trig" => 0, #"POSIX" => 0 + #"Scalar::Util" => 0, + #"strict" => 0, + #"Unicode::UCD" => 0, + #"utf8" => 0, + #"vars" => 0, + #"warnings" => 0, + + # === NOT core, but not currently used + #"Win32::TieRegistry" => 0, # if manually use Win32, need to install }, META_MERGE => { - "meta-spec" => { version => 2 }, + "meta-spec" => { "version" => 2 }, - resources => { + "resources" => { - homepage => "https://metacpan.org/pod/PDF::Builder", + "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', + "repository" => { + "type" => 'git', + "url" => 'git://github.com/PhilterPaper/Perl-PDF-Builder.git', + "web" => 'https://github.com/PhilterPaper/Perl-PDF-Builder', }, - bugtracker => { - web => 'https://github.com/PhilterPaper/Perl-PDF-Builder/issues', + "bugtracker" => { + "web" => 'https://github.com/PhilterPaper/Perl-PDF-Builder/issues', }, }, # recommends (optional prereqs) goes here + # if remove or comment out any, also do so in META.json and META.yml + "recommends" => { + "Graphics::TIFF" => 16, + # advanced/fast PNG image processing. + "Image::PNG::Libpng" => 0.57, + # text shaping for Latin script ligatures and kerning, and for + # many complex scripts both LTR and RTL directions. + "HarfBuzz::Shaper" => 0.024, + }, - }, + } ); @@ -150,29 +120,6 @@ # $WriteMakefileArgs{PREREQ_PM}{'MacPerl'} = '0'; #} -my ($prompt, $i, $c, $all_list); -my $list_len = scalar(@choice_list); -# build multi-line prompt and output it -if (scalar @choice_list > 0) { # in case all disabled! - $prompt = "Attempt to install or update optional prereq libraries?\n". - " a (default) = install all choices listed below\n". - " n = do NOT install any of them\n". - " or enter 1 to $list_len of the following choices:\n"; - $all_list = ''; - for ($i = 0; $i < $list_len; $i++) { - $all_list .= $choice_list[$i][0]; - $prompt .= " $choice_list[$i][0] = install/update $choice_list[$i][1] ($choice_list[$i][3] support)"; - if ($i < $list_len-1) { $prompt .= "\n"; } - } - $prompt .= " [A|n|{".join('|', split //,$all_list)."}]"; - - $c = $make_choice->( $prompt, 'an'.$all_list, $list_len, 'a' ); -} else { - $c = 'n'; # default if nothing available -} -# $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'; =========================================================================== The installation process will attempt to install or update several OPTIONAL @@ -181,15 +128,5 @@ some advanced features. See the README file for more information. =========================================================================== END - if ($c =~ m/a/) { $c = $all_list; } - - # $c is one or more choices (no 'a' or 'n') - # build 'recommends' entry into %WriteMakefileArgs - for ($i = 0; $i < $list_len; $i++) { - if (index($c, $choice_list[$i][0]) < 0) { next; } - $WriteMakefileArgs{'META_MERGE'}{'recommends'}{ - "$choice_list[$i][1]"} = $choice_list[$i][2]; - } -} WriteMakefile(%WriteMakefileArgs); diff -Nru libpdf-builder-perl-3.022/MANIFEST libpdf-builder-perl-3.023/MANIFEST --- libpdf-builder-perl-3.022/MANIFEST 2021-03-28 00:57:48.000000000 +0000 +++ libpdf-builder-perl-3.023/MANIFEST 2021-05-16 17:59:43.000000000 +0000 @@ -1,10 +1,12 @@ # This file is manually maintained .perlcriticrc -.perl-version Changes CONTRIBUTING Makefile.PL MANIFEST +META.json +META.yml +optional_update.pl README.md tools/1_pc.pl tools/2_t-tests.pl @@ -67,11 +69,12 @@ examples/Bspline.pl examples/Content.pl examples/ContentText.pl +examples/examples.output examples/HarfBuzz.pl +examples/README examples/RMtutorial.pl examples/Rotated.pl -examples/examples.output -examples/README +examples/ShowFont.pl examples/Windows/027_winfont examples/Windows/Win32.pm lib/PDF/Builder.pm @@ -220,6 +223,7 @@ t/extgstate.t t/filter-ascii85decode.t t/filter-asciihexdecode.t +t/filter-lzwdecode.t t/filter-runlengthdecode.t t/font-corefont.t t/font-synfont.t @@ -244,5 +248,3 @@ t/text.t t/tiff.t t/viewer-preferences.t -META.yml Module YAML meta-data (added by MakeMaker) -META.json Module JSON meta-data (added by MakeMaker) diff -Nru libpdf-builder-perl-3.022/META.json libpdf-builder-perl-3.023/META.json --- libpdf-builder-perl-3.022/META.json 2021-03-28 00:57:47.000000000 +0000 +++ libpdf-builder-perl-3.023/META.json 2021-07-16 02:15:12.000000000 +0000 @@ -4,9 +4,9 @@ "Phil Perry" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010", "license" : [ - "open_source" + "lgpl_2_1" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", @@ -27,14 +27,14 @@ }, "configure" : { "requires" : { - "ExtUtils::MakeMaker" : "6.5503" + "ExtUtils::MakeMaker" : "6.66" } }, "runtime" : { "requires" : { "Compress::Zlib" : "1", "Font::TTF" : "1.04", - "perl" : "5.020000" + "perl" : "5.022000" } }, "test" : { @@ -56,6 +56,6 @@ "web" : "https://github.com/PhilterPaper/Perl-PDF-Builder" } }, - "version" : "3.022", + "version" : "3.023", "x_serialization_backend" : "JSON::PP version 4.06" } diff -Nru libpdf-builder-perl-3.022/META.yml libpdf-builder-perl-3.023/META.yml --- libpdf-builder-perl-3.022/META.yml 2021-03-28 00:57:34.000000000 +0000 +++ libpdf-builder-perl-3.023/META.yml 2021-07-16 02:14:42.000000000 +0000 @@ -7,10 +7,10 @@ Test::Exception: '0' Test::Memory::Cycle: '1' configure_requires: - ExtUtils::MakeMaker: '6.5503' + ExtUtils::MakeMaker: '6.66' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010' -license: open_source +generated_by: 'ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010' +license: lgpl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' @@ -22,10 +22,10 @@ requires: Compress::Zlib: '1' Font::TTF: '1.04' - perl: '5.020000' + perl: '5.022000' resources: bugtracker: https://github.com/PhilterPaper/Perl-PDF-Builder/issues homepage: https://metacpan.org/pod/PDF::Builder repository: git://github.com/PhilterPaper/Perl-PDF-Builder.git -version: '3.022' +version: '3.023' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -Nru libpdf-builder-perl-3.022/optional_update.pl libpdf-builder-perl-3.023/optional_update.pl --- libpdf-builder-perl-3.022/optional_update.pl 1970-01-01 00:00:00.000000000 +0000 +++ libpdf-builder-perl-3.023/optional_update.pl 2021-07-16 02:06:11.000000000 +0000 @@ -0,0 +1,280 @@ +#!/usr/bin/perl +use warnings; +use strict; + +# a utility to select which optional prerequisites to remove from the +# "recommends" list in Makefile.PL, META.json, and META.yml before manually +# running Makefile.PL to build the product. + +# Makefile.PL and META.yml +# delete an option by #-out the line +# restore an option by removing # +# META.json (does not support comments) +# delete an option by erasing the line +# restore an option by adding line back in + +# t/00-all-usable.t and lib/PDF/Builder.pm, while also making use of the +# optional prerequisites, do not need to exclude unused optionals. + +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.023'; # manually update whenever code is changed + +# master list of optional prerequisites: +# make sure that any updates to patterns etc. keep the same order +my %options = ( + '1' => ["Graphics::TIFF", "16" ], + '2' => ["Image::PNG::Libpng", "0.57" ], + '3' => ["HarfBuzz::Shaper", "0.024"], + ); + +print "\nHere are the available optional libraries. Select 0 or more of\n"; +print "them by entering their key numbers 1,2,3, etc. in a one-line list,\n"; +print "separated by commas and/or spaces. Enter all numbers for the normal\n"; +print "default of ALL selected:\n"; + +my ($i, $j, @list); +my $numEntries = scalar keys %options; +for ($i=1; $i<=$numEntries; $i++) { + print "$i $options{$i}[0] (version $options{$i}[1])\n"; +} +print "\nEnter any (or all) numbers to use: "; +my $input = <>; +if (length($input)) { + @list = split /[\s,]+/, $input; + # valid entries? + for ($j=0; $j 0) { + # valid number + } else { + die "Invalid entry '$list[$j]'!\n"; + } + } + # too many entries? + if (scalar @list > $numEntries) { + die "Too many entries!\n"; + } + # duplicate entries? + for ($i=0; $i\\s*)[\\d.]+,", + "(\"Image::PNG::Libpng\"\\s*=>\\s*)[\\d.]+,", + "(\"HarfBuzz::Shaper\"\\s*=>\\s*)[\\d.]+,", + ); + + my $infile = "Makefile.PL"; + my $outtemp = "xxxx.tmp"; + my ($IN, $OUT); + unless (open($IN, "<", $infile)) { + die "Unable to read $infile for update\n"; + } + unless (open($OUT, ">", $outtemp)) { + die "Unable to write temporary output file for $infile update\n"; + } + + my ($line, $i); + my $flag = 0; + while ($line = <$IN>) { + # $line still has line-end \n + + # no optionals requested? #-out "recommends" => { and }, + if (!scalar(@list)) { + if ($line =~ m/^[^#]\s+"recommends" => \{/) { + $flag = 1; + $line = '#'.$line; + } + if ($flag && $line =~ m/},/) { + $flag = 0; + $line = '#'.$line; + } + } + + # if there ARE optionals, un-# "recommends" and } + if (scalar(@list)) { + if ($line =~ m/^#\s+"recommends" => \{/) { + $flag = 1; + $line = substr($line, 1); + } + if ($flag && $line =~ m/^#\s+},?/) { + $flag = 0; + $line = substr($line, 1); + } + } + + for ($i=0; $i<$numEntries; $i++) { + if ($line =~ m/$pattern[$i]/) { + if (member_of($i+1, @list)) { + # is in list, remove any leading # + if ($line =~ m/^#/) { + $line =~ s/^#//; + } + } else { + # is not in list, comment-out unless already done so + if ($line !~ m/^#/) { + $line = '#'.$line; + } + } + last; + } + } + print $OUT $line; + } + + close($IN); + close($OUT); + system("copy $outtemp $infile"); + unlink($outtemp); + + return; +} # end of update_Makefile() + +# META.json find line and remove if not in @list, add back in if in @list +sub update_META_json { + # file should be ./META.json + my @pattern = ( + "(\"Graphics::TIFF\"\\s*:\\s*)\"[\\d.]+\"", + "(\"Image::PNG::Libpng\"\\s*:\\s*)\"[\\d.]+\"", + "(\"HarfBuzz::Shaper\"\\s*:\\s*)\"[\\d.]+\"", + ); + + my $infile = "META.json"; + my $outtemp = "xxxx.tmp"; + my ($IN, $OUT); + unless (open($IN, "<", $infile)) { + die "Unable to read $infile for update\n"; + } + unless (open($OUT, ">", $outtemp)) { + die "Unable to write temporary output file for $infile update\n"; + } + + my ($line, $i); + my $flag = 0; + while ($line = <$IN>) { + # $line still has line-end \n + + # NOTE: my understanding is that an empty { } is legal + # remove lines in-between "recommends" and }[,] + # re-insert desired ones + if ($line =~ m/"recommends"\s*:/) { + $flag = 1; + } elsif ($flag && $line =~ m/},?/) { + $flag = 0; + # re-insert desired options before closing }, + # $line still has }, in it waiting to be output + my $count = 0; + for ($i=1; $i<=$numEntries; $i++) { + # is $i in @list? replace in file + if (member_of($i, @list)) { + print $OUT " \"$options{$i}[0]\" : \"$options{$i}[1]\""; + if (++$count == scalar(@list)) { + # last one, no comma + print $OUT "\n"; + } else { + # not last one, add comma + print $OUT ",\n"; + } + } + } + } elsif ($flag) { + # erase this entry (all optional entries will be erased) + next; + } + print $OUT $line; + } + + close($IN); + close($OUT); + system("copy $outtemp $infile"); + unlink($outtemp); + + return; +} # end of update_META_json() + +# META.yml find line and # out if not in @list, remove any # if in @list +sub update_META_yml { + # file should be ./Makefile.PL + my @pattern = ( + "(Graphics::TIFF:\\s*)'[\\d.]+'", + "(Image::PNG::Libpng:\\s*)'[\\d.]+'", + "(HarfBuzz::Shaper:\\s*)'[\\d.]+'", + ); + + my $infile = "META.yml"; + my $outtemp = "xxxx.tmp"; + my ($IN, $OUT); + unless (open($IN, "<", $infile)) { + die "Unable to read $infile for update\n"; + } + unless (open($OUT, ">", $outtemp)) { + die "Unable to write temporary output file for $infile update\n"; + } + + my ($line, $i); + while ($line = <$IN>) { + # $line still has line-end \n + + # no optionals requested? #-out recommends: + if (!scalar(@list)) { + if ($line =~ m/^[^#]\s*recommends:/) { + $line = '#'.$line; + } + } + + for ($i=0; $i<$numEntries; $i++) { + if ($line =~ m/$pattern[$i]/) { + if (member_of($i+1, @list)) { + # is in list, remove any leading # + if ($line =~ m/^#/) { + $line =~ s/^#//; + } + } else { + # is not in list, comment-out unless already done so + if ($line !~ m/^#/) { + $line = '#'.$line; + } + } + last; + } + } + print $OUT $line; + } + + close($IN); + close($OUT); + system("copy $outtemp $infile"); + unlink($outtemp); + + return; +} # end of update_META_yml() + +sub member_of { + my ($member, @list) = @_; + + if ($member ~~ @list) { + return 1; + } else { + return 0; + } +} diff -Nru libpdf-builder-perl-3.022/.perl-version libpdf-builder-perl-3.023/.perl-version --- libpdf-builder-perl-3.022/.perl-version 2021-03-28 00:54:02.000000000 +0000 +++ libpdf-builder-perl-3.023/.perl-version 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -5.20.0 diff -Nru libpdf-builder-perl-3.022/README.md libpdf-builder-perl-3.023/README.md --- libpdf-builder-perl-3.022/README.md 2021-02-01 14:40:47.000000000 +0000 +++ libpdf-builder-perl-3.023/README.md 2021-06-03 19:03:39.000000000 +0000 @@ -23,12 +23,15 @@ 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. +By default, all are installed (as "recommended", so failure to install will +not fail the overall PDF::Builder installation). You may choose which ones to +install by modifying certain installation files with "optional\_update.pl". ## Requirements ### Perl -**Perl 5.20** or higher. It will likely run on somewhat earlier versions, but +**Perl 5.22** 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 @@ -37,13 +40,14 @@ #### Older Perls -If you MUST install on an older (pre 5.20) Perl, you can try the following for +If you MUST install on an older (pre 5.22) 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. Edit META.json and change 5.022000 to 5.016000 or whatever level desired +1. Edit META.yml and change 5.022000 to 5.016000 or whatever level desired +1. Edit Makefile.PL and change `use 5.022000;` to `use 5.016000;`, change `$PERL_version` from `5.022000` to `5.016000` 1. `cpan .` Note that some Perl installers MAY have a means to override or suppress the @@ -73,8 +77,9 @@ 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. +installation. If you use optional\_update.pl to _not_ to install any of +them, or they fail to install automatically, 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) diff -Nru libpdf-builder-perl-3.022/t/00-all-usable.t libpdf-builder-perl-3.023/t/00-all-usable.t --- libpdf-builder-perl-3.022/t/00-all-usable.t 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/t/00-all-usable.t 2021-07-16 02:08:24.000000000 +0000 @@ -5,8 +5,8 @@ use Test::More; use File::Find; -my $GrTFversion = 7; # minimum version of Graphics::TIFF -my $LpngVersion = 0.56; # minimum version of Image::PNG::Libpng +my $GrTFversion = 16; # minimum version of Graphics::TIFF +my $LpngVersion = 0.57; # 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. diff -Nru libpdf-builder-perl-3.022/t/annotate.t libpdf-builder-perl-3.023/t/annotate.t --- libpdf-builder-perl-3.022/t/annotate.t 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/t/annotate.t 2021-07-16 02:08:24.000000000 +0000 @@ -32,7 +32,7 @@ $string = $pdf->stringify(); $pdf = PDF::Builder->open_scalar($string); -$page = $pdf->openpage(1); +$page = $pdf->open_page(1); $annotation = $page->annotation(); $annotation->text('This is an annotation', -rect => [ 72, 144, 172, 244 ]); diff -Nru libpdf-builder-perl-3.022/t/deprecations.t libpdf-builder-perl-3.023/t/deprecations.t --- libpdf-builder-perl-3.022/t/deprecations.t 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/t/deprecations.t 2021-07-16 02:08:24.000000000 +0000 @@ -2,17 +2,430 @@ use strict; use warnings; -use Test::More tests => 1; - -#no warnings 'deprecated'; ## no critic +use Test::More tests => 68; use PDF::Builder; -use PDF::Builder::Resource::XObject::Image::JPEG; +my ($pdf, $page, $pdf2, $pdf_string, $media, $sizes_PDF, $sizes_page, @box); -my $pdf = PDF::Builder->new(); -#my $image = PDF::Builder::Resource::XObject::Image::JPEG->new_api($pdf, 't/resources/1x1.jpg'); +#### TBD when a deprecated interface is removed, keep the test for the new +#### replacement here, while commenting out the old interface +## new_api -- removed from PDF::Builder, deprecated in PDF::API2 +#use PDF::Builder::Resource::XObject::Image::JPEG; +#$pdf = PDF::Builder->new(); +#my $image = PDF::Builder::Resource::XObject::Image::JPEG->new_api($pdf, 't/resources/1x1.jpg'); #ok($image, q{new_api still works}); -ok($pdf, q{new_api removed}); +# TBD need test for replacement call + +# create a dummy PDF (as string) for further tests +$pdf = PDF::Builder->new(); +$pdf->page()->gfx()->fillcolor('blue'); +$pdf_string = $pdf->stringify(); + +## openScalar() -> open_scalar() +# removed from PDF::Builder, deprecated in PDF::API2 +#$pdf = PDF::Builder->openScalar($pdf_string); +#is(ref($pdf), 'PDF::Builder', +# q{openScalar still works}); +$pdf = PDF::Builder->open_scalar($pdf_string); +is(ref($pdf), 'PDF::Builder', + q{open_scalar replacement for openScalar IS available}); + +## importpage() -> import_page() +# removed from PDF::Builder, deprecated in PDF::API2 +$pdf2 = PDF::Builder->new(); +#$page = $pdf2->importpage($pdf, 1); +#is(ref($page), 'PDF::Builder::Page', +# q{importpage still works}); +$page = $pdf2->import_page($pdf, 1); +is(ref($page), 'PDF::Builder::Page', + q{import_page replacement for importpage IS available}); + +## openpage() -> open_page() +# replaced by open_page in API2 +$pdf2 = PDF::Builder->open_scalar($pdf_string); +$page = $pdf2->openpage(1); +is(ref($page), 'PDF::Builder::Page', + q{openpage still works}); +$page = $pdf2->open_page(1); +is(ref($page), 'PDF::Builder::Page', + q{open_page replacement for openpage IS available}); + +# PDF::Builder-specific cases to ADD tests for (deprecated but NOT yet removed): +# +# ===== scheduled to be REMOVED 8/2021 +# elementsof() -> elements() +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +# should be US letter [ 0 0 612 792 ] for default media +$media = $page->find_prop('MediaBox'); +$media = [ map { $_->val() } $media->elementsof() ]; +ok($media->[0]==0 && $media->[1]==0 && $media->[2]==612 && $media->[3]==792, + q{elementsof still works}); +$media = $page->find_prop('MediaBox'); +$media = [ map { $_->val() } $media->elements() ]; +ok($media->[0]==0 && $media->[1]==0 && $media->[2]==612 && $media->[3]==792, + q{elements replacement for elementsof IS available}); + +# removeobj() -> (gone) + +# get_mediabox() -> mediabox() +# default mediabox size, inherited by page +# should be US letter [ 0 0 612 792 ] for default media +$sizes_PDF = [0, 0, 612, 792]; +$sizes_page = [0, 0, 612, 792]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +@box = $page->get_mediabox(); +ok(array_comp($sizes_page, @box), + q{get_mediabox still works for default page media size}); +@box = $pdf2->mediabox(); +ok(array_comp($sizes_PDF, @box), + q{mediabox IS available for default PDF media size}); +@box = $page->mediabox(); +ok(array_comp($sizes_page, @box), + q{mediabox replacement for get_mediabox IS available for default page media size}); + +# set mediabox at PDF, page should inherit +$sizes_PDF = [ 0, 0, 100, 150 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->mediabox(0, 0, 100, 150); +$page = $pdf2->page(); +@box = $page->get_mediabox(); +ok(array_comp($sizes_page, @box), + q{get_mediabox still works for PDF-set page media size}); +@box = $pdf2->mediabox(); +ok(array_comp($sizes_PDF, @box), + q{mediabox IS available for PDF-set PDF media size}); +@box = $page->mediabox(); +ok(array_comp($sizes_page, @box), + q{mediabox replacement for get_mediabox IS available for PDF-set page media size}); + +# set mediabox at page, PDF is default +$sizes_PDF = [ 0, 0, 612, 792 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +$page->mediabox(0, 0, 100, 150); +@box = $page->get_mediabox(); +ok(array_comp($sizes_page, @box), + q{get_mediabox still works for page-set page media size}); +@box = $pdf2->mediabox(); +ok(array_comp($sizes_PDF, @box), + q{mediabox IS available for default PDF media size}); +@box = $page->mediabox(); +ok(array_comp($sizes_page, @box), + q{mediabox replacement for get_mediabox IS available for page-set page media size}); + +# set mediabox at PDF and page +$sizes_PDF = [ 0, 0, 200, 300 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->mediabox(0, 0, 200, 300); +$page = $pdf2->page(); +$page->mediabox(0, 0, 100, 150); +@box = $page->get_mediabox(); +ok(array_comp($sizes_page, @box), + q{get_mediabox still works for page-set page media size}); +@box = $pdf2->mediabox(); +ok(array_comp($sizes_PDF, @box), + q{mediabox IS available for PDF-set PDF media size}); +@box = $page->mediabox(); +ok(array_comp($sizes_page, @box), + q{mediabox replacement for get_mediabox IS available for page-set page media size}); + +# get_cropbox() -> cropbox() +# default cropbox size, inherited by page +# should be US letter [ 0 0 612 792 ] for default media +$sizes_PDF = [0, 0, 612, 792]; +$sizes_page = [0, 0, 612, 792]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +@box = $page->get_cropbox(); +ok(array_comp($sizes_page, @box), + q{get_cropbox still works for default page cropbox size}); +@box = $pdf2->cropbox(); +ok(array_comp($sizes_PDF, @box), + q{cropbox IS available for default PDF cropbox size}); +@box = $page->cropbox(); +ok(array_comp($sizes_page, @box), + q{cropbox replacement for get_cropbox IS available for default page cropbox size}); + +# set cropbox at PDF, page should inherit +$sizes_PDF = [ 0, 0, 100, 150 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->cropbox(0, 0, 100, 150); +$page = $pdf2->page(); +@box = $page->get_cropbox(); +ok(array_comp($sizes_page, @box), + q{get_cropbox still works for PDF-set page cropbox size}); +@box = $pdf2->cropbox(); +ok(array_comp($sizes_PDF, @box), + q{cropbox IS available for PDF-set PDF cropbox size}); +@box = $page->cropbox(); +ok(array_comp($sizes_page, @box), + q{cropbox replacement for get_cropbox IS available for PDF-set page cropbox size}); + +# set cropbox at page, PDF is default +$sizes_PDF = [ 0, 0, 612, 792 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +$page->cropbox(0, 0, 100, 150); +@box = $page->get_cropbox(); +ok(array_comp($sizes_page, @box), + q{get_cropbox still works for page-set page cropbox size}); +@box = $pdf2->cropbox(); +ok(array_comp($sizes_PDF, @box), + q{cropbox IS available for default PDF cropbox size}); +@box = $page->cropbox(); +ok(array_comp($sizes_page, @box), + q{cropbox replacement for get_cropbox IS available for page-set page cropbox size}); + +# set cropbox at PDF and page +$sizes_PDF = [ 0, 0, 200, 300 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->cropbox(0, 0, 200, 300); +$page = $pdf2->page(); +$page->cropbox(0, 0, 100, 150); +@box = $page->get_cropbox(); +ok(array_comp($sizes_page, @box), + q{get_cropbox still works for page-set page cropbox size}); +@box = $pdf2->cropbox(); +ok(array_comp($sizes_PDF, @box), + q{cropbox IS available for PDF-set PDF cropbox size}); +@box = $page->cropbox(); +ok(array_comp($sizes_page, @box), + q{cropbox replacement for get_cropbox IS available for page-set page cropbox size}); + +# get_bleedbox() -> bleedbox() +# default bleedbox size, inherited by page +# should be US letter [ 0 0 612 792 ] for default media +$sizes_PDF = [0, 0, 612, 792]; +$sizes_page = [0, 0, 612, 792]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +@box = $page->get_bleedbox(); +ok(array_comp($sizes_page, @box), + q{get_bleedbox still works for default page bleedbox size}); +@box = $pdf2->bleedbox(); +ok(array_comp($sizes_PDF, @box), + q{bleedbox IS available for default PDF bleedbox size}); +@box = $page->bleedbox(); +ok(array_comp($sizes_page, @box), + q{bleedbox replacement for get_bleedbox IS available for default page bleedbox size}); + +# set bleedbox at PDF, page should inherit +$sizes_PDF = [ 0, 0, 100, 150 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->bleedbox(0, 0, 100, 150); +$page = $pdf2->page(); +@box = $page->get_bleedbox(); +ok(array_comp($sizes_page, @box), + q{get_bleedbox still works for PDF-set page bleedbox size}); +@box = $pdf2->bleedbox(); +ok(array_comp($sizes_PDF, @box), + q{bleedbox IS available for PDF-set PDF bleedbox size}); +@box = $page->bleedbox(); +ok(array_comp($sizes_page, @box), + q{bleedbox replacement for get_bleedbox IS available for PDF-set page bleedbox size}); + +# set bleedbox at page, PDF is default +$sizes_PDF = [ 0, 0, 612, 792 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +$page->bleedbox(0, 0, 100, 150); +@box = $page->get_bleedbox(); +ok(array_comp($sizes_page, @box), + q{get_bleedbox still works for page-set page bleedbox size}); +@box = $pdf2->bleedbox(); +ok(array_comp($sizes_PDF, @box), + q{bleedbox IS available for default PDF bleedbox size}); +@box = $page->bleedbox(); +ok(array_comp($sizes_page, @box), + q{bleedbox replacement for get_bleedbox IS available for page-set page bleedbox size}); + +# set bleedbox at PDF and page +$sizes_PDF = [ 0, 0, 200, 300 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->bleedbox(0, 0, 200, 300); +$page = $pdf2->page(); +$page->bleedbox(0, 0, 100, 150); +@box = $page->get_bleedbox(); +ok(array_comp($sizes_page, @box), + q{get_bleedbox still works for page-set page bleedbox size}); +@box = $pdf2->bleedbox(); +ok(array_comp($sizes_PDF, @box), + q{bleedbox IS available for PDF-set PDF bleedbox size}); +@box = $page->bleedbox(); +ok(array_comp($sizes_page, @box), + q{bleedbox replacement for get_bleedbox IS available for page-set page bleedbox size}); + +# get_trimbox() -> trimbox() +# default trimbox size, inherited by page +# should be US letter [ 0 0 612 792 ] for default media +$sizes_PDF = [0, 0, 612, 792]; +$sizes_page = [0, 0, 612, 792]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +@box = $page->get_trimbox(); +ok(array_comp($sizes_page, @box), + q{get_trimbox still works for default page trimbox size}); +@box = $pdf2->trimbox(); +ok(array_comp($sizes_PDF, @box), + q{trimbox IS available for default PDF trimbox size}); +@box = $page->trimbox(); +ok(array_comp($sizes_page, @box), + q{trimbox replacement for get_trimbox IS available for default page trimbox size}); + +# set trimbox at PDF, page should inherit +$sizes_PDF = [ 0, 0, 100, 150 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->trimbox(0, 0, 100, 150); +$page = $pdf2->page(); +@box = $page->get_trimbox(); +ok(array_comp($sizes_page, @box), + q{get_trimbox still works for PDF-set page trimbox size}); +@box = $pdf2->trimbox(); +ok(array_comp($sizes_PDF, @box), + q{trimbox IS available for PDF-set PDF trimbox size}); +@box = $page->trimbox(); +ok(array_comp($sizes_page, @box), + q{trimbox replacement for get_trimbox IS available for PDF-set page trimbox size}); + +# set trimbox at page, PDF is default +$sizes_PDF = [ 0, 0, 612, 792 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +$page->trimbox(0, 0, 100, 150); +@box = $page->get_trimbox(); +ok(array_comp($sizes_page, @box), + q{get_trimbox still works for page-set page trimbox size}); +@box = $pdf2->trimbox(); +ok(array_comp($sizes_PDF, @box), + q{trimbox IS available for default PDF trimbox size}); +@box = $page->trimbox(); +ok(array_comp($sizes_page, @box), + q{trimbox replacement for get_trimbox IS available for page-set page trimbox size}); + +# set trimbox at PDF and page +$sizes_PDF = [ 0, 0, 200, 300 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->trimbox(0, 0, 200, 300); +$page = $pdf2->page(); +$page->trimbox(0, 0, 100, 150); +@box = $page->get_trimbox(); +ok(array_comp($sizes_page, @box), + q{get_trimbox still works for page-set page trimbox size}); +@box = $pdf2->trimbox(); +ok(array_comp($sizes_PDF, @box), + q{trimbox IS available for PDF-set PDF trimbox size}); +@box = $page->trimbox(); +ok(array_comp($sizes_page, @box), + q{trimbox replacement for get_trimbox IS available for page-set page trimbox size}); + +# get_artbox() -> artbox() +# default artbox size, inherited by page +# should be US letter [ 0 0 612 792 ] for default media +$sizes_PDF = [0, 0, 612, 792]; +$sizes_page = [0, 0, 612, 792]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +@box = $page->get_artbox(); +ok(array_comp($sizes_page, @box), + q{get_artbox still works for default page artbox size}); +@box = $pdf2->artbox(); +ok(array_comp($sizes_PDF, @box), + q{artbox IS available for default PDF artbox size}); +@box = $page->artbox(); +ok(array_comp($sizes_page, @box), + q{artbox replacement for get_artbox IS available for default page artbox size}); + +# set artbox at PDF, page should inherit +$sizes_PDF = [ 0, 0, 100, 150 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->artbox(0, 0, 100, 150); +$page = $pdf2->page(); +@box = $page->get_artbox(); +ok(array_comp($sizes_page, @box), + q{get_artbox still works for PDF-set page artbox size}); +@box = $pdf2->artbox(); +ok(array_comp($sizes_PDF, @box), + q{artbox IS available for PDF-set PDF artbox size}); +@box = $page->artbox(); +ok(array_comp($sizes_page, @box), + q{artbox replacement for get_artbox IS available for PDF-set page artbox size}); + +# set artbox at page, PDF is default +$sizes_PDF = [ 0, 0, 612, 792 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$page = $pdf2->page(); +$page->artbox(0, 0, 100, 150); +@box = $page->get_artbox(); +ok(array_comp($sizes_page, @box), + q{get_artbox still works for page-set page artbox size}); +@box = $pdf2->artbox(); +ok(array_comp($sizes_PDF, @box), + q{artbox IS available for default PDF artbox size}); +@box = $page->artbox(); +ok(array_comp($sizes_page, @box), + q{artbox replacement for get_artbox IS available for page-set page artbox size}); + +# set artbox at PDF and page +$sizes_PDF = [ 0, 0, 200, 300 ]; +$sizes_page = [ 0, 0, 100, 150 ]; +$pdf2 = PDF::Builder->new(); +$pdf2->artbox(0, 0, 200, 300); +$page = $pdf2->page(); +$page->artbox(0, 0, 100, 150); +@box = $page->get_artbox(); +ok(array_comp($sizes_page, @box), + q{get_artbox still works for page-set page artbox size}); +@box = $pdf2->artbox(); +ok(array_comp($sizes_PDF, @box), + q{artbox IS available for PDF-set PDF artbox size}); +@box = $page->artbox(); +ok(array_comp($sizes_page, @box), + q{artbox replacement for get_artbox IS available for page-set page artbox size}); + +# +# ===== scheduled to be REMOVED 3/2023 +# lead() -> leading() +$pdf2 = PDF::Builder->new('-compress' => 'none'); +my $text = $pdf2->page()->text(); +$text->lead(15); +like($pdf2->stringify(), qr/15 TL/, q{lead still works }); +$pdf2 = PDF::Builder->new('-compress' => 'none'); +$text = $pdf2->page()->text(); +$text->leading(15); +like($pdf2->stringify(), qr/15 TL/, q{leading replacement for lead IS available}); +# +# textlead() -> textleading() Lite.pm only, no t test + +# if nothing left to check... +#is(ref($pdf), 'PDF::Builder', +# q{No deprecated tests to run at this time}); + +sub array_comp { + my ($expected_size_ref, @got_size) = @_; + my $len_e = scalar(@{$expected_size_ref}); + my $len_g = scalar(@got_size); + if ($len_e != $len_g) { return 0; } + for (my $e = 0; $e < $len_e; $e++) { + if ($expected_size_ref->[$e] != $got_size[$e]) { return 0; } + } + return 1; +} 1; diff -Nru libpdf-builder-perl-3.022/t/filter-lzwdecode.t libpdf-builder-perl-3.023/t/filter-lzwdecode.t --- libpdf-builder-perl-3.022/t/filter-lzwdecode.t 1970-01-01 00:00:00.000000000 +0000 +++ libpdf-builder-perl-3.023/t/filter-lzwdecode.t 2021-07-16 02:08:24.000000000 +0000 @@ -0,0 +1,75 @@ +#!/usr/bin/perl +use warnings; +use strict; + +use PDF::Builder::Basic::PDF::Utils; +use PDF::Builder::Basic::PDF::Filter::LZWDecode; +use Test::More tests => 9; + +my $filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); +my $in = 'BT /F1 24 Tf 100 700 Td (Hello World)Tj ET'; +my $out = $filter->outfilt($in); +is $filter->infilt($out), $in, 'LZWDecode test string round-tripped correctly'; + +### + +my $repeat = 22; +note( 'Test data size: ' . length($in)*$repeat ); +$filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); +$out = $filter->outfilt($in x $repeat); +note( 'Final bits: '.$filter->{code_length} ); +cmp_ok length($out), '<', length($in)*$repeat, "Data compresses smaller"; + +$filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); +is $filter->infilt($out), $in x $repeat, 'Data decompresses unchanged at 10bit boundary'; + +### + +$in = pack "H*", '8000000014040807050001e100f840fd00e0003fd00ff8a44e2b01'; +my $expected = pack "H*", '00000180000003800000078000000f8000003f80e000ff80ffffff80ffffff80'; +$filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); +$out = $filter->infilt($in); +is $out, $expected, 'decompress binary data'; + +($in, $expected) = ($expected, $in); +$filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); +$out = $filter->outfilt($in); +is $out, $expected, 'compress binary data'; + +### + +$repeat = 30000; +$in = ''; +for (0..$repeat) {$in .= chr(int(rand(256)))} +note( 'Test data size: ' . length($in) ); +$filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); +$out = $filter->outfilt($in); +note( 'Final bits: '.$filter->{'code_length'} ); + +$filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new(); +is $filter->infilt($out), $in, 'Data decompresses unchanged after reaching max code length'; + +### + +$in = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; +my $height = 2; +$filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new({Predictor => PDFNum(2), Rows=>PDFNum($height), Columns=>PDFNum(length($in)/$height)}); +$out = $filter->outfilt($in); +is $filter->infilt($out), $in, 'LZWDecode test string round-tripped correctly with horizontal predictor'; + +### + +$in = '000FFF000000FFF000'; +$height = 2; +my $colors = 3; +$filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new({Predictor => PDFNum(2), Rows=>PDFNum($height), Columns=>PDFNum(length($in)/$height/$colors), Colors=>PDFNum($colors)}); +$out = $filter->outfilt($in); +is $filter->infilt($out), $in, 'LZWDecode test string round-tripped correctly with horizontal predictor + 3 color channels'; + +### + +$in = pack "H*", '0000FFFFFFFF0000'; +$expected = pack "H*", '0000FF00FF000100'; +$filter = PDF::Builder::Basic::PDF::Filter::LZWDecode->new({Predictor => PDFNum(2), Rows=>PDFNum($height), Columns=>PDFNum(length($in)/$height)}); +$out = $filter->_predict($in); +is $out, $expected, 'predict binary data with overflow'; diff -Nru libpdf-builder-perl-3.022/t/pdf.t libpdf-builder-perl-3.023/t/pdf.t --- libpdf-builder-perl-3.022/t/pdf.t 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/t/pdf.t 2021-07-16 02:08:24.000000000 +0000 @@ -2,8 +2,9 @@ use warnings; use strict; -use Test::More tests => 12; +use Test::More tests => 16; +use File::Temp qw(tempfile); use PDF::Builder; my $pdf = PDF::Builder->new(); @@ -93,4 +94,50 @@ like($pdf->stringify(), qr{/PageLabels << /Nums \[ 0 << /P \(Test\) /S /D >> \] >>}, q{Page Numbering: Decimal Characters (implicit), with prefix}); +## +## stringify +## + +$pdf = PDF::Builder->new('-compress' => 'none'); +$gfx = $pdf->page()->gfx(); +$gfx->fillcolor('blue'); + +$string = $pdf->stringify(); +like($string, qr/0 0 1 rg/, + q{Stringify of newly-created PDF contains expected content}); + +my ($fh, $filename) = tempfile(); +print $fh $string; +close $fh; + +$pdf = PDF::Builder->open($filename); +$string = $pdf->stringify(); +like($string, qr/0 0 1 rg/, + q{Stringify of newly-opened PDF contains expected content}); + +## +## saveas with same filename +## (in response to bug 134993, introduced by 113516, not yet in PDF::Builder) +## + +$pdf = PDF::Builder->new(-compress => 'none'); +$gfx = $pdf->page->gfx(); +$gfx->fillcolor('blue'); + +($fh, $filename) = tempfile(); +print $fh $pdf->stringify(); +close $fh; + +$pdf = PDF::Builder->open($filename, -compress => 'none'); +$gfx = $pdf->page->gfx(); +$gfx->fillcolor('red'); +$pdf->saveas($filename); + +$pdf = PDF::Builder->open($filename, -compress => 'none'); +$string = $pdf->stringify(); +like($string, qr/0 0 1 rg/, + q{saveas($opened_filename) contains original content}); +like($string, qr/1 0 0 rg/, + q{saveas($opened_filename) contains new content}); + 1; diff -Nru libpdf-builder-perl-3.022/t/string.t libpdf-builder-perl-3.023/t/string.t --- libpdf-builder-perl-3.022/t/string.t 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/t/string.t 2021-07-16 02:08:24.000000000 +0000 @@ -1,8 +1,9 @@ #!/usr/bin/perl use strict; use warnings; +use utf8; -use Test::More tests => 40; +use Test::More tests => 42; use PDF::Builder::Basic::PDF::String; @@ -188,6 +189,12 @@ "\x05", q{Escape Character: 1-digit octal}); +use PDF::Builder::Basic::PDF::Utils; +# PDF::API2 enters string as 'PiDeltaPhi', not escapes +$string = PDFStr("\x{03A0}\x{0394}\x{03A6}"); +is($string->as_pdf(), + '', + q{A string with the utf8 flag set is automatically encoded as UCS-16BE}); # RT 63918 $string = PDF::Builder::Basic::PDF::String->from_pdf('(3\000f' . "\x5c\x5c" . '3\000f)'); @@ -203,4 +210,11 @@ '<0000005C00000000>', q{[RT #63918] Incorrect handling of literal backslashes 2/2}); + +# RT 134957 +$string = PDFStr("\x00\n\x00"); +is($string->as_pdf(), + '<000A00>', + q{\n in a string containing non-printable characters is hex-encoded}); + 1; diff -Nru libpdf-builder-perl-3.022/t/tiff.t libpdf-builder-perl-3.023/t/tiff.t --- libpdf-builder-perl-3.022/t/tiff.t 2021-03-28 00:54:03.000000000 +0000 +++ libpdf-builder-perl-3.023/t/tiff.t 2021-07-16 02:08:24.000000000 +0000 @@ -4,11 +4,15 @@ use English qw( -no_match_vars ); use IPC::Cmd qw(can_run run); use File::Spec; -use Test::More tests => 13; +use File::Temp; +use version; +use Test::More tests => 19; use PDF::Builder; # 0: allow use of Graphics::TIFF, 1: force non-GT usage my $noGT = 0; +my $diag = ''; +my $failed; # Filename 3 tests ------------------ # tests 1 and 3 will mention TIFF_GT if Graphics::TIFF is installed and @@ -17,9 +21,11 @@ my $pdf = PDF::Builder->new('-compress' => 'none'); # common $pdf all tests my $has_GT = 0; # global flag for all tests that need to know if Graphics::TIFF +my ($page, $img, $example, $expected); # -silent shuts off one-time warning for rest of run my $tiff = $pdf->image_tiff('t/resources/1x1.tif', -silent => 1, -nouseGT => $noGT); +# 1 if ($tiff->usesLib() == 1) { $has_GT = 1; isa_ok($tiff, 'PDF::Builder::Resource::XObject::Image::TIFF_GT', @@ -29,9 +35,11 @@ q{$pdf->image_tiff(filename)}); } +# 2 is($tiff->width(), 1, q{Image from filename has a width}); +# 3 my $gfx = $pdf->page()->gfx(); $gfx->image($tiff, 72, 144, 216, 288); like($pdf->stringify(), qr/q 216 0 0 288 72 144 cm \S+ Do Q/, @@ -39,6 +47,7 @@ # Filehandle (old library only) 2 tests ------------------ +# 4 $pdf = PDF::Builder->new(); open my $fh, '<', 't/resources/1x1.tif' or die "Couldn't open file t/resources/1x1.tif"; @@ -46,6 +55,7 @@ isa_ok($tiff, 'PDF::Builder::Resource::XObject::Image::TIFF', q{$pdf->image_tiff(filehandle)}); +# 5 is($tiff->width(), 1, q{Image from filehandle has a width}); @@ -55,6 +65,7 @@ $pdf = PDF::Builder->new('-compress' => 'none'); +# 6 my $lzw_tiff = $pdf->image_tiff('t/resources/1x1-lzw.tif', -nouseGT => $noGT); if ($lzw_tiff->usesLib() == 1) { isa_ok($lzw_tiff, 'PDF::Builder::Resource::XObject::Image::TIFF_GT', @@ -67,11 +78,13 @@ $gfx = $pdf->page()->gfx(); $gfx->image($lzw_tiff, 72, 360, 216, 432); +# 7 like($pdf->stringify(), qr/q 216 0 0 432 72 360 cm \S+ Do Q/, q{Add TIFF to PDF}); # Missing file 1 test ------------------ +# 8 $pdf = PDF::Builder->new(); eval { $pdf->image_tiff('t/resources/this.file.does.not.exist', -nouseGT => $noGT) }; ok($@, q{Fail fast if the requested file doesn't exist}); @@ -80,8 +93,10 @@ # common data for remaining tests my $width = 1000; my $height = 100; -my $tiff_f = 'test.tif'; -my $pdfout = 'test.pdf'; +my $directory = File::Temp->newdir(); +my $tiff_f = File::Spec->catfile($directory, 'test.tif'); +my $pdfout = File::Spec->catfile($directory, 'test.pdf'); +my $pngout = File::Spec->catfile($directory, 'out.png'); # NOTE: following 4 tests use 'convert' tool from ImageMagick. # They may require software installation on your system, and @@ -92,14 +107,19 @@ # may have to do this manually my ($convert, $gs); -# Linux-like systems usually have a pre-installed "convert" utility, while -# Windows must use ImageMagick. In addition, be careful NOT to run "convert" -# on Windows, as this is a HDD reformatter! +# ImageMagick pre-v7 has a "convert" utility. +# On v7, this is called via "magick convert" +# On Windows, be careful NOT to run "convert", as this is a HDD reformatter! if (can_run("magick")) { $convert = "magick convert"; } elsif ($OSNAME ne 'MSWin32' and can_run("convert")) { $convert = "convert"; } +# check if reasonably recent version +$convert = check_version($convert, '-version', 'ImageMagick ([0-9.]+)', '6.9.7'); +# $convert undef if not installed, can't parse format, version too low +# will skip "No ImageMagick" + # on Windows, ImageMagick can be 64-bit or 32-bit version, so try both. it's # needed for some magick convert operations, and also standalone, and # usually must be installed. @@ -111,134 +131,334 @@ } elsif (can_run("gs")) { $gs = "gs"; } +# check if reasonably recent version +$gs = check_version($gs, '-v', 'Ghostscript ([0-9.]+)', '9.25.0'); +# $convert undef if not installed, can't parse format, version too low +# will skip "No Ghostscript" # alpha layer handling ------------------ # convert and Graphics::TIFF needed +# 9 SKIP: { - skip "No 'convert' utility available, or no Graphics::TIFF.", 1 unless + skip "Either ImageMagick, Ghostscript or Graphics::TIFF not available.", 1 unless defined $convert and defined $gs and $has_GT; system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" $tiff_f"); # ---------- $pdf = PDF::Builder->new(-file => $pdfout); -my $page = $pdf->page(); +$page = $pdf->page(); $page->mediabox($width, $height); $gfx = $page->gfx(); -my $img = $pdf->image_tiff($tiff_f, -nouseGT => $noGT); +$img = $pdf->image_tiff($tiff_f, -nouseGT => $noGT); $gfx->image($img, 0, 0, $width, $height); $pdf->save(); $pdf->end(); # ---------- -system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pngalpha -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=out.png $pdfout"); -my $example = `$convert out.png -colorspace gray -depth 1 txt:-`; +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pngalpha -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +my $example = `$convert $pngout -colorspace gray -depth 1 txt:-`; my $expected = `$convert $tiff_f -depth 1 txt:-`; # ---------- -is($example, $expected, 'alpha'); +is($example, $expected, 'alpha + flate') or show_diag(); } # G4 (NOT converted to Flate) ------------------ # convert and Graphics::TIFF are needed +# 10 SKIP: { - skip "No 'convert' utility available, or no Graphics::TIFF.", 1 unless + skip "Either ImageMagick, Ghostscript or Graphics::TIFF not available.", 1 unless defined $convert and defined $gs and $has_GT; system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -compress Group4 $tiff_f"); # ---------- $pdf = PDF::Builder->new(-file => $pdfout); -my $page = $pdf->page(); +$page = $pdf->page(); $page->mediabox($width, $height); $gfx = $page->gfx(); -my $img = $pdf->image_tiff($tiff_f, -nouseGT => $noGT); +$img = $pdf->image_tiff($tiff_f, -nouseGT => $noGT); $gfx->image($img, 0, 0, $width, $height); $pdf->save(); $pdf->end(); # ---------- -system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=out.png $pdfout"); -my $example = `$convert out.png -depth 1 txt:-`; -my $expected = `$convert $tiff_f -depth 1 txt:-`; +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +$example = `$convert $pngout -depth 1 txt:-`; +$expected = `$convert $tiff_f -depth 1 txt:-`; # ---------- -is($example, $expected, 'G4 (not converted to flate)'); +is($example, $expected, 'G4 (not converted to flate)') or show_diag(); } # LZW (NOT converted to Flate) ------------------ # convert and Graphics::TIFF needed for these two tests +# 11 SKIP: { - skip "No 'convert' utility available, or no Graphics::TIFF.", 1 unless + skip "Either ImageMagick, Ghostscript or Graphics::TIFF not available.", 1 unless defined $convert and defined $gs and $has_GT; system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -compress lzw $tiff_f"); # ---------- $pdf = PDF::Builder->new(-file => $pdfout); -my $page = $pdf->page(); +$page = $pdf->page(); +$page->mediabox( $width, $height ); +$gfx = $page->gfx(); +$img = $pdf->image_tiff($tiff_f, -nouseGT => 0); +$gfx->image( $img, 0, 0, $width, $height ); +$pdf->save(); +$pdf->end(); + +# ---------- +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +$example = `$convert $pngout -depth 1 -alpha off txt:-`; +$expected = `$convert $tiff_f -depth 1 -alpha off txt:-`; +# ---------- + +is($example, $expected, 'single-strip lzw (not converted to flate) with GT') or show_diag(); +} + +# 12 +SKIP: { + skip "Either ImageMagick, Ghostscript or Graphics::TIFF not available.", 1 unless + defined $convert and defined $gs and $has_GT; + +system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -define tiff:rows-per-strip=50 -compress lzw $tiff_f"); +# ---------- +$pdf = PDF::Builder->new(-file => $pdfout); +$page = $pdf->page(); +$page->mediabox( $width, $height ); +$gfx = $page->gfx(); +$img = $pdf->image_tiff($tiff_f, -nouseGT => 0); +$gfx->image( $img, 0, 0, $width, $height ); +$pdf->save(); +$pdf->end(); + +# ---------- +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +$example = `$convert $pngout -depth 1 -alpha off txt:-`; +$expected = `$convert $tiff_f -depth 1 -alpha off txt:-`; +# ---------- + +is($example, $expected, 'multi-strip lzw (not converted to flate) with GT') or show_diag(); +} + +# 13 +SKIP: { + skip "Either ImageMagick, Ghostscript or Graphics::TIFF not available.", 1 unless + defined $convert and defined $gs and $has_GT; + +$width = 20; +$height = 20; +system("$convert -depth 8 -size 2x2 pattern:gray50 -scale 1000% -alpha off -define tiff:predictor=2 -compress lzw $tiff_f"); +# ---------- +$pdf = PDF::Builder->new(-file => $pdfout); +$page = $pdf->page(); +$page->mediabox( $width, $height ); +$gfx = $page->gfx(); +$img = $pdf->image_tiff($tiff_f, -nouseGT => 0); +$gfx->image( $img, 0, 0, $width, $height ); +$pdf->save(); +$pdf->end(); + +# ---------- +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +$example = `$convert $pngout -depth 8 -alpha off txt:-`; +$expected = `$convert $tiff_f -depth 8 -alpha off txt:-`; +# ---------- + +is($example, $expected, 'lzw+horizontal predictor (not converted to flate) with GT') or show_diag(); +} + +# 14 +SKIP: { + skip "Either ImageMagick, Ghostscript or Graphics::TIFF not available.", 1 unless + defined $convert and defined $gs and $has_GT; + +$width = 1000; +$height = 100; + +system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -compress lzw $tiff_f"); +# ---------- +$pdf = PDF::Builder->new(-file => $pdfout); +$page = $pdf->page(); $page->mediabox( $width, $height ); $gfx = $page->gfx(); -my $img = $pdf->image_tiff($tiff_f, -nouseGT => 0); +$img = $pdf->image_tiff($tiff_f, -nouseGT => $noGT); $gfx->image( $img, 0, 0, $width, $height ); $pdf->save(); $pdf->end(); # ---------- -system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=out.png $pdfout"); -my $example = `$convert out.png -depth 1 -alpha off txt:-`; -my $expected = `$convert $tiff_f -depth 1 -alpha off txt:-`; +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pngalpha -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +$example = `$convert $pngout -colorspace gray -depth 1 txt:-`; +$expected = `$convert $tiff_f -depth 1 txt:-`; # ---------- -is($example, $expected, 'lzw (not converted to flate) with GT'); +is($example, $expected, 'alpha + lzw') or show_diag(); } +# 15 SKIP: { - skip "No 'convert' utility available.", 1 unless + skip "Either ImageMagick or Ghostscript not available.", 1 unless defined $convert and defined $gs; system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -compress lzw $tiff_f"); # ---------- $pdf = PDF::Builder->new(-file => $pdfout); -my $page = $pdf->page(); +$page = $pdf->page(); +$page->mediabox( $width, $height ); +$gfx = $page->gfx(); +$img = $pdf->image_tiff($tiff_f, -nouseGT => 1); +$gfx->image( $img, 0, 0, $width, $height ); +$pdf->save(); +$pdf->end(); + +# ---------- +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +$example = `$convert $pngout -depth 1 -alpha off txt:-`; +$expected = `$convert $tiff_f -depth 1 -alpha off txt:-`; +# ---------- + +is($example, $expected, 'single-strip lzw (not converted to flate) without GT') or show_diag(); +} + +SKIP: { + skip "Either ImageMagick or Ghostscript not available.", 1 unless + defined $convert and defined $gs; + +# 16 +$width = 20; +$height = 20; +system("$convert -depth 8 -size 2x2 pattern:gray50 -scale 1000% -alpha off -define tiff:predictor=2 -compress lzw $tiff_f"); +# ---------- +$pdf = PDF::Builder->new(-file => $pdfout); +$page = $pdf->page(); +$page->mediabox( $width, $height ); +$gfx = $page->gfx(); +$img = $pdf->image_tiff($tiff_f, -nouseGT => 1); +$gfx->image( $img, 0, 0, $width, $height ); +$pdf->save(); +$pdf->end(); + +# ---------- +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +$example = `$convert $pngout -depth 1 -alpha off txt:-`; +$expected = `$convert $tiff_f -depth 1 -alpha off txt:-`; +# ---------- + +is($example, $expected, 'lzw+horizontal predictor (not converted to flate) without GT') or show_diag(); +$width = 1000; +$height = 100; +} + +# 17 +SKIP: { + #skip "currently fails due to bug inherited from PDF::API2", 1; + skip "multi-strip lzw without GT is not currently supported", 1; +system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -define tiff:rows-per-strip=50 -compress lzw $tiff_f"); +# ---------- +$pdf = PDF::Builder->new(-file => $pdfout); +$page = $pdf->page(); $page->mediabox( $width, $height ); $gfx = $page->gfx(); -my $img = $pdf->image_tiff($tiff_f, -nouseGT => 1); +$img = $pdf->image_tiff($tiff_f, -nouseGT => 1); $gfx->image( $img, 0, 0, $width, $height ); $pdf->save(); $pdf->end(); # ---------- -system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=out.png $pdfout"); -my $example = `$convert out.png -depth 1 -alpha off txt:-`; -my $expected = `$convert $tiff_f -depth 1 -alpha off txt:-`; +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +$example = `$convert $pngout -depth 1 -alpha off txt:-`; +$expected = `$convert $tiff_f -depth 1 -alpha off txt:-`; # ---------- -is($example, $expected, 'lzw (not converted to flate) without GT'); +is($example, $expected, 'multi-strip lzw (not converted to flate) without GT') or show_diag(); } # read TIFF with colormap ------------------ # convert and Graphics::TIFF needed for this test +# 18 SKIP: { - skip "No 'convert' utility available, or no Graphics::TIFF.", 1 unless + skip "Either ImageMagick or Graphics::TIFF not available.", 1 unless defined $convert and $has_GT; # .png file is temporary file (output, input, erased) -system("$convert rose: -type palette -depth 2 colormap.png"); -system("$convert colormap.png $tiff_f"); +my $colormap = File::Spec->catfile($directory, 'colormap.png'); +system("$convert rose: -type palette -depth 2 $colormap"); +system("$convert $colormap $tiff_f"); $pdf = PDF::Builder->new(-file => $pdfout); -my $page = $pdf->page; +$page = $pdf->page; $page->mediabox( $width, $height ); $gfx = $page->gfx(); -my $img = $pdf->image_tiff($tiff_f, -nouseGT => $noGT); +$img = $pdf->image_tiff($tiff_f, -nouseGT => $noGT); $gfx->image( $img, 0, 0, $width, $height ); $pdf->save(); $pdf->end(); pass 'successfully read TIFF with colormap'; } +# 19 +SKIP: { + skip "Either ImageMagick, Ghostscript or Graphics::TIFF not available.", 1 unless + defined $convert and defined $gs and $has_GT; + +$width = 6; +$height = 1; +system("$convert -depth 1 -size ${width}x${height} pattern:gray50 -alpha on $tiff_f"); +$pdf = PDF::Builder->new(-file => $pdfout); +$page = $pdf->page(); +$page->mediabox( $width, $height ); +$gfx = $page->gfx(); +$img = $pdf->image_tiff($tiff_f, -nouseGT => 0); +$gfx->image( $img, 0, 0, $width, $height ); +$pdf->save(); +$pdf->end(); + +# ---------- +system("$gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g${width}x${height} -dPDFFitPage -dUseCropBox -sOutputFile=$pngout $pdfout"); +$example = `$convert $pngout -depth 1 -alpha off txt:-`; +$expected = `$convert $tiff_f -depth 1 -alpha off txt:-`; +# "For reasons I don't understand, gs swaps the last two pixels here, so let's +# ignore them." This glitch is reported by @carygravel ("gs consistently +# swapped two pixels in the last byte of the first row" over multiple test +# images), but the PDF produced appears to be OK -- it's just something odd +# happening in producing the PNG for comparison. We'll keep an eye on it, as I +# don't particularly like magic solutions. See PR #165. +$example =~ s/(.*\n).*\n.*\n$/$1/; +$expected =~ s/(.*\n).*\n.*\n$/$1/; +# ---------- + +is($example, $expected, "bilevel and alpha when width not a whole number of bytes with GT") or show_diag(); +} + ############################################################## # cleanup. all tests involving these files skipped? -unlink $pdfout, $tiff_f, 'colormap.png', 'out.png'; +# check non-Perl utility versions +sub check_version { + my ($cmd, $arg, $regex, $min_ver) = @_; + + # was the check routine already defined (installed)? + if (defined $cmd) { + # should match dotted version number + my $output = `$cmd $arg`; + $diag .= $output; + if ($output =~ m/$regex/) { + if (version->parse($1) >= version->parse($min_ver)) { + return $cmd; + } + } + } + return; # cmd not defined (not installed) so return undef +} + +sub show_diag { + $failed = 1; + return; +} + +if ($failed) { diag($diag) } diff -Nru libpdf-builder-perl-3.022/tools/1_pc.pl libpdf-builder-perl-3.023/tools/1_pc.pl --- libpdf-builder-perl-3.022/tools/1_pc.pl 2021-03-28 00:52:42.000000000 +0000 +++ libpdf-builder-perl-3.023/tools/1_pc.pl 2021-07-16 02:06:14.000000000 +0000 @@ -7,8 +7,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.021'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.021'; # manually update whenever code is changed # command line: # -5 run perlcritic -5 . (should be clean) diff -Nru libpdf-builder-perl-3.022/tools/2_t-tests.pl libpdf-builder-perl-3.023/tools/2_t-tests.pl --- libpdf-builder-perl-3.022/tools/2_t-tests.pl 2021-03-28 00:52:42.000000000 +0000 +++ libpdf-builder-perl-3.023/tools/2_t-tests.pl 2021-07-16 02:06:14.000000000 +0000 @@ -7,8 +7,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.016'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.016'; # manually update whenever code is changed # command line flags, mutually exclusive: # -raw show full output of each t-test run diff -Nru libpdf-builder-perl-3.022/tools/3_examples.pl libpdf-builder-perl-3.023/tools/3_examples.pl --- libpdf-builder-perl-3.022/tools/3_examples.pl 2021-03-28 00:52:42.000000000 +0000 +++ libpdf-builder-perl-3.023/tools/3_examples.pl 2021-07-16 02:06:14.000000000 +0000 @@ -7,8 +7,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.018'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.018'; # manually update whenever code is changed # dependent on optional packages: my $HS_installed = 1; # HarfBuzz::Shaper IS installed and you want to use it. diff -Nru libpdf-builder-perl-3.022/tools/4_contrib.pl libpdf-builder-perl-3.023/tools/4_contrib.pl --- libpdf-builder-perl-3.022/tools/4_contrib.pl 2021-03-28 00:52:42.000000000 +0000 +++ libpdf-builder-perl-3.023/tools/4_contrib.pl 2021-07-16 02:06:15.000000000 +0000 @@ -7,8 +7,8 @@ use strict; use warnings; -our $VERSION = '3.022'; # VERSION -my $LAST_UPDATE = '3.013'; # manually update whenever code is changed +our $VERSION = '3.023'; # VERSION +our $LAST_UPDATE = '3.013'; # manually update whenever code is changed # command line: #