Import upstream version 2.030001+git20210413.1.a10b770
Debian Janitor
2 years ago
0 | 0.001 2021-06-09 | |
1 | ||
2 | - Renamed openpage to open_page in PDF::API2. The old name is deprecated. | |
3 | ||
4 | ||
5 | 2.040 2021-04-13 | |
6 | ||
7 | - Fix open() followed by stringify() resulting in a corrupt (mostly-empty) | |
8 | PDF, which was broken by changes in 2.039 (reported by Gareth Tunley). | |
9 | ||
10 | - [RT #134993] Calling open($filename) followed by saveas($same_filename) | |
11 | instead of update() resulted in a corrupt PDF in 2.039, which no longer | |
12 | reads the entire file into memory on open (reported by Marco Pessotto). | |
13 | ||
14 | - [RT #134957] Fix encoding of \n in a PDF string containing non-printable | |
15 | characters (reported by Stuart Henderson). | |
16 | ||
17 | - [RT #133131] Fix endianness of 64-bit numbers in cross-reference stream | |
18 | widths array (reported by Christopher Papademetrious, fix by Vadim Repin). | |
19 | ||
20 | ||
0 | 21 | 2.039 2021-03-04 |
1 | 22 | |
2 | 23 | - PDF::API2->open($filename) no longer reads the entire file into memory |
46 | 46 | "web" : "https://github.com/ssimms/pdfapi2" |
47 | 47 | } |
48 | 48 | }, |
49 | "version" : "2.039", | |
50 | "x_generated_by_perl" : "v5.28.1", | |
51 | "x_serialization_backend" : "Cpanel::JSON::XS version 4.09", | |
49 | "version" : "0.001", | |
50 | "x_generated_by_perl" : "v5.32.1", | |
51 | "x_serialization_backend" : "Cpanel::JSON::XS version 4.25", | |
52 | 52 | "x_spdx_expression" : "LGPL-2.1" |
53 | 53 | } |
54 | 54 |
19 | 19 | perl: v5.10.0 |
20 | 20 | resources: |
21 | 21 | repository: git://github.com/ssimms/pdfapi2.git |
22 | version: '2.039' | |
23 | x_generated_by_perl: v5.28.1 | |
22 | version: '0.001' | |
23 | x_generated_by_perl: v5.32.1 | |
24 | 24 | x_serialization_backend: 'YAML::Tiny version 1.73' |
25 | 25 | x_spdx_expression: LGPL-2.1 |
23 | 23 | "Test::Exception" => 0, |
24 | 24 | "Test::Memory::Cycle" => 0 |
25 | 25 | }, |
26 | "VERSION" => "2.039", | |
26 | "VERSION" => "0.001", | |
27 | 27 | "test" => { |
28 | 28 | "TESTS" => "t/*.t" |
29 | 29 | } |
0 | 0 | This archive contains the distribution PDF-API2, |
1 | version 2.039: | |
1 | version 0.001: | |
2 | 2 | |
3 | 3 | Facilitates the creation and modification of PDF files |
4 | 4 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 |
12 | 12 | use strict; |
13 | 13 | use warnings; |
14 | 14 | |
15 | our $VERSION = '2.039'; # VERSION | |
15 | our $VERSION = '0.001'; # VERSION | |
16 | 16 | |
17 | 17 | =head1 NAME |
18 | 18 |
11 | 11 | |
12 | 12 | use strict; |
13 | 13 | |
14 | our $VERSION = '2.039'; # VERSION | |
14 | our $VERSION = '0.001'; # VERSION | |
15 | 15 | |
16 | 16 | =head1 NAME |
17 | 17 |
12 | 12 | use strict; |
13 | 13 | no warnings qw[ deprecated recursion uninitialized ]; |
14 | 14 | |
15 | our $VERSION = '2.039'; # VERSION | |
15 | our $VERSION = '0.001'; # VERSION | |
16 | 16 | |
17 | 17 | our $mincache = 16 * 1024 * 1024; |
18 | 18 |
9 | 9 | |
10 | 10 | use strict; |
11 | 11 | |
12 | our $VERSION = '2.039'; # VERSION | |
12 | our $VERSION = '0.001'; # VERSION | |
13 | 13 | |
14 | 14 | =head1 NAME |
15 | 15 | |
1167 | 1167 | return unpack('n', $data) if $width == 2; |
1168 | 1168 | return unpack('N', "\x00$data") if $width == 3; |
1169 | 1169 | return unpack('N', $data) if $width == 4; |
1170 | return unpack('Q', $data) if $width == 8; | |
1171 | ||
1172 | die "Invalid column width: $width"; | |
1170 | return unpack('Q>', $data) if $width == 8; | |
1171 | ||
1172 | die "Unsupported xref stream entry width: $width"; | |
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | sub readxrtr { |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | sub outfilt { |
10 | 10 | my ($self, $str, $isend) = @_; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | # Maintainer's Note: ASCIIHexDecode is described in the PDF 1.7 spec |
10 | 10 | # in section 7.4.2. |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use POSIX qw(ceil floor); |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | sub new { |
10 | 10 | my ($class, $decode_parms) = @_; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | # Maintainer's Note: RunLengthDecode is described in the PDF 1.7 spec |
10 | 10 | # in section 7.4.5. |
10 | 10 | use strict; |
11 | 11 | use warnings; |
12 | 12 | |
13 | our $VERSION = '2.039'; # VERSION | |
13 | our $VERSION = '0.001'; # VERSION | |
14 | 14 | |
15 | 15 | use PDF::API2::Basic::PDF::Filter::ASCII85Decode; |
16 | 16 | use PDF::API2::Basic::PDF::Filter::ASCIIHexDecode; |
4 | 4 | |
5 | 5 | use strict; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Filter; |
10 | 10 | use PDF::API2::Basic::PDF::Name; |
11 | 11 | |
12 | 12 | use strict; |
13 | 13 | |
14 | our $VERSION = '2.039'; # VERSION | |
14 | our $VERSION = '0.001'; # VERSION | |
15 | 15 | |
16 | 16 | =head1 NAME |
17 | 17 |
11 | 11 | |
12 | 12 | use strict; |
13 | 13 | |
14 | our $VERSION = '2.039'; # VERSION | |
14 | our $VERSION = '0.001'; # VERSION | |
15 | 15 | |
16 | 16 | =head1 NAME |
17 | 17 |
11 | 11 | |
12 | 12 | use strict; |
13 | 13 | |
14 | our $VERSION = '2.039'; # VERSION | |
14 | our $VERSION = '0.001'; # VERSION | |
15 | 15 | |
16 | 16 | =head1 NAME |
17 | 17 |
10 | 10 | use strict; |
11 | 11 | use warnings; |
12 | 12 | |
13 | our $VERSION = '2.039'; # VERSION | |
13 | our $VERSION = '0.001'; # VERSION | |
14 | 14 | |
15 | 15 | =head1 NAME |
16 | 16 |
12 | 12 | use strict; |
13 | 13 | use warnings; |
14 | 14 | |
15 | our $VERSION = '2.039'; # VERSION | |
15 | our $VERSION = '0.001'; # VERSION | |
16 | 16 | |
17 | 17 | use PDF::API2::Basic::PDF::Dict; |
18 | 18 | use PDF::API2::Basic::PDF::Utils; |
12 | 12 | |
13 | 13 | use base 'PDF::API2::Basic::PDF::Dict'; |
14 | 14 | |
15 | our $VERSION = '2.039'; # VERSION | |
15 | our $VERSION = '0.001'; # VERSION | |
16 | 16 | |
17 | 17 | use PDF::API2::Basic::PDF::Array; |
18 | 18 | use PDF::API2::Basic::PDF::Dict; |
11 | 11 | |
12 | 12 | use strict; |
13 | 13 | |
14 | our $VERSION = '2.039'; # VERSION | |
14 | our $VERSION = '0.001'; # VERSION | |
15 | 15 | |
16 | 16 | =head1 NAME |
17 | 17 | |
190 | 190 | return "<FEFF$str>"; |
191 | 191 | } |
192 | 192 | else { |
193 | if ($str =~ m/[^\n\r\t\b\f\040-\176\200-\377]/oi) { | |
194 | $str =~ s/(.)/sprintf('%02X', ord($1))/oge; | |
193 | if ($str =~ m/[^\n\r\t\b\f\040-\176\200-\377]/) { | |
194 | $str =~ s/(.)/sprintf('%02X', ord($1))/sge; | |
195 | 195 | return "<$str>"; |
196 | 196 | } |
197 | 197 | else { |
198 | $str =~ s/([\n\r\t\b\f\\()])/\\$out_trans{$1}/ogi; | |
198 | $str =~ s/([\n\r\t\b\f\\()])/\\$out_trans{$1}/g; | |
199 | 199 | return "($str)"; |
200 | 200 | } |
201 | 201 | } |
9 | 9 | |
10 | 10 | use strict; |
11 | 11 | |
12 | our $VERSION = '2.039'; # VERSION | |
12 | our $VERSION = '0.001'; # VERSION | |
13 | 13 | |
14 | 14 | =head1 NAME |
15 | 15 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | sub new { |
10 | 10 | my ($class) = @_; |
4 | 4 | use strict; |
5 | 5 | no warnings qw( deprecated recursion uninitialized ); |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Carp; |
10 | 10 | use Compress::Zlib (); |
2 | 2 | use strict; |
3 | 3 | no warnings qw[ deprecated recursion uninitialized ]; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | BEGIN { |
8 | 8 |
3 | 3 | |
4 | 4 | use Carp; |
5 | 5 | |
6 | our $VERSION = '2.039'; # VERSION | |
6 | our $VERSION = '0.001'; # VERSION | |
7 | 7 | |
8 | 8 | sub new { |
9 | 9 | my $type = shift(); |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Encode qw(:all); |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Carp qw(croak); |
10 | 10 | use PDF::API2::Basic::PDF::Utils; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use POSIX qw(floor); |
10 | 10 | use Scalar::Util qw(weaken); |
44 | 44 | |
45 | 45 | =item $page = PDF::API2::Page->coerce $pdf, $pdfpage |
46 | 46 | |
47 | Returns a page object converted from $pdfpage (called from $pdf->openpage). | |
47 | Returns a page object converted from $pdfpage (called from $pdf->open_page). | |
48 | 48 | |
49 | 49 | =cut |
50 | 50 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Compress::Zlib; |
10 | 10 | use Encode qw(:all); |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Util; |
10 | 10 | use PDF::API2::Basic::PDF::Utils; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Carp; |
10 | 10 | use Encode qw(:all); |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 | use PDF::API2::Resource::CIDFont::TrueType::FontFile; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Encode qw(:all); |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 | use PDF::API2::Util; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 | use PDF::API2::Util; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 | use PDF::API2::Util; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 | use PDF::API2::Util; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 | use PDF::API2::Util; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 | use PDF::API2::Util; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 | use PDF::API2::Util; |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub get_colors { |
8 | 8 | return ( |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 | use PDF::API2::Util; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Util; |
10 | 10 | use PDF::API2::Basic::PDF::Utils; |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'BankGothicMediumBT', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Courier', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Courier-Bold', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Courier-BoldOblique', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Courier-Oblique', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Georgia', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Georgia,Bold', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Georgia,BoldItalic', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Georgia,Italic', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Helvetica', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Helvetica-Bold', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Helvetica-BoldOblique', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Helvetica-Oblique', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Symbol', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Times-Bold', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Times-BoldItalic', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Times-Italic', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Times-Roman', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'TrebuchetMS', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'TrebuchetMS,Bold', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'TrebuchetMS,BoldItalic', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'TrebuchetMS,Italic', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Verdana', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Verdana,Bold', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Verdana,BoldItalic', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Verdana,Italic', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Webdings', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'Wingdings', |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub data { return { |
8 | 8 | 'fontname' => 'ZapfDingbats', |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use File::Basename; |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Encode qw(:all); |
10 | 10 | use IO::File qw(); |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Math::Trig; |
10 | 10 | use Unicode::UCD 'charinfo'; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Encode qw(:all); |
10 | 10 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | # The data in this file is generated from uniglyph.txt. In earlier |
8 | 8 | # versions of PDF::API2, this file was parsed and sorted every time |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | sub get_paper_sizes { |
8 | 8 | return ( |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | sub new { |
10 | 10 | my ($class, $pdf, $name) = @_; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | 1; |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | use Carp; |
8 | 8 | use Encode qw(:all); |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | sub new { |
10 | 10 | my ($class, $pdf, %options) = @_; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | =head1 NAME |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | sub new { |
10 | 10 | my ($class, $pdf, %options) = @_; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | sub new { |
10 | 10 | my ($class, $pdf, %options) = @_; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | # Interleaved 2 of 5 Barcodes |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Util; |
10 | 10 | use PDF::API2::Basic::PDF::Utils; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Dict; |
10 | 10 | use PDF::API2::Basic::PDF::Utils; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Util; |
10 | 10 | use PDF::API2::Basic::PDF::Utils; |
4 | 4 | use strict; |
5 | 5 | no warnings qw[ deprecated recursion uninitialized ]; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use IO::File; |
10 | 10 | use PDF::API2::Util; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use IO::File; |
10 | 10 | use PDF::API2::Util; |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use Compress::Zlib; |
10 | 10 | use POSIX qw(ceil floor); |
8 | 8 | use strict; |
9 | 9 | no warnings qw[ deprecated recursion uninitialized ]; |
10 | 10 | |
11 | our $VERSION = '2.039'; # VERSION | |
11 | our $VERSION = '0.001'; # VERSION | |
12 | 12 | |
13 | 13 | use IO::File; |
14 | 14 | use PDF::API2::Util; |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | use IO::File; |
8 | 8 |
6 | 6 | |
7 | 7 | no warnings 'uninitialized'; |
8 | 8 | |
9 | our $VERSION = '2.039'; # VERSION | |
9 | our $VERSION = '0.001'; # VERSION | |
10 | 10 | |
11 | 11 | use Compress::Zlib; |
12 | 12 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Basic::PDF::Utils; |
10 | 10 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '2.039'; # VERSION | |
7 | our $VERSION = '0.001'; # VERSION | |
8 | 8 | |
9 | 9 | use PDF::API2::Util qw(pdfkey); |
10 | 10 | use PDF::API2::Basic::PDF::Utils; # PDFName |
2 | 2 | use strict; |
3 | 3 | no warnings qw[ deprecated recursion uninitialized ]; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | # Implements UAX#14: Line Breaking Properties |
8 | 8 | # David Nesting <david@fastolfe.net> |
2 | 2 | use strict; |
3 | 3 | no warnings qw[ recursion uninitialized ]; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | BEGIN { |
8 | 8 | use Encode qw(:all); |
2 | 2 | use strict; |
3 | 3 | no warnings qw[ deprecated recursion uninitialized ]; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | package PDF::API2; |
8 | 8 |
2 | 2 | use strict; |
3 | 3 | no warnings qw[ deprecated recursion uninitialized ]; |
4 | 4 | |
5 | our $VERSION = '2.039'; # VERSION | |
5 | our $VERSION = '0.001'; # VERSION | |
6 | 6 | |
7 | 7 | use Carp; |
8 | 8 | use Encode qw(:all); |
46 | 46 | $page = $pdf->page(); |
47 | 47 | |
48 | 48 | # Retrieve an existing page |
49 | $page = $pdf->openpage($page_number); | |
49 | $page = $pdf->open_page($page_number); | |
50 | 50 | |
51 | 51 | # Set the page size |
52 | 52 | $page->mediabox('Letter'); |
184 | 184 | $self->{'catalog'} = $self->{'pdf'}->{'Root'}; |
185 | 185 | weaken $self->{'catalog'}; |
186 | 186 | |
187 | $self->{'opened'} = 1; | |
187 | 188 | if (exists $options{'-compress'}) { |
188 | 189 | $self->{'forcecompress'} = $options{'-compress'} ? 1 : 0; |
189 | 190 | } |
993 | 994 | unless ($self->{'pdf'}->{' fname'}) { |
994 | 995 | $self->{'pdf'}->out_file($file); |
995 | 996 | } |
997 | elsif ($self->{'pdf'}->{' fname'} eq $file) { | |
998 | $self->update(); | |
999 | } | |
996 | 1000 | else { |
997 | 1001 | $self->{'pdf'}->clone_file($file); |
998 | 1002 | $self->{'pdf'}->close_file(); |
1050 | 1054 | $self->{'pdf'}->append_file(); |
1051 | 1055 | $str = ${$self->{'content_ref'}}; |
1052 | 1056 | } |
1057 | elsif ($self->{'opened'}) { | |
1058 | my $fh = FileHandle->new(); | |
1059 | CORE::open($fh, '>', \$str) || die "Can't begin scalar IO"; | |
1060 | $self->{'pdf'}->clone_file($fh); | |
1061 | $self->{'pdf'}->close_file(); | |
1062 | $fh->close(); | |
1063 | } | |
1053 | 1064 | else { |
1054 | 1065 | my $fh = FileHandle->new(); |
1055 | 1066 | CORE::open($fh, '>', \$str) || die "Can't begin scalar IO"; |
1152 | 1163 | return $page; |
1153 | 1164 | } |
1154 | 1165 | |
1155 | =item $page = $pdf->openpage($page_number) | |
1166 | =item $page = $pdf->open_page($page_number) | |
1156 | 1167 | |
1157 | 1168 | Returns the L<PDF::API2::Page> object of page $page_number. |
1158 | 1169 | |
1162 | 1173 | B<Example:> |
1163 | 1174 | |
1164 | 1175 | $pdf = PDF::API2->open('our/99page.pdf'); |
1165 | $page = $pdf->openpage(1); # returns the first page | |
1166 | $page = $pdf->openpage(99); # returns the last page | |
1167 | $page = $pdf->openpage(-1); # returns the last page | |
1168 | $page = $pdf->openpage(999); # returns undef | |
1169 | ||
1170 | =cut | |
1171 | ||
1172 | sub openpage { | |
1176 | $page = $pdf->open_page(1); # returns the first page | |
1177 | $page = $pdf->open_page(99); # returns the last page | |
1178 | $page = $pdf->open_page(-1); # returns the last page | |
1179 | $page = $pdf->open_page(999); # returns undef | |
1180 | ||
1181 | =cut | |
1182 | ||
1183 | # Deprecated (renamed) | |
1184 | sub openpage { return open_page(@_); } ## no critic | |
1185 | ||
1186 | sub open_page { | |
1173 | 1187 | my $self = shift(); |
1174 | 1188 | my $index = shift() || 0; |
1175 | 1189 | my ($page, $rotate, $media, $trans); |
1192 | 1206 | weaken $page->{' apipdf'}; |
1193 | 1207 | weaken $page->{' api'}; |
1194 | 1208 | $self->{'pdf'}->out_obj($page); |
1195 | if (($rotate = $page->find_prop('Rotate')) and (not defined($page->{' fixed'}) or $page->{' fixed'} < 1)) { | |
1209 | if (($rotate = $page->find_prop('Rotate')) and not $page->{' opened'}) { | |
1196 | 1210 | $rotate = ($rotate->val() + 360) % 360; |
1197 | 1211 | |
1198 | 1212 | if ($rotate != 0 and not $self->default('nounrotate')) { |
1227 | 1241 | $trans = ''; |
1228 | 1242 | } |
1229 | 1243 | |
1230 | if (defined $page->{'Contents'} and (not defined($page->{' fixed'}) or $page->{' fixed'} < 1)) { | |
1244 | if (defined $page->{'Contents'} and not $page->{' opened'}) { | |
1231 | 1245 | $page->fixcontents(); |
1232 | 1246 | my $uncontent = delete $page->{'Contents'}; |
1233 | 1247 | my $content = $page->gfx(); |
1244 | 1258 | $content->{' stream'} .= ' Q '; |
1245 | 1259 | } |
1246 | 1260 | |
1247 | ## $content->{'Length'} = PDFNum(length($content->{' stream'})); | |
1248 | # this will be fixed by the following code or content or filters | |
1249 | ||
1250 | ## if we like compress we will do it now to do quicker saves | |
1261 | # if we like compress we will do it now to do quicker saves | |
1251 | 1262 | if ($self->{'forcecompress'}) { |
1252 | # $content->compressFlate(); | |
1253 | 1263 | $content->{' stream'} = dofilter($content->{'Filter'}, $content->{' stream'}); |
1254 | 1264 | $content->{' nofilt'} = 1; |
1255 | 1265 | delete $content->{'-docompress'}; |
1256 | 1266 | $content->{'Length'} = PDFNum(length($content->{' stream'})); |
1257 | 1267 | } |
1258 | 1268 | } |
1259 | $page->{' fixed'} = 1; | |
1269 | $page->{' opened'} = 1; | |
1260 | 1270 | } |
1261 | 1271 | |
1262 | 1272 | $self->{'pdf'}->out_obj($page); |
1362 | 1372 | $s_page = $s_idx; |
1363 | 1373 | } |
1364 | 1374 | else { |
1365 | $s_page = $s_pdf->openpage($s_idx); | |
1375 | $s_page = $s_pdf->open_page($s_idx); | |
1366 | 1376 | } |
1367 | 1377 | |
1368 | 1378 | $self->{'apiimportcache'} ||= {}; |
1396 | 1406 | |
1397 | 1407 | # create a whole content stream |
1398 | 1408 | ## technically it is possible to submit an unfinished |
1399 | ## (eg. newly created) source-page, but thats nonsense, | |
1400 | ## so we expect a page fixed by openpage and die otherwise | |
1401 | die "page not processed via openpage ..." unless $s_page->{' fixed'} == 1; | |
1402 | ||
1403 | # since the source page comes from openpage it may already | |
1404 | # contain the required starting 'q' without the final 'Q' | |
1405 | # if forcecompress is in effect | |
1409 | ## (eg. newly created) source-page, but that's nonsense, | |
1410 | ## so we expect a page fixed by open_page and die otherwise | |
1411 | unless ($s_page->{' opened'}) { | |
1412 | croak join(' ', | |
1413 | "Pages may only be imported from a complete PDF.", | |
1414 | "Save and reopen the source PDF object first"); | |
1415 | } | |
1416 | ||
1406 | 1417 | if (defined $s_page->{'Contents'}) { |
1407 | 1418 | $s_page->fixcontents(); |
1408 | 1419 | |
1409 | 1420 | $xo->{' stream'} = ''; |
1410 | # openpage pages only contain one stream | |
1421 | # open_page pages only contain one stream | |
1411 | 1422 | my ($k) = $s_page->{'Contents'}->elements(); |
1412 | 1423 | $k->realise(); |
1413 | 1424 | if ($k->{' nofilt'}) { |
1414 | # we have a finished stream here | |
1415 | # so we unfilter | |
1425 | # we have a finished stream here so we unfilter | |
1416 | 1426 | $xo->add('q', unfilter($k->{'Filter'}, $k->{' stream'}), 'Q'); |
1417 | 1427 | } |
1418 | 1428 | else { |
1469 | 1479 | $s_page = $s_idx; |
1470 | 1480 | } |
1471 | 1481 | else { |
1472 | $s_page = $s_pdf->openpage($s_idx); | |
1482 | $s_page = $s_pdf->open_page($s_idx); | |
1473 | 1483 | } |
1474 | 1484 | |
1475 | 1485 | if (ref($t_idx) eq 'PDF::API2::Page') { |
85 | 85 | $string = $pdf->stringify(); |
86 | 86 | |
87 | 87 | $pdf = PDF::API2->open_scalar($string); |
88 | $page = $pdf->openpage(1); | |
88 | $page = $pdf->open_page(1); | |
89 | 89 | $annotation = $page->annotation(); |
90 | 90 | |
91 | 91 | $annotation->text('This is an annotation', -rect => [ 72, 144, 172, 244 ]); |
0 | use Test::More tests => 1; | |
0 | use Test::More tests => 4; | |
1 | 1 | |
2 | 2 | use strict; |
3 | 3 | use warnings; |
11 | 11 | my $image = PDF::API2::Resource::XObject::Image::JPEG->new_api($pdf, 't/resources/1x1.jpg'); |
12 | 12 | |
13 | 13 | ok($image, q{new_api still works}); |
14 | ||
15 | ||
16 | ## | |
17 | ## PDF::API2 | |
18 | ## | |
19 | ||
20 | $pdf = PDF::API2->new(); | |
21 | $pdf->page->gfx->fillcolor('blue'); | |
22 | my $pdf_string = $pdf->stringify(); | |
23 | ||
24 | # openScalar | |
25 | $pdf = PDF::API2->openScalar($pdf_string); | |
26 | is(ref($pdf), 'PDF::API2', | |
27 | q{openScalar still works}); | |
28 | ||
29 | # importpage | |
30 | my $pdf2 = PDF::API2->new(); | |
31 | my $page = $pdf2->importpage($pdf, 1); | |
32 | is(ref($page), 'PDF::API2::Page', | |
33 | q{importpage still works}); | |
34 | ||
35 | # openpage | |
36 | $pdf2 = PDF::API2->open_scalar($pdf_string); | |
37 | $page = $pdf->openpage(1); | |
38 | is(ref($page), 'PDF::API2::Page', | |
39 | q{openpage still works}); |
0 | use Test::More tests => 12; | |
0 | use Test::More tests => 16; | |
1 | 1 | |
2 | 2 | use warnings; |
3 | 3 | use strict; |
4 | 4 | |
5 | use File::Temp qw(tempfile); | |
5 | 6 | use PDF::API2; |
6 | 7 | |
7 | 8 | my $pdf = PDF::API2->new(); |
13 | 14 | my $gfx = $pdf->page->gfx(); |
14 | 15 | $gfx->fillcolor('blue'); |
15 | 16 | |
16 | my $new = PDF::API2->open_scalar($pdf->stringify(), ); | |
17 | my $new = PDF::API2->open_scalar($pdf->stringify()); | |
17 | 18 | %info = $new->info(); |
18 | 19 | is($info{'Producer'}, 'PDF::API2 Test Suite', 'Check info string after save and reload'); |
19 | 20 | |
89 | 90 | like($pdf->stringify(), qr{/PageLabels << /Nums \[ 0 << /P \(Test\) /S /D >> \] >>}, |
90 | 91 | q{Page Numbering: Decimal Characters (implicit), with prefix}); |
91 | 92 | |
93 | ||
94 | ## | |
95 | ## stringify | |
96 | ## | |
97 | ||
98 | $pdf = PDF::API2->new(-compress => 0); | |
99 | $gfx = $pdf->page->gfx(); | |
100 | $gfx->fillcolor('blue'); | |
101 | ||
102 | $string = $pdf->stringify(); | |
103 | like($string, qr/0 0 1 rg/, | |
104 | q{Stringify of newly-created PDF contains expected content}); | |
105 | ||
106 | my ($fh, $filename) = tempfile(); | |
107 | print $fh $string; | |
108 | close $fh; | |
109 | ||
110 | $pdf = PDF::API2->open($filename); | |
111 | $string = $pdf->stringify(); | |
112 | like($string, qr/0 0 1 rg/, | |
113 | q{Stringify of newly-opened PDF contains expected content}); | |
114 | ||
115 | ## | |
116 | ## saveas with same filename | |
117 | ## | |
118 | ||
119 | $pdf = PDF::API2->new(-compress => 0); | |
120 | $gfx = $pdf->page->gfx(); | |
121 | $gfx->fillcolor('blue'); | |
122 | ||
123 | ($fh, $filename) = tempfile(); | |
124 | print $fh $pdf->stringify(); | |
125 | close $fh; | |
126 | ||
127 | $pdf = PDF::API2->open($filename, -compress => 0); | |
128 | $gfx = $pdf->page->gfx(); | |
129 | $gfx->fillcolor('red'); | |
130 | $pdf->saveas($filename); | |
131 | ||
132 | $pdf = PDF::API2->open($filename, -compress => 0); | |
133 | $string = $pdf->stringify(); | |
134 | like($string, qr/0 0 1 rg/, | |
135 | q{saveas($opened_filename) contains original content}); | |
136 | like($string, qr/1 0 0 rg/, | |
137 | q{saveas($opened_filename) contains new content}); |
0 | use Test::More tests => 41; | |
0 | use Test::More tests => 42; | |
1 | 1 | |
2 | 2 | use strict; |
3 | 3 | use warnings; |
208 | 208 | is($string->as_pdf(), |
209 | 209 | '<0000005C00000000>', |
210 | 210 | q{[RT #63918] Incorrect handling of literal backslashes 2/2}); |
211 | ||
212 | ||
213 | # RT 134957 | |
214 | $string = PDFStr("\x00\n\x00"); | |
215 | is($string->as_pdf(), | |
216 | '<000A00>', | |
217 | q{\n in a string containing non-printable characters is hex-encoded}); |