| 1 | #======================================================================= | ||
| 2 | # ____ ____ _____ _ ____ ___ ____ | ||
| 3 | # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \ | ||
| 4 | # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) | | ||
| 5 | # | __/| |_| | _| _ _ / ___ \| __/| | / __/ | ||
| 6 | # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____| | ||
| 7 | # | ||
| 8 | # A Perl Module Chain to faciliate the Creation and Modification | ||
| 9 | # of High-Quality "Portable Document Format (PDF)" Files. | ||
| 10 | # | ||
| 11 | #======================================================================= | ||
| 12 | # | ||
| 13 | # THIS IS A REUSED PERL MODULE, FOR PROPER LICENCING TERMS SEE BELOW: | ||
| 14 | # | ||
| 15 | # | ||
| 16 | # Copyright Martin Hosken <Martin_Hosken@sil.org> | ||
| 17 | # | ||
| 18 | # No warranty or expression of effectiveness, least of all regarding | ||
| 19 | # anyone's safety, is implied in this software or documentation. | ||
| 20 | # | ||
| 21 | # This specific module is licensed under the Perl Artistic License. | ||
| 22 | # | ||
| 23 | # | ||
| 24 | # $Id: Utils.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $ | ||
| 25 | # | ||
| 26 | #======================================================================= | ||
| 27 | package PDF::API3::Compat::API2::Basic::PDF::Utils; | ||
| 28 | |||
| 29 | =head1 NAME | ||
| 30 | |||
| 31 | PDF::API3::Compat::API2::Basic::PDF::Utils - Utility functions for PDF library | ||
| 32 | |||
| 33 | =head1 DESCRIPTION | ||
| 34 | |||
| 35 | A set of utility functions to save the fingers of the PDF library users! | ||
| 36 | |||
| 37 | =head1 FUNCTIONS | ||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | |||
| 43 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Array; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 44 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Bool; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Dict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 46 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Name; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 47 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Null; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 48 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Number; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 49 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::String; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 50 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Literal; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 51 | |||
| 52 | 1 | ▶ | use Exporter; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 53 | 1 | ▶ | use vars qw(@EXPORT @ISA); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 54 | 1 | @ISA = qw(Exporter); | |
| 55 | 1 | @EXPORT = qw(PDFBool PDFArray PDFDict PDFLiteral PDFName PDFNull PDFNum PDFStr PDFStrHex PDFUtf | |
| 56 | asPDFBool asPDFName asPDFNum asPDFStr); | ||
| 57 | 1 | ▶ | no warnings qw[ deprecated recursion uninitialized ]; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 58 | |||
| 59 | |||
| 60 | =head2 PDFBool | ||
| 61 | |||
| 62 | Creates a Bool via PDF::API3::Compat::API2::Basic::PDF::Bool->new | ||
| 63 | |||
| 64 | =cut | ||
| 65 | |||
| 66 | sub PDFBool | ||
| 67 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::Bool->new(@_); } |
|
Subroutine
PDFBool: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 68 | |||
| 69 | |||
| 70 | =head2 PDFArray | ||
| 71 | |||
| 72 | Creates an array via PDF::API3::Compat::API2::Basic::PDF::Array->new | ||
| 73 | |||
| 74 | =cut | ||
| 75 | |||
| 76 | sub PDFArray | ||
| 77 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::Array->new(@_); } |
|
Subroutine
PDFArray: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 78 | |||
| 79 | |||
| 80 | =head2 PDFDict | ||
| 81 | |||
| 82 | Creates a dict via PDF::API3::Compat::API2::Basic::PDF::Dict->new | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | sub PDFDict | ||
| 87 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::Dict->new(@_); } |
|
Subroutine
PDFDict: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 88 | |||
| 89 | |||
| 90 | =head2 PDFName | ||
| 91 | |||
| 92 | Creates a name via PDF::API3::Compat::API2::Basic::PDF::Name->new | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | sub PDFName | ||
| 97 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::Name->new(@_); } |
|
Subroutine
PDFName: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 98 | |||
| 99 | |||
| 100 | =head2 PDFNull | ||
| 101 | |||
| 102 | Creates a null via PDF::API3::Compat::API2::Basic::PDF::Null->new | ||
| 103 | |||
| 104 | =cut | ||
| 105 | |||
| 106 | sub PDFNull | ||
| 107 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::Null->new(@_); } |
|
Subroutine
PDFNull: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 108 | |||
| 109 | |||
| 110 | =head2 PDFNum | ||
| 111 | |||
| 112 | Creates a number via PDF::API3::Compat::API2::Basic::PDF::Number->new | ||
| 113 | |||
| 114 | =cut | ||
| 115 | |||
| 116 | sub PDFNum | ||
| 117 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::Number->new(@_); } |
|
Subroutine
PDFNum: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 118 | |||
| 119 | |||
| 120 | =head2 PDFStr | ||
| 121 | |||
| 122 | Creates a string via PDF::API3::Compat::API2::Basic::PDF::String->new | ||
| 123 | |||
| 124 | =cut | ||
| 125 | |||
| 126 | sub PDFStr | ||
| 127 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::String->new(@_); } |
|
Subroutine
PDFStr: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 128 | |||
| 129 | =head2 PDFStrHex | ||
| 130 | |||
| 131 | Creates a hex-string via PDF::API3::Compat::API2::Basic::PDF::String->new | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | sub PDFStrHex | ||
| 136 | 0 | ▶ | { my $x=PDF::API3::Compat::API2::Basic::PDF::String->new(@_); $x->{' ishex'}=1; return($x); } |
|
Subroutine
PDFStrHex: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 137 | |||
| 138 | =head2 PDFUtf | ||
| 139 | |||
| 140 | Creates a utf8-string via PDF::API3::Compat::API2::Basic::PDF::String->new | ||
| 141 | |||
| 142 | =cut | ||
| 143 | |||
| 144 | sub PDFUtf | ||
| 145 | 0 | ▶ | { my $x=PDF::API3::Compat::API2::Basic::PDF::String->new(@_); $x->{' isutf'}=1; return($x); } |
|
Subroutine
PDFUtf: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 146 | |||
| 147 | =head2 PDFLiteral | ||
| 148 | |||
| 149 | Creates a pdf-literal via PDF::API3::Compat::API2::Basic::PDF::Literal->new | ||
| 150 | |||
| 151 | =cut | ||
| 152 | |||
| 153 | sub PDFLiteral | ||
| 154 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::Literal->new(@_); } |
|
Subroutine
PDFLiteral: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 155 | |||
| 156 | =head2 asPDFBool | ||
| 157 | |||
| 158 | Returns a literal value in PDF output form | ||
| 159 | |||
| 160 | =cut | ||
| 161 | |||
| 162 | sub asPDFBool | ||
| 163 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::Bool->new(@_)->as_pdf; } |
|
Subroutine
asPDFBool: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 164 | |||
| 165 | |||
| 166 | =head2 asPDFStr | ||
| 167 | |||
| 168 | Returns a string in PDF output form (including () or <>) | ||
| 169 | |||
| 170 | =cut | ||
| 171 | |||
| 172 | sub asPDFStr | ||
| 173 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::String->new(@_)->as_pdf; } |
|
Subroutine
asPDFStr: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 174 | |||
| 175 | |||
| 176 | =head2 asPDFName | ||
| 177 | |||
| 178 | Returns a Name in PDF Output form (including /) | ||
| 179 | |||
| 180 | =cut | ||
| 181 | |||
| 182 | sub asPDFName | ||
| 183 | 0 | ▶ | { PDF::API3::Compat::API2::Basic::PDF::Name->new(@_)->as_pdf (@_); } |
|
Subroutine
asPDFName: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 184 | |||
| 185 | |||
| 186 | =head2 asPDFNum | ||
| 187 | |||
| 188 | Returns a number in PDF output form | ||
| 189 | |||
| 190 | =cut | ||
| 191 | |||
| 192 | sub asPDFNum | ||
| 193 | 0 | ▶ | { $_[0]; } # no translation needed |
|
Subroutine
asPDFNum: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 194 | |||
| 195 | |||
| 196 | =head2 unpacku($str) | ||
| 197 | |||
| 198 | Returns a list of unicode values for the given UTF8 string | ||
| 199 | |||
| 200 | =cut | ||
| 201 | |||
| 202 | sub unpacku | ||
| 203 | 0 | ▶ | { |
|
Subroutine
unpacku: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 204 | 0 | my ($str) = @_; | |
| 205 | 0 | my (@res); | |
| 206 | |||
| 207 | 0 | return (unpack("U*", $str)); | |
| 208 | } | ||
| 209 | |||
| 210 | |||
| 211 | 1 | 1; | |
| 212 | |||