1PDF::API2(3)          User Contributed Perl Documentation         PDF::API2(3)
2
3
4

NAME

6       PDF::API2 - Facilitates the creation and modification of PDF files
7

SYNOPSIS

9           use PDF::API2;
10
11           # Create a blank PDF file
12           $pdf = PDF::API2->new();
13
14           # Open an existing PDF file
15           $pdf = PDF::API2->open('some.pdf');
16
17           # Add a blank page
18           $page = $pdf->page();
19
20           # Retrieve an existing page
21           $page = $pdf->openpage($page_number);
22
23           # Set the page size
24           $page->mediabox('Letter');
25
26           # Add a built-in font to the PDF
27           $font = $pdf->corefont('Helvetica-Bold');
28
29           # Add an external TTF font to the PDF
30           $font = $pdf->ttfont('/path/to/font.ttf');
31
32           # Add some text to the page
33           $text = $page->text();
34           $text->font($font, 20);
35           $text->translate(200, 700);
36           $text->text('Hello World!');
37
38           # Save the PDF
39           $pdf->saveas('/path/to/new.pdf');
40

GENERIC METHODS

42       $pdf = PDF::API2->new(%options)
43           Creates a new PDF object.  If you will be saving it as a file and
44           already know the filename, you can give the '-file' option to
45           minimize possible memory requirements later on.
46
47           Example:
48
49               $pdf = PDF::API2->new();
50               ...
51               print $pdf->stringify();
52
53               $pdf = PDF::API2->new();
54               ...
55               $pdf->saveas('our/new.pdf');
56
57               $pdf = PDF::API2->new(-file => 'our/new.pdf');
58               ...
59               $pdf->save();
60
61           To turn off automatic compression of PDF contents, include option
62           "-compress" with a false value.  This is generally only useful for
63           debugging.
64
65       $pdf = PDF::API2->open($pdf_file, %options)
66           Opens an existing PDF file.
67
68           Example:
69
70               $pdf = PDF::API2->open('our/old.pdf');
71               ...
72               $pdf->saveas('our/new.pdf');
73
74               $pdf = PDF::API2->open('our/to/be/updated.pdf');
75               ...
76               $pdf->update();
77
78           To turn off automatic compression of PDF contents, include option
79           "-compress" with a false value.  This is generally only useful for
80           debugging.
81
82       $pdf = PDF::API2->open_scalar($pdf_string, %options)
83           Opens a PDF contained in a string.
84
85           Example:
86
87               # Read a PDF into a string, for the purpose of demonstration
88               open $fh, 'our/old.pdf' or die $@;
89               undef $/;  # Read the whole file at once
90               $pdf_string = <$fh>;
91
92               $pdf = PDF::API2->open_scalar($pdf_string);
93               ...
94               $pdf->saveas('our/new.pdf');
95
96           To turn off automatic compression of PDF contents, include option
97           "-compress" with a false value.  This is generally only useful for
98           debugging.
99
100       $pdf->preferences(%options)
101           Controls viewing preferences for the PDF.
102
103           Page Mode Options:
104
105           -fullscreen
106               Full-screen mode, with no menu bar, window controls, or any
107               other window visible.
108
109           -thumbs
110               Thumbnail images visible.
111
112           -outlines
113               Document outline visible.
114
115           Page Layout Options:
116
117           -singlepage
118               Display one page at a time.
119
120           -onecolumn
121               Display the pages in one column.
122
123           -twocolumnleft
124               Display the pages in two columns, with oddnumbered pages on the
125               left.
126
127           -twocolumnright
128               Display the pages in two columns, with oddnumbered pages on the
129               right.
130
131           Viewer Options:
132
133           -hidetoolbar
134               Specifying whether to hide tool bars.
135
136           -hidemenubar
137               Specifying whether to hide menu bars.
138
139           -hidewindowui
140               Specifying whether to hide user interface elements.
141
142           -fitwindow
143               Specifying whether to resize the document's window to the size
144               of the displayed page.
145
146           -centerwindow
147               Specifying whether to position the document's window in the
148               center of the screen.
149
150           -displaytitle
151               Specifying whether the window's title bar should display the
152               document title taken from the Title entry of the document
153               information dictionary.
154
155           -afterfullscreenthumbs
156               Thumbnail images visible after Full-screen mode.
157
158           -afterfullscreenoutlines
159               Document outline visible after Full-screen mode.
160
161           -printscalingnone
162               Set the default print setting for page scaling to none.
163
164           -simplex
165               Print single-sided by default.
166
167           -duplexflipshortedge
168               Print duplex by default and flip on the short edge of the
169               sheet.
170
171           -duplexfliplongedge
172               Print duplex by default and flip on the long edge of the sheet.
173
174           Initial Page Options:
175
176           -firstpage => [ $page, %options ]
177               Specifying the page (either a page number or a page object) to
178               be displayed, plus one of the following options:
179
180               -fit => 1
181                   Display the page designated by page, with its contents
182                   magnified just enough to fit the entire page within the
183                   window both horizontally and vertically. If the required
184                   horizontal and vertical magnification factors are
185                   different, use the smaller of the two, centering the page
186                   within the window in the other dimension.
187
188               -fith => $top
189                   Display the page designated by page, with the vertical
190                   coordinate top positioned at the top edge of the window and
191                   the contents of the page magnified just enough to fit the
192                   entire width of the page within the window.
193
194               -fitv => $left
195                   Display the page designated by page, with the horizontal
196                   coordinate left positioned at the left edge of the window
197                   and the contents of the page magnified just enough to fit
198                   the entire height of the page within the window.
199
200               -fitr => [ $left, $bottom, $right, $top ]
201                   Display the page designated by page, with its contents
202                   magnified just enough to fit the rectangle specified by the
203                   coordinates left, bottom, right, and top entirely within
204                   the window both horizontally and vertically. If the
205                   required horizontal and vertical magnification factors are
206                   different, use the smaller of the two, centering the
207                   rectangle within the window in the other dimension.
208
209               -fitb => 1
210                   Display the page designated by page, with its contents
211                   magnified just enough to fit its bounding box entirely
212                   within the window both horizontally and vertically. If the
213                   required horizontal and vertical magnification factors are
214                   different, use the smaller of the two, centering the
215                   bounding box within the window in the other dimension.
216
217               -fitbh => $top
218                   Display the page designated by page, with the vertical
219                   coordinate top positioned at the top edge of the window and
220                   the contents of the page magnified just enough to fit the
221                   entire width of its bounding box within the window.
222
223               -fitbv => $left
224                   Display the page designated by page, with the horizontal
225                   coordinate left positioned at the left edge of the window
226                   and the contents of the page magnified just enough to fit
227                   the entire height of its bounding box within the window.
228
229               -xyz => [ $left, $top, $zoom ]
230                   Display the page designated by page, with the coordinates
231                   (left, top) positioned at the top-left corner of the window
232                   and the contents of the page magnified by the factor zoom.
233                   A zero (0) value for any of the parameters left, top, or
234                   zoom specifies that the current value of that parameter is
235                   to be retained unchanged.
236
237           Example:
238
239               $pdf->preferences(
240                   -fullscreen => 1,
241                   -onecolumn => 1,
242                   -afterfullscreenoutlines => 1,
243                   -firstpage => [$page, -fit => 1],
244               );
245
246       $val = $pdf->default($parameter)
247       $pdf->default($parameter, $value)
248           Gets/sets the default value for a behaviour of PDF::API2.
249
250           Supported Parameters:
251
252           nounrotate
253               prohibits API2 from rotating imported/opened page to re-create
254               a default pdf-context.
255
256           pageencaps
257               enables than API2 will add save/restore commands upon
258               imported/opened pages to preserve graphics-state for
259               modification.
260
261           copyannots
262               enables importing of annotations (*EXPERIMENTAL*).
263
264       $version = $pdf->version([$new_version])
265           Get/set the PDF version (e.g. 1.4)
266
267       $bool = $pdf->isEncrypted()
268           Checks if the previously opened PDF is encrypted.
269
270       %infohash = $pdf->info(%infohash)
271           Gets/sets the info structure of the document.
272
273           Example:
274
275               %h = $pdf->info(
276                   'Author'       => "Alfred Reibenschuh",
277                   'CreationDate' => "D:20020911000000+01'00'",
278                   'ModDate'      => "D:YYYYMMDDhhmmssOHH'mm'",
279                   'Creator'      => "fredos-script.pl",
280                   'Producer'     => "PDF::API2",
281                   'Title'        => "some Publication",
282                   'Subject'      => "perl ?",
283                   'Keywords'     => "all good things are pdf"
284               );
285               print "Author: $h{Author}\n";
286
287       @metadata_attributes = $pdf->infoMetaAttributes(@metadata_attributes)
288           Gets/sets the supported info-structure tags.
289
290           Example:
291
292               @attributes = $pdf->infoMetaAttributes;
293               print "Supported Attributes: @attr\n";
294
295               @attributes = $pdf->infoMetaAttributes('CustomField1');
296               print "Supported Attributes: @attributes\n";
297
298       $xml = $pdf->xmpMetadata($xml)
299           Gets/sets the XMP XML data stream.
300
301           Example:
302
303               $xml = $pdf->xmpMetadata();
304               print "PDFs Metadata reads: $xml\n";
305               $xml=<<EOT;
306               <?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
307               <?adobe-xap-filters esc="CRLF"?>
308               <x:xmpmeta
309                 xmlns:x='adobe:ns:meta/'
310                 x:xmptk='XMP toolkit 2.9.1-14, framework 1.6'>
311                   <rdf:RDF
312                     xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
313                     xmlns:iX='http://ns.adobe.com/iX/1.0/'>
314                       <rdf:Description
315                         rdf:about='uuid:b8659d3a-369e-11d9-b951-000393c97fd8'
316                         xmlns:pdf='http://ns.adobe.com/pdf/1.3/'
317                         pdf:Producer='Acrobat Distiller 6.0.1 for Macintosh'></rdf:Description>
318                       <rdf:Description
319                         rdf:about='uuid:b8659d3a-369e-11d9-b951-000393c97fd8'
320                         xmlns:xap='http://ns.adobe.com/xap/1.0/'
321                         xap:CreateDate='2004-11-14T08:41:16Z'
322                         xap:ModifyDate='2004-11-14T16:38:50-08:00'
323                         xap:CreatorTool='FrameMaker 7.0'
324                         xap:MetadataDate='2004-11-14T16:38:50-08:00'></rdf:Description>
325                       <rdf:Description
326                         rdf:about='uuid:b8659d3a-369e-11d9-b951-000393c97fd8'
327                         xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/'
328                         xapMM:DocumentID='uuid:919b9378-369c-11d9-a2b5-000393c97fd8'/></rdf:Description>
329                       <rdf:Description
330                         rdf:about='uuid:b8659d3a-369e-11d9-b951-000393c97fd8'
331                         xmlns:dc='http://purl.org/dc/elements/1.1/'
332                         dc:format='application/pdf'>
333                           <dc:description>
334                             <rdf:Alt>
335                               <rdf:li xml:lang='x-default'>Adobe Portable Document Format (PDF)</rdf:li>
336                             </rdf:Alt>
337                           </dc:description>
338                           <dc:creator>
339                             <rdf:Seq>
340                               <rdf:li>Adobe Systems Incorporated</rdf:li>
341                             </rdf:Seq>
342                           </dc:creator>
343                           <dc:title>
344                             <rdf:Alt>
345                               <rdf:li xml:lang='x-default'>PDF Reference, version 1.6</rdf:li>
346                             </rdf:Alt>
347                           </dc:title>
348                       </rdf:Description>
349                   </rdf:RDF>
350               </x:xmpmeta>
351               <?xpacket end='w'?>
352               EOT
353
354               $xml = $pdf->xmpMetadata($xml);
355               print "PDF metadata now reads: $xml\n";
356
357       $pdf->pageLabel($index, $options)
358           Sets page label options.
359
360           Supported Options:
361
362           -style
363               Roman, roman, decimal, Alpha or alpha.
364
365           -start
366               Restart numbering at given number.
367
368           -prefix
369               Text prefix for numbering.
370
371           Example:
372
373               # Start with Roman Numerals
374               $pdf->pageLabel(0, {
375                   -style => 'roman',
376               });
377
378               # Switch to Arabic
379               $pdf->pageLabel(4, {
380                   -style => 'decimal',
381               });
382
383               # Numbering for Appendix A
384               $pdf->pageLabel(32, {
385                   -start => 1,
386                   -prefix => 'A-'
387               });
388
389               # Numbering for Appendix B
390               $pdf->pageLabel( 36, {
391                   -start => 1,
392                   -prefix => 'B-'
393               });
394
395               # Numbering for the Index
396               $pdf->pageLabel(40, {
397                   -style => 'Roman'
398                   -start => 1,
399                   -prefix => 'Index '
400               });
401
402       $pdf->finishobjects(@objects)
403           Force objects to be written to file if possible.
404
405           Example:
406
407               $pdf = PDF::API2->new(-file => 'our/new.pdf');
408               ...
409               $pdf->finishobjects($page, $gfx, $txt);
410               ...
411               $pdf->save();
412
413       $pdf->update()
414           Saves a previously opened document.
415
416           Example:
417
418               $pdf = PDF::API2->open('our/to/be/updated.pdf');
419               ...
420               $pdf->update();
421
422       $pdf->saveas($file)
423           Save the document to $file and remove the object structure from
424           memory.
425
426           Example:
427
428               $pdf = PDF::API2->new();
429               ...
430               $pdf->saveas('our/new.pdf');
431
432       $string = $pdf->stringify()
433           Return the document as a string and remove the object structure
434           from memory.
435
436           Example:
437
438               $pdf = PDF::API2->new();
439               ...
440               print $pdf->stringify();
441
442       $pdf->end()
443           Remove the object structure from memory.  PDF::API2 contains
444           circular references, so this call is necessary in long-running
445           processes to keep from running out of memory.
446
447           This will be called automatically when you save or stringify a PDF.
448           You should only need to call it explicitly if you are reading PDF
449           files and not writing them.
450

PAGE METHODS

452       $page = $pdf->page()
453       $page = $pdf->page($page_number)
454           Returns a new page object.  By default, the page is added to the
455           end of the document.  If you include an existing page number, the
456           new page will be inserted in that position, pushing existing pages
457           back.
458
459           If $page_number is -1, the new page is inserted as the second-last
460           page; if $page_number is 0, the new page is inserted as the last
461           page.
462
463           Example:
464
465               $pdf = PDF::API2->new();
466
467               # Add a page.  This becomes page 1.
468               $page = $pdf->page();
469
470               # Add a new first page.  $page becomes page 2.
471               $another_page = $pdf->page(1);
472
473       $page = $pdf->openpage($page_number)
474           Returns the PDF::API2::Page object of page $page_number.
475
476           If $page_number is 0 or -1, it will return the last page in the
477           document.
478
479           Example:
480
481               $pdf = PDF::API2->open('our/99page.pdf');
482               $page = $pdf->openpage(1);   # returns the first page
483               $page = $pdf->openpage(99);  # returns the last page
484               $page = $pdf->openpage(-1);  # returns the last page
485               $page = $pdf->openpage(999); # returns undef
486
487       $xoform = $pdf->importPageIntoForm($source_pdf, $source_page_number)
488           Returns a Form XObject created by extracting the specified page
489           from $source_pdf.
490
491           This is useful if you want to transpose the imported page somewhat
492           differently onto a page (e.g. two-up, four-up, etc.).
493
494           If $source_page_number is 0 or -1, it will return the last page in
495           the document.
496
497           Example:
498
499               $pdf = PDF::API2->new();
500               $old = PDF::API2->open('our/old.pdf');
501               $page = $pdf->page();
502               $gfx = $page->gfx();
503
504               # Import Page 2 from the old PDF
505               $xo = $pdf->importPageIntoForm($old, 2);
506
507               # Add it to the new PDF's first page at 1/2 scale
508               $gfx->formimage($xo, 0, 0, 0.5);
509
510               $pdf->saveas('our/new.pdf');
511
512           Note: You can only import a page from an existing PDF file.
513
514       $page = $pdf->import_page($source_pdf, $source_page_number,
515       $target_page_number)
516           Imports a page from $source_pdf and adds it to the specified
517           position in $pdf.
518
519           If $source_page_number or $target_page_number is 0 or -1, the last
520           page in the document is used.
521
522           Note: If you pass a page object instead of a page number for
523           $target_page_number, the contents of the page will be merged into
524           the existing page.
525
526           Example:
527
528               $pdf = PDF::API2->new();
529               $old = PDF::API2->open('our/old.pdf');
530
531               # Add page 2 from the old PDF as page 1 of the new PDF
532               $page = $pdf->import_page($old, 2);
533
534               $pdf->saveas('our/new.pdf');
535
536           Note: You can only import a page from an existing PDF file.
537
538       $count = $pdf->pages()
539           Returns the number of pages in the document.
540
541       ($llx, $lly, $urx, $ury) = $pdf->mediabox()
542       $pdf->mediabox($name)
543       $pdf->mediabox($w, $h)
544       $pdf->mediabox($llx, $lly, $urx, $ury)
545           Get or set the global mediabox.
546
547           Example:
548
549               $pdf = PDF::API2->new();
550               $pdf->mediabox('A4');
551               ...
552               $pdf->saveas('our/new.pdf');
553
554               $pdf = PDF::API2->new();
555               $pdf->mediabox(595, 842);
556               ...
557               $pdf->saveas('our/new.pdf');
558
559               $pdf = PDF::API2->new;
560               $pdf->mediabox(0, 0, 595, 842);
561               ...
562               $pdf->saveas('our/new.pdf');
563
564       ($llx, $lly, $urx, $ury) = $pdf->cropbox()
565       $pdf->cropbox($name)
566       $pdf->cropbox($w, $h)
567       $pdf->cropbox($llx, $lly, $urx, $ury)
568           Get or set the global cropbox.
569
570           The cropbox defaults to the mediabox.
571
572       ($llx, $lly, $urx, $ury) = $pdf->bleedbox()
573       $pdf->bleedbox($name)
574       $pdf->bleedbox($w, $h)
575       $pdf->bleedbox($llx, $lly, $urx, $ury)
576           Get or set the global bleedbox.
577
578           The bleedbox defaults to the cropbox.
579
580       ($llx, $lly, $urx, $ury) = $pdf->trimbox()
581       $pdf->trimbox($name)
582       $pdf->trimbox($w, $h)
583       $pdf->trimbox($llx, $lly, $urx, $ury)
584           Get or set the global trimbox.
585
586           The trimbox defaults to the cropbox.
587
588       ($llx, $lly, $urx, $ury) = $pdf->artbox()
589       $pdf->artbox($name)
590       $pdf->artbox($w, $h)
591       $pdf->artbox($llx, $lly, $urx, $ury)
592           Get or sets the global artbox.
593
594           The artbox defaults to the cropbox.
595

FONT METHODS

597       @directories = PDF::API2::addFontDirs($dir1, $dir2, ...)
598           Adds one or more directories to the search path for finding font
599           files.
600
601           Returns the list of searched directories.
602
603       $font = $pdf->corefont($fontname, [%options])
604           Returns a new Adobe core font object.
605
606           Examples:
607
608               $font = $pdf->corefont('Times-Roman');
609               $font = $pdf->corefont('Times-Bold');
610               $font = $pdf->corefont('Helvetica');
611               $font = $pdf->corefont('ZapfDingbats');
612
613           Valid %options are:
614
615           -encode
616               Changes the encoding of the font from its default.
617
618           -dokern
619               Enables kerning if data is available.
620
621           See Also: PDF::API2::Resource::Font::CoreFont.
622
623       $font = $pdf->psfont($ps_file, [%options])
624           Returns a new Adobe Type1 font object.
625
626           Examples:
627
628               $font = $pdf->psfont('Times-Book.pfa', -afmfile => 'Times-Book.afm');
629               $font = $pdf->psfont('/fonts/Synest-FB.pfb', -pfmfile => '/fonts/Synest-FB.pfm');
630
631           Valid %options are:
632
633           -encode
634               Changes the encoding of the font from its default.
635
636           -afmfile
637               Specifies the location of the font metrics file.
638
639           -pfmfile
640               Specifies the location of the printer font metrics file.  This
641               option overrides the -encode option.
642
643           -dokern
644               Enables kerning if data is available.
645
646       $font = $pdf->ttfont($ttf_file, [%options])
647           Returns a new TrueType or OpenType font object.
648
649           Examples:
650
651               $font = $pdf->ttfont('Times.ttf');
652               $font = $pdf->ttfont('Georgia.otf');
653
654           Valid %options are:
655
656           -encode
657               Changes the encoding of the font from its default.
658
659           -isocmap
660               Use the ISO Unicode Map instead of the default MS Unicode Map.
661
662           -dokern
663               Enables kerning if data is available.
664
665           -noembed
666               Disables embedding of the font file.
667
668       $font = $pdf->cjkfont($cjkname, [%options])
669           Returns a new CJK font object.
670
671           Examples:
672
673               $font = $pdf->cjkfont('korean');
674               $font = $pdf->cjkfont('traditional');
675
676           Valid %options are:
677
678           -encode
679               Changes the encoding of the font from its default.
680
681           See Also: PDF::API2::Resource::CIDFont::CJKFont
682
683       $font = $pdf->synfont($basefont, [%options])
684           Returns a new synthetic font object.
685
686           Examples:
687
688               $cf  = $pdf->corefont('Times-Roman', -encode => 'latin1');
689               $sf  = $pdf->synfont($cf, -slant => 0.85);  # compressed 85%
690               $sfb = $pdf->synfont($cf, -bold => 1);      # embolden by 10em
691               $sfi = $pdf->synfont($cf, -oblique => -12); # italic at -12 degrees
692
693           Valid %options are:
694
695           -slant
696               Slant/expansion factor (0.1-0.9 = slant, 1.1+ = expansion).
697
698           -oblique
699               Italic angle (+/-)
700
701           -bold
702               Emboldening factor (0.1+, bold = 1, heavy = 2, ...)
703
704           -space
705               Additional character spacing in ems (0-1000)
706
707           See Also: PDF::API2::Resource::Font::SynFont
708
709       $font = $pdf->bdfont($bdf_file)
710           Returns a new BDF font object, based on the specified Adobe BDF
711           file.
712
713           See Also: PDF::API2::Resource::Font::BdFont
714
715       $font = $pdf->unifont(@fontspecs, %options)
716           Returns a new uni-font object, based on the specified fonts and
717           options.
718
719           BEWARE: This is not a true pdf-object, but a virtual/abstract font
720           definition!
721
722           See Also: PDF::API2::Resource::UniFont.
723
724           Valid %options are:
725
726           -encode
727               Changes the encoding of the font from its default.
728

IMAGE METHODS

730       $jpeg = $pdf->image_jpeg($file)
731           Imports and returns a new JPEG image object.  $file may be either a
732           filename or a filehandle.
733
734       $tiff = $pdf->image_tiff($file)
735           Imports and returns a new TIFF image object.  $file may be either a
736           filename or a filehandle.
737
738       $pnm = $pdf->image_pnm($file)
739           Imports and returns a new PNM image object.  $file may be either a
740           filename or a filehandle.
741
742       $png = $pdf->image_png($file)
743           Imports and returns a new PNG image object.  $file may be either a
744           filename or a filehandle.
745
746           Note: PNG files that include an alpha (transparency) channel go
747           through a relatively slow process of separating the transparency
748           channel into a PDF SMask object.  Install PDF::API2::XS or
749           Image::PNG::Libpng to speed this up by an order of magnitude.
750
751       $gif = $pdf->image_gif($file)
752           Imports and returns a new GIF image object.  $file may be either a
753           filename or a filehandle.
754
755       $gdf = $pdf->image_gd($gd_object, %options)
756           Imports and returns a new image object from GD::Image.
757
758           Options: The only option currently supported is "-lossless => 1".
759

COLORSPACE METHODS

761       $cs = $pdf->colorspace_act($file)
762           Returns a new colorspace object based on an Adobe Color Table file.
763
764           See PDF::API2::Resource::ColorSpace::Indexed::ACTFile for a
765           reference to the file format's specification.
766
767       $cs = $pdf->colorspace_web()
768           Returns a new colorspace-object based on the web color palette.
769
770       $cs = $pdf->colorspace_hue()
771           Returns a new colorspace-object based on the hue color palette.
772
773           See PDF::API2::Resource::ColorSpace::Indexed::Hue for an
774           explanation.
775
776       $cs = $pdf->colorspace_separation($tint, $color)
777           Returns a new separation colorspace object based on the parameters.
778
779           $tint can be any valid ink identifier, including but not limited
780           to: 'Cyan', 'Magenta', 'Yellow', 'Black', 'Red', 'Green', 'Blue' or
781           'Orange'.
782
783           $color must be a valid color specification limited to: '#rrggbb',
784           '!hhssvv', '%ccmmyykk' or a "named color" (rgb).
785
786           The colorspace model will automatically be chosen based on the
787           specified color.
788
789       $cs = $pdf->colorspace_devicen(\@tintCSx, [$samples])
790           Returns a new DeviceN colorspace object based on the parameters.
791
792           Example:
793
794               $cy = $pdf->colorspace_separation('Cyan',    '%f000');
795               $ma = $pdf->colorspace_separation('Magenta', '%0f00');
796               $ye = $pdf->colorspace_separation('Yellow',  '%00f0');
797               $bk = $pdf->colorspace_separation('Black',   '%000f');
798
799               $pms023 = $pdf->colorspace_separation('PANTONE 032CV', '%0ff0');
800
801               $dncs = $pdf->colorspace_devicen( [ $cy,$ma,$ye,$bk,$pms023 ] );
802
803           The colorspace model will automatically be chosen based on the
804           first colorspace specified.
805

BARCODE METHODS

807       $bc = $pdf->xo_codabar(%options)
808       $bc = $pdf->xo_code128(%options)
809       $bc = $pdf->xo_2of5int(%options)
810       $bc = $pdf->xo_3of9(%options)
811       $bc = $pdf->xo_ean13(%options)
812           Creates the specified barcode object as a form XObject.
813

OTHER METHODS

815       $xo = $pdf->xo_form()
816           Returns a new form XObject.
817
818       $egs = $pdf->egstate()
819           Returns a new extended graphics state object.
820
821       $obj = $pdf->pattern()
822           Returns a new pattern object.
823
824       $obj = $pdf->shading()
825           Returns a new shading object.
826
827       $otls = $pdf->outlines()
828           Returns a new or existing outlines object.
829

SUPPORTED PERL VERSIONS

831       PDF::API2 will aim to support all major Perl versions that were
832       released in the past six years, plus one, in order to continue working
833       for the life of most long-term-stable (LTS) server distributions.
834
835       For example, a version of PDF::API2 released on 2018-01-01 would
836       support the last major version of Perl released before 2012-01-01,
837       which happens to be 5.14.
838
839       If you need to use this module on a server with an extremely out-of-
840       date version of Perl, consider using either plenv or Perlbrew to run a
841       newer version of Perl without needing admin privileges.
842

KNOWN ISSUES

844       This module does not work with perl's -l command-line switch.
845

AUTHOR

847       PDF::API2 was originally written by Alfred Reibenschuh, extending code
848       written by Martin Hosken.
849
850       It is currently being maintained and developed by Steve Simms.
851

LICENSE

853       This program is free software: you can redistribute it and/or modify it
854       under the terms of the GNU Lesser General Public License as published
855       by the Free Software Foundation, either version 2.1 of the License, or
856       (at your option) any later version.
857
858       This library is distributed in the hope that it will be useful, but
859       WITHOUT ANY WARRANTY; without even the implied warranty of
860       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
861       Lesser General Public License for more details.
862
863
864
865perl v5.32.1                      2021-04-14                      PDF::API2(3)
Impressum