API2/Basic/PDF/Page.pm

filter: Statementstmt 54.8% 17 / 31 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 100% 2 / 2 totaltotal 54.5% 24 / 44 SCAR 14.4
CC
3
Cov
49%
new
6.0
ship_out
6.0
BEGIN
1.0
CRAP 4.2
« API2/Basic/PDF/Filter/ASCIIHexDecode.pm ↑ Summary API2/Resource/XObject/Form/BarCode/int2of5.pm »
1 # Code in the PDF::API2::Basic::PDF namespace was originally copied from the
2 # Text::PDF distribution.
3 #
4 # Copyright Martin Hosken <Martin_Hosken@sil.org>
5 #
6 # Martin Hosken's code may be used under the terms of the MIT license.
7 # Subsequent versions of the code have the same license as PDF::API2.
8  
9 package PDF::API2::Basic::PDF::Page;
10  
11 39 ▶use base 'PDF::API2::Basic::PDF::Pages';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 39 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 39 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 39 our $VERSION = '2.044'; # VERSION
17  
18 39 ▶use PDF::API2::Basic::PDF::Dict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 39 ▶use PDF::API2::Basic::PDF::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 =head1 NAME
22  
23 PDF::API2::Basic::PDF::Page - Low-level PDF page object
24  
25 =head1 DESCRIPTION
26  
27 Represents a page of output in PDF. It also keeps track of the content stream,
28 any resources (such as fonts) being switched, etc.
29  
30 Page inherits from Pages due to a number of shared methods. They are really
31 structurally quite different.
32  
33 =head1 INSTANCE VARIABLES
34  
35 A page has various working variables:
36  
37 =over
38  
39 =item curstrm
40  
41 The currently open stream
42  
43 =back
44  
45 =head1 METHODS
46  
47 =head2 PDF::API2::Basic::PDF::Page->new($pdf, $parent, $index)
48  
49 Creates a new page based on a pages object (perhaps the root object).
50  
51 The page is also added to the parent at this point, so pages are ordered in
52 a PDF document in the order in which they are created rather than in the order
53 they are closed.
54  
55 Only the essential elements in the page dictionary are created here, all others
56 are either optional or can be inherited.
57  
58 The optional index value indicates the index in the parent list that this page
59 should be inserted (so that new pages need not be appended)
60  
61 =cut
62  
63 sub new {
64 0 ▶ my ($class, $pdf, $parent, $index) = @_;
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
65 0 my $self = {};
66  
67 0 ▶ $class = ref($class) if ref($class);
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
68 0 $self = $class->SUPER::new($pdf, $parent);
69 0 $self->{'Type'} = PDFName('Page');
70 0 delete $self->{'Count'};
71 0 delete $self->{'Kids'};
72 0 $parent->add_page($self, $index);
73  
74 0 return $self;
75 }
76  
77 =head2 $p->ship_out($pdf)
78  
79 Ships the page out to the given output file context
80  
81 =cut
82  
83 sub ship_out {
84 0 ▶ my ($self, $pdf) = @_;
Subroutine ship_out: not called CC=2 SCAR=17.9
Pod documented
85  
86 0 $pdf->ship_out($self);
87 0 ▶ if (defined $self->{'Contents'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"Contents"}) 0 0 0
88 0 $pdf->ship_out($self->{'Contents'}->elements());
89 }
90  
91 0 return $self;
92 }
93  
94 39 1;
« API2/Basic/PDF/Filter/ASCIIHexDecode.pm ↑ Summary API2/Resource/XObject/Form/BarCode/int2of5.pm »