{
    "mode": "perldoc",
    "parameter": "PDF::API2",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/PDF%3A%3AAPI2/json",
    "generated": "2026-06-10T16:17:16Z",
    "synopsis": "use PDF::API2;\n# Create a blank PDF file\n$pdf = PDF::API2->new();\n# Open an existing PDF file\n$pdf = PDF::API2->open('some.pdf');\n# Add a blank page\n$page = $pdf->page();\n# Retrieve an existing page\n$page = $pdf->openpage($pagenumber);\n# Set the page size\n$page->size('Letter');\n# Add a built-in font to the PDF\n$font = $pdf->font('Helvetica-Bold');\n# Add an external TrueType font to the PDF\n$font = $pdf->font('/path/to/font.ttf');\n# Add some text to the page\n$text = $page->text();\n$text->font($font, 20);\n$text->position(200, 700);\n$text->text('Hello World!');\n# Save the PDF\n$pdf->save('/path/to/new.pdf');",
    "sections": {
        "NAME": {
            "content": "PDF::API2 - Create, modify, and examine PDF files\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use PDF::API2;\n\n# Create a blank PDF file\n$pdf = PDF::API2->new();\n\n# Open an existing PDF file\n$pdf = PDF::API2->open('some.pdf');\n\n# Add a blank page\n$page = $pdf->page();\n\n# Retrieve an existing page\n$page = $pdf->openpage($pagenumber);\n\n# Set the page size\n$page->size('Letter');\n\n# Add a built-in font to the PDF\n$font = $pdf->font('Helvetica-Bold');\n\n# Add an external TrueType font to the PDF\n$font = $pdf->font('/path/to/font.ttf');\n\n# Add some text to the page\n$text = $page->text();\n$text->font($font, 20);\n$text->position(200, 700);\n$text->text('Hello World!');\n\n# Save the PDF\n$pdf->save('/path/to/new.pdf');\n",
            "subsections": []
        },
        "INPUT/OUTPUT METHODS": {
            "content": "new\nmy $pdf = PDF::API2->new(%options);\n\nCreate a new PDF.\n\nThe following options are available:\n\n*   file\n\nIf you will be saving the PDF to disk and already know the filename, you can include it here\nto open the file for writing immediately. \"file\" may also be a filehandle.\n\n*   compress\n\nBy default, most of the PDF will be compressed to save space. To turn this off (generally\nonly useful for testing or debugging), set \"compress\" to 0.\n\nopen\nmy $pdf = PDF::API2->open('/path/to/file.pdf', %options);\n\nOpen an existing PDF file.\n\nThe following option is available:\n\n*   compress\n\nBy default, most of the PDF will be compressed to save space. To turn this off (generally\nonly useful for testing or debugging), set \"compress\" to 0.\n\nsave\n$pdf->save('/path/to/file.pdf');\n\nWrite the PDF to disk and close the file. A filename is optional if one was specified while\nopening or creating the PDF.\n\nAs a side effect, the document structure is removed from memory when the file is saved, so it\nwill no longer be usable.\n\nclose\n$pdf->close();\n\nClose an open file (if relevant) and remove the object structure from memory.\n\nPDF::API2 contains circular references, so this call is necessary in long-running processes to\nkeep from running out of memory.\n\nThis will be called automatically when you save or stringify a PDF. You should only need to call\nit explicitly if you are reading PDF files and not writing them.\n\nfromstring\nmy $pdf = PDF::API2->fromstring($pdfstring, %options);\n\nRead a PDF document contained in a string.\n\nThe following option is available:\n\n*   compress\n\nBy default, most of the PDF will be compressed to save space. To turn this off (generally\nonly useful for testing or debugging), set \"compress\" to 0.\n\ntostring\nmy $string = $pdf->tostring();\n\nReturn the PDF document as a string.\n\nAs a side effect, the document structure is removed from memory when the string is created, so\nit will no longer be usable.\n",
            "subsections": []
        },
        "METADATA METHODS": {
            "content": "title\n$title = $pdf->title();\n$pdf = $pdf->title($title);\n\nGet/set/clear the document's title.\n\nauthor\n$author = $pdf->author();\n$pdf = $pdf->author($author);\n\nGet/set/clear the name of the person who created the document.\n\nsubject\n$subject = $pdf->subject();\n$pdf = $pdf->subject($subject);\n\nGet/set/clear the subject of the document.\n\nkeywords\n$keywords = $pdf->keywords();\n$pdf = $pdf->keywords($keywords);\n\nGet/set/clear a space-separated string of keywords associated with the document.\n\ncreator\n$creator = $pdf->creator();\n$pdf = $pdf->creator($creator);\n\nGet/set/clear the name of the product that created the document prior to its conversion to PDF.\n\nproducer\n$producer = $pdf->producer();\n$pdf = $pdf->producer($producer);\n\nGet/set/clear the name of the product that converted the original document to PDF.\n\nPDF::API2 fills in this field when creating a PDF.\n\ncreated\n$date = $pdf->created();\n$pdf = $pdf->created($date);\n\nGet/set/clear the document's creation date.\n\nThe date format is \"D:YYYYMMDDHHmmSSOHH'mm\", where \"D:\" is a static prefix identifying the\nstring as a PDF date. The date may be truncated at any point after the year. \"O\" is one of \"+\",\n\"-\", or \"Z\", with the following \"HH'mm\" representing an offset from UTC.\n\nWhen setting the date, \"D:\" will be prepended automatically if omitted.\n\nmodified\n$date = $pdf->modified();\n$pdf = $pdf->modified($date);\n\nGet/set/clear the document's modification date. The date format is as described in \"created\"\nabove.\n\ninfometadata\n# Get all keys and values\n%info = $pdf->infometadata();\n\n# Get the value of one key\n$value = $pdf->infometadata($key);\n\n# Set the value of one key\n$pdf = $pdf->infometadata($key, $value);\n\nGet/set/clear a key in the document's information dictionary. The standard keys (title, author,\netc.) have their own accessors, so this is primarily intended for interacting with custom\nmetadata.\n\nPass \"undef\" as the value in order to remove the key from the dictionary.\n\nxmlmetadata\n$xml = $pdf->xmlmetadata();\n$pdf = $pdf->xmlmetadata($xml);\n\nGet/set the document's XML metadata stream.\n\nversion\n$version = $pdf->version($newversion);\n\nGet/set the PDF version (e.g. 1.4).\n\nisencrypted\n$boolean = $pdf->isencrypted();\n\nReturns true if the opened PDF is encrypted.\n",
            "subsections": []
        },
        "INTERACTIVE FEATURE METHODS": {
            "content": "outline\n$outline = $pdf->outlines();\n\nCreates (if needed) and returns the document's outline tree, which is also known as its\nbookmarks or the table of contents, depending on the PDF reader.\n\nTo examine or modify the outline tree, see PDF::API2::Outline.\n\nopenaction\n$pdf = $pdf->openaction($page, $location, @args);\n\nSet the destination in the PDF that should be displayed when the document is opened.\n\n$page may be either a page number or a page object. The other parameters are as described in\nPDF::API2::NamedDestination.\n\npagelayout\n$layout = $pdf->pagelayout();\n$pdf = $pdf->pagelayout($layout);\n\nGet/set the page layout that should be used when the PDF is opened.\n\n$layout is one of the following:\n\n*   singlepage (or undef)\n\nDisplay one page at a time.\n\n*   onecolumn\n\nDisplay the pages in one column (a.k.a. continuous).\n\n*   twocolumnleft\n\nDisplay the pages in two columns, with odd-numbered pages on the left.\n\n*   twocolumnright\n\nDisplay the pages in two columns, with odd-numbered pages on the right.\n\n*   twopageleft\n\nDisplay two pages at a time, with odd-numbered pages on the left.\n\n*   twopageright\n\nDisplay two pages at a time, with odd-numbered pages on the right.\n\npagemode\n# Get\n$mode = $pdf->pagemode();\n\n# Set\n$pdf = $pdf->pagemode($mode);\n\nGet/set the page mode, which describes how the PDF should be displayed when opened.\n\n$mode is one of the following:\n\n*   none (or undef)\n\nNeither outlines nor thumbnails should be displayed.\n\n*   outlines\n\nShow the document outline.\n\n*   thumbnails\n\nShow the page thumbnails.\n\n*   fullscreen\n\nOpen in full-screen mode, with no menu bar, window controls, or any other window visible.\n\n*   optionalcontent\n\nShow the optional content group panel.\n\n*   attachments\n\nShow the attachments panel.\n\nviewerpreferences\n# Get\n%preferences = $pdf->viewerpreferences();\n\n# Set\n$pdf = $pdf->viewerpreferences(%preferences);\n\nGet or set PDF viewer preferences, as described in PDF::API2::ViewerPreferences.\n",
            "subsections": []
        },
        "PAGE METHODS": {
            "content": "page\n# Add a page to the end of the document\n$page = $pdf->page();\n\n# Insert a page before the specified page number\n$page = $pdf->page($pagenumber);\n\nReturns a new page object. By default, the page is added to the end of the document. If you\ninclude an existing page number, the new page will be inserted in that position, pushing\nexisting pages back.\n\nIf $pagenumber is -1, the new page is inserted as the second-last page; if $pagenumber is 0,\nthe new page is inserted as the last page.\n\nopenpage\n$page = $pdf->openpage($pagenumber);\n\nReturns the PDF::API2::Page object of page $pagenumber, if it exists.\n\nIf $pagenumber is 0 or -1, it will return the last page in the document.\n\nimportpage\n$page = $pdf->importpage($sourcepdf, $sourcepagenum, $targetpagenum);\n\nImports a page from $sourcepdf and adds it to the specified position in $pdf.\n\nIf $sourcepagenum or $targetpagenum is 0 or -1, the last page in the document is used.\n\nNote: If you pass a page object instead of a page number for $targetpagenum, the contents of\nthe page will be merged into the existing page.\n\nExample:\n\nmy $pdf = PDF::API2->new();\nmy $source = PDF::API2->open('source.pdf');\n\n# Add page 2 from the source PDF as page 1 of the new PDF\nmy $page = $pdf->importpage($source, 2);\n\n$pdf->save('sample.pdf');\n\nNote: You can only import a page from an existing PDF file.\n\nembedpage\n$xobject = $pdf->embedpage($sourcepdf, $sourcepagenumber);\n\nReturns a Form XObject created by extracting the specified page from a $sourcepdf.\n\nThis is useful if you want to transpose the imported page somewhat differently onto a page (e.g.\ntwo-up, four-up, etc.).\n\nIf $sourcepagenumber is 0 or -1, it will return the last page in the document.\n\nExample:\n\nmy $pdf = PDF::API2->new();\nmy $source = PDF::API2->open('source.pdf');\nmy $page = $pdf->page();\n\n# Import Page 2 from the source PDF\nmy $object = $pdf->embedpage($source, 2);\n\n# Add it to the new PDF's first page at 1/2 scale\nmy ($x, $y) = (0, 0);\n$page->object($object, $x, $y, 0.5);\n\n$pdf->save('sample.pdf');\n\nNote: You can only import a page from an existing PDF file.\n\npagecount\n$integer = $pdf->pagecount();\n\nReturn the number of pages in the document.\n\npagelabels\n$pdf = $pdf->pagelabels($pagenumber, %options);\n\nDescribes how pages should be numbered beginning at the specified page number.\n\n# Generate a 30-page PDF\nmy $pdf = PDF::API2->new();\n$pdf->page() for 1..30;\n\n# Number pages i to v, 1 to 20, and A-1 to A-5, respectively\n$pdf->pagelabels(1, style => 'roman');\n$pdf->pagelabels(6, style => 'decimal');\n$pdf->pagelabels(26, style => 'decimal', prefix => 'A-');\n\n$pdf->save('sample.pdf');\n\nThe following options are available:\n\n*   style\n\nOne of \"decimal\" (standard decimal arabic numerals), \"Roman\" (uppercase roman numerals),\n\"roman\" (lowercase roman numerals), \"Alpha\" (uppercase letters), or \"alpha\" (lowercase\nletters).\n\nThere is no default numbering style. If omitted, the page label will be just the prefix (if\nset) or an empty string.\n\n*   prefix\n\nThe label prefix for pages in this range.\n\n*   start\n\nAn integer (default: 1) representing the first value to be used in this page range.\n\ndefaultpagesize\n# Set\n$pdf->defaultpagesize($size);\n\n# Get\n@rectangle = $pdf->defaultpagesize()\n\nSet the default physical size for pages in the PDF. If called without arguments, return the\ncoordinates of the rectangle describing the default physical page size.\n\nSee \"Page Sizes\" in PDF::API2::Page for possible values.\n\ndefaultpageboundaries\n# Set\n$pdf->defaultpageboundaries(%boundaries);\n\n# Get\n%boundaries = $pdf->defaultpageboundaries();\n\nSet default prepress page boundaries for pages in the PDF. If called without arguments, returns\nthe coordinates of the rectangles describing each of the supported page boundaries.\n\nSee the equivalent \"pageboundaries\" method in PDF::API2::Page for details.\n",
            "subsections": []
        },
        "FONT METHODS": {
            "content": "font\nmy $font = $pdf->font($name, %options)\n\nAdd a font to the PDF. Returns the font object, to be used by PDF::API2::Content.\n\nThe font $name is either the name of one of the standard 14 fonts (e.g. Helvetica) or the path\nto a font file.\n\nmy $pdf = PDF::API2->new();\nmy $font1 = $pdf->font('Helvetica-Bold');\nmy $font2 = $pdf->font('/path/to/ComicSans.ttf');\nmy $page = $pdf->page();\nmy $content = $page->text();\n\n$content->position(1 * 72, 9 * 72);\n$content->font($font1, 24);\n$content->text('Hello, World!');\n\n$content->position(0, -36);\n$content->font($font2, 12);\n$content->text('This is some sample text.');\n\n$pdf->save('sample.pdf');\n\nThe path can be omitted if the font file is in the current directory or one of the directories\nreturned by \"fontpath\".\n\nTrueType (ttf/otf), Adobe PostScript Type 1 (pfa/pfb), and Adobe Glyph Bitmap Distribution\nFormat (bdf) fonts are supported.\n\nThe following %options are available:\n\n*   format\n\nThe font format is normally detected automatically based on the file's extension. If you're\nusing a font with an atypical extension, you can set \"format\" to one of \"truetype\" (TrueType\nor OpenType), \"type1\" (PostScript Type 1), or \"bitmap\" (Adobe Bitmap).\n\n*   kerning\n\nKerning (automatic adjustment of space between pairs of characters) is enabled by default if\nthe font includes this information. Set this option to false to disable.\n\n*   afmfile (PostScript Type 1 fonts only)\n\nSpecifies the location of the font metrics file.\n\n*   pfmfile (PostScript Type 1 fonts only)\n\nSpecifies the location of the printer font metrics file. This option overrides the -encode\noption.\n\n*   embed (TrueType fonts only)\n\nFonts are embedded in the PDF by default, which is required to ensure that they can be\nviewed properly on a device that doesn't have the font installed. Set this option to false\nto prevent the font from being embedded.\n\nsyntheticfont\n$font = $pdf->syntheticfont($basefont, %options)\n\nCreate and return a new synthetic font object. See PDF::API2::Resource::Font::SynFont for\ndetails.\n\nfontpath\n@directories = PDF::API2->fontpath()\n\nReturn the list of directories that will be searched (in order) in addition to the current\ndirectory when you add a font to a PDF without including the full path to the font file.\n\naddtofontpath\n@directories = PDF::API2->addtofontpath('/my/fonts', '/path/to/fonts');\n\nAdd one or more directories to the list of paths to be searched for font files.\n\nReturns the font search path.\n\nsetfontpath\n@directories = PDF::API2->setfontpath('/my/fonts', '/path/to/fonts');\n\nReplace the existing font search path. This should only be necessary if you need to remove a\ndirectory from the path for some reason, or if you need to reorder the list.\n\nReturns the font search path.\n",
            "subsections": []
        },
        "GRAPHICS METHODS": {
            "content": "image\n$object = $pdf->image($file, %options);\n\nImport a supported image type and return an object that can be placed as part of a page's\ncontent:\n\nmy $pdf = PDF::API2->new();\nmy $page = $pdf->page();\n\nmy $image = $pdf->image('/path/to/image.jpg');\n$page->object($image, 100, 100);\n\n$pdf->save('sample.pdf');\n\n$file may be either a file name, a filehandle, or a GD::Image object.\n\nSee \"place\" in PDF::API2::Content for details about placing images on a page once they're\nimported.\n\nThe image format is normally detected automatically based on the file's extension. If passed a\nfilehandle, image formats GIF, JPEG, and PNG will be detected based on the file's header.\n\nIf the file has an atypical extension or the filehandle is for a different kind of image, you\ncan set the \"format\" option to one of the supported types: \"gif\", \"jpeg\", \"png\", \"pnm\", or\n\"tiff\".\n\nNote: PNG images that include an alpha (transparency) channel go through a relatively slow\nprocess of splitting the image into separate RGB and alpha components as is required by images\nin PDFs. If you're having performance issues, install PDF::API2::XS or Image::PNG::Libpng to\nspeed this process up by an order of magnitude; either module will be used automatically if\navailable.\n\nbarcode\n$object = $pdf->barcode($format, $code, %options);\n\nGenerate and return a barcode that can be placed as part of a page's content:\n\nmy $pdf = PDF::API2->new();\nmy $page = $pdf->page();\n\nmy $barcode = $pdf->barcode('ean13', '0123456789012');\n$page->object($barcode, 100, 100);\n\n$pdf->save('sample.pdf');\n\n$format can be one of \"codabar\", \"code128\", \"code39\" (a.k.a. 3 of 9), \"ean128\", \"ean13\", or\n\"itf\" (a.k.a. interleaved 2 of 5).\n\n$code is the value to be encoded. Start and stop characters are only required when they're not\nstatic (e.g. for Codabar).\n\nThe following options are available:\n\n*   barwidth\n\nThe width of the smallest bar or space in points (72 points = 1 inch).\n\nIf you're following a specification that gives bar width in mils (thousandths of an inch),\nuse this conversion: \"$points = $mils / 1000 * 72\".\n\n*   barheight\n\nThe base height of the barcode in points.\n\n*   barextend\n\nIf present, bars for non-printing characters (e.g. start and stop characters) will be\nextended downward by this many points, and printing characters will be shown below their\nrespective bars.\n\nThis is enabled by default for EAN-13 barcodes.\n\n*   caption\n\nIf present, this value will be printed, centered, beneath the barcode, and should be a\nhuman-readable representation of the barcode.\n\n*   font\n\nA font object (created by \"font\") that will be used to print the caption, or the printable\ncharacters when \"barextend\" is set.\n\nHelvetica will be used by default.\n\n*   fontsize\n\nThe size of the font used for printing the caption or printable characters.\n\nThe default will be calculated based on the barcode size, if \"barextend\" is set, or 10\notherwise.\n\n*   quietzone\n\nA margin, in points, that will be place before the left and bottom edges of the barcode\n(including the caption, if present). This is used to help barcode scanners tell where the\nbarcode begins and ends.\n\nThe default is the width of one encoded character.\n\n*   baroverflow\n\nShrinks the horizontal width of bars by this amount in points to account for ink spread when\nprinting.\n\nThe default is 0.01 points.\n\n*   color\n\nDraw bars using this color, which may be any value accepted by \"fillcolor\" in\nPDF::API2::Content.\n\nThe default is black.\n\ncolorspace\n$colorspace = $pdf->colorspace($type, @arguments);\n\nColorspaces can be added to a PDF to either specifically control the output color on a\nparticular device (spot colors, device colors) or to save space by limiting the available colors\nto a defined color palette (web-safe palette, ACT file).\n\nOnce added to the PDF, they can be used in place of regular hex codes or named colors:\n\nmy $pdf = PDF::API2->new();\nmy $page = $pdf->page();\nmy $content = $page->graphics();\n\n# Add colorspaces for a spot color and the web-safe color palette\nmy $spot = $pdf->colorspace('spot', 'PANTONE Red 032 C', '#EF3340');\nmy $web = $pdf->colorspace('web');\n\n# Fill using the spot color with 100% coverage\n$content->fillcolor($spot, 1.0);\n\n# Stroke using the first color of the web-safe palette\n$content->strokecolor($web, 0);\n\n# Add a rectangle to the page\n$content->rectangle(100, 100, 200, 200);\n$content->paint();\n\n$pdf->save('sample.pdf');\n\nThe following types of colorspaces are supported\n\n*   spot\n\nmy $spot = $pdf->colorspace('spot', $tint, $altcolor);\n\nSpot colors are used to instruct a device (usually a printer) to use or emulate a particular\nink color ($tint) for parts of the document. An $altcolor is provided for devices (e.g. PDF\nviewers) that don't know how to produce the named color. It can either be an approximation\nof the color in RGB, CMYK, or HSV formats, or a wildly different color (e.g. 100% magenta,\n%0F00) to make it clear if the spot color isn't being used as expected.\n\n*   web\n\nmy $web = $pdf->colorspace('web');\n\nThe web-safe color palette is a historical collection of colors that was used when many\ndisplay devices only supported 256 colors.\n\n*   act\n\nmy $act = $pdf->colorspace('act', $filename);\n\nAn Adobe Color Table (ACT) file provides a custom palette of colors that can be referenced\nby PDF graphics and text drawing commands.\n\n*   device\n\nmy $devicen = $pdf->colorspace('device', @colorspaces);\n\nA device-specific colorspace allows for precise color output on a given device (typically a\nprinting press), bypassing the normal color interpretation performed by raster image\nprocessors (RIPs).\n\nDevice colorspaces are also needed if you want to blend spot colors:\n\nmy $pdf = PDF::API2->new();\nmy $page = $pdf->page();\nmy $content = $page->graphics();\n\n# Create a two-color device colorspace\nmy $yellow = $pdf->colorspace('spot', 'Yellow', '%00F0');\nmy $spot = $pdf->colorspace('spot', 'PANTONE Red 032 C', '#EF3340');\nmy $device = $pdf->colorspace('device', $yellow, $spot);\n\n# Fill using a blend of 25% yellow and 75% spot color\n$content->fillcolor($device, 0.25, 0.75);\n\n# Stroke using 100% spot color\n$content->strokecolor($device, 0, 1);\n\n# Add a rectangle to the page\n$content->rectangle(100, 100, 200, 200);\n$content->paint();\n\n$pdf->save('sample.pdf');\n\negstate\n$resource = $pdf->egstate();\n\nCreates and returns a new extended graphics state object, described in PDF::API2::ExtGState.\n",
            "subsections": []
        },
        "BACKWARD COMPATIBILITY": {
            "content": "Code written using PDF::API2 should continue to work unchanged for the life of most\nlong-term-stable (LTS) server distributions. Specifically, it should continue working for\nversions of Perl that were released within the past five years (the typical support window for\nLTS releases) plus six months (allowing plenty of time for package freezes prior to release).\n\nIn PDF::API2, method names, options, and functionality change over time. Functionality that's\ndocumented (not just in source code comments) should continue working for the same time period\nof five years and six months, though deprecation warnings may be added. There may be exceptions\nif your code happens to rely on bugs that get fixed, including when a method in PDF::API2 is\nchanged to more closely follow the PDF specification.\n\nOccasional breaking changes may be unavoidable or deemed small enough in scope to be worth the\nbenefit of making the change instead of keeping the old behavior. These will be noted in the\nChanges file as items beginning with the phrase \"Breaking Change\".\n\nUndocumented features, unreleased code, features marked as experimental, and underlying data\nstructures may change at any time. An exception is for features that were previously released\nand documented, which should continue to work for the above time period after the documentation\nis removed.\n\nBefore migrating to a new LTS server version, it's recommended that you upgrade to the latest\nversion of PDF::API2, \"use warnings\", and check your server logs for deprecation messages after\nexercising your code. Once these are resolved, it should be safe to use future PDF::API2\nreleases during that LTS support window.\n\nIf your code uses a PDF::API2 method that isn't documented here, it has probably been\ndeprecated. Search for it in the Migration section below to find its replacement.\n",
            "subsections": []
        },
        "MIGRATION": {
            "content": "Use this section to bring your existing code up to date with current method names and options.\nIf you're not getting a deprecation warning, this is optional, but still recommended.\n\nFor example, in cases where a method was simply renamed, the old name will be set up as an alias\nfor the new one, which can be maintained indefinitely. The main benefit of switching to the new\nname is to make it easier to find the appropriate documentation when you need it.\n",
            "subsections": [
                {
                    "name": "new",
                    "content": ""
                },
                {
                    "name": "new",
                    "content": "Remove the hyphen from the option names.\n"
                },
                {
                    "name": "new",
                    "content": "Replace with calls to \"INTERACTIVE FEATURE METHODS\". See the deprecated \"preferences\" method\nfor particular option names.\n\nfinishobjects\nsaveas\nupdate\nReplace with \"save\".\n\nend\nrelease\nReplace with \"close\".\n\nopenscalar\nopenScalar\nReplace with \"fromstring\".\n\nstringify\nReplace with \"tostring\".\n\ninfo\nEach of the hash keys now has its own accessor. See \"METADATA METHODS\".\n\nFor custom keys or if you prefer to give the key names as variables (e.g. as part of a\nloop), use \"infometadata\".\n\ninfoMetaAttributes\nUse \"infometadata\" without arguments to get a list of currently-set keys in the Info\ndictionary (including any custom keys). This is slightly different behavior from calling\n\"infoMetaAttributes\" without arguments, which always returns the standard key names and any\ndefined custom key names, whether or not they're present in the PDF.\n\nCalling \"infoMetaAttributes\" with arguments defines the list of Info keys that are supported\nby the deprecated \"info\" method. You can now just call \"infometadata\" with a standard or\ncustom key and value.\n\nxmpMetadata\nReplace with \"xmlmetadata\". Note that, when called with an argument, \"xmlmetadata\" returns\nthe PDF object rather than the value, to line up with most other PDF::API2 accessors.\n\nisEncrypted\nReplace with \"isencrypted\".\n\noutlines\nReplace with \"outline\".\n\npreferences\nThis functionality has been split into a few methods, aligning more closely with the\nunderlying PDF structure. See the documentation for each of the methods for revised option\nnames.\n\n*   -fullscreen, -thumbs, -outlines\n\nCall \"pagemode\".\n\n*   -singlepage, -onecolumn, -twocolumnleft, -twocolumnright\n\nCall \"pagelayout\".\n\n*   -hidetoolbar, -hidemenubar, -hidewindowui, -fitwindow, -centerwindow, -displaytitle,\n-righttoleft, -afterfullscreenthumbs, -afterfullscreenoutlines, -printscalingnone,\n-simplex, -duplexfliplongedge, -duplexflipshortedge\n\nCall \"viewerpreferences\".\n\n*   -firstpage\n\nCall \"openaction\".\n\nopenpage\nReplace with \"openpage\".\n\nimportpage\nReplace with \"importpage\".\n\nimportPageIntoForm\nReplace with \"embedpage\".\n\npages\nReplace with \"pagecount\".\n\npageLabel\nReplace with \"pagelabels\". Remove hyphens from the argument names. Add \"style => 'decimal'\"\nif there wasn't a \"-style\" argument.\n\nmediabox\ncropbox\nbleedbox\ntrimbox\nartbox\nReplace with \"defaultpageboundaries\". If using page size aliases (e.g. \"letter\" or \"A4\"),\ncheck to ensure that the alias is still supported (you'll get an error if it isn't).\n\nsynfont\nReplace with \"syntheticfont\".\n\naddFontDirs\nReplace with \"addtofontpath\".\n\ncorefont\nReplace with \"font\". Note that \"font\" requires that the font name be an exact,\ncase-sensitive match. The full list can be found in \"STANDARD FONTS\" in\nPDF::API2::Resource::Font::CoreFont.\n\nttfont\nReplace with \"font\". Replace \"-noembed => 1\" with \"embed => 0\".\n\nbdfont\nReplace with \"font\".\n\npsfont\nReplace with \"font\". Rename options \"-afmfile\" and \"-pfmfile\" to \"afmfile\" and \"pfmfile\".\n\nNote that Adobe has announced that their products no longer support Postscript Type 1 fonts,\neffective early 2023. They recommend using TrueType or OpenType fonts instead.\n\ncjkfont\nunifont\nThese are old methods from back when Unicode was still new and poorly supported. Replace\nthem with calls to \"font\" using a TrueType or OpenType font that has the characters you\nneed.\n\nIf you're successfully using one of these two methods and feel they shouldn't be deprecated,\nplease contact me with your use case.\n\nimagegd\nimagegif\nimagejpeg\nimagepng\nimagepnm\nimagetiff\nReplace with \"image\".\n\nxocode128\nxocodabar\nxo2of5int\nxo3of9\nxoean13\nReplace with \"barcode\". Replace arguments as follows:\n\n*   \"-color\": \"color\"\n\n*   \"-fnsz\": \"fontsize\"\n\n*   \"-font\": \"font\"\n\n*   \"-lmzn\": \"barextend\"\n\n*   \"-ofwt\": \"baroverflow\"\n\n*   \"-quzn\": \"quietzone\"\n\n*   \"-zone\": \"barheight\"\n\nThese options are simple renames.\n\n*   \"-mils\": \"barwidth\"\n\nThis requires a conversion from mils to points. The \"barwidth\" documentation has sample\ncode to do the conversion.\n\n*   \"-ean\"\n\nSpecify \"ean128\" as the barcode format instead of \"code128\".\n\ncolorspaceact\ncolorspaceweb\ncolorspaceseparation\ncolorspacedevicen\nReplace with \"colorspace\".\n\ncolorspacehue\nThis is deprecated because I wasn't able to find a corresponding standard. Please contact me\nif you're using it, to avoid having it be removed in a future release.\n\ndefault\nThe optional changes in default behavior have all been deprecated.\n\nReplace \"pageencaps\" with calls to \"save\" and \"restore\" when embedding or superimposing a\npage onto another, if needed.\n\n\"nounrotate\" and \"copyannots\" will continue to work until better options are available, but\nshould not be used in new code.\n"
                }
            ]
        },
        "AUTHOR": {
            "content": "PDF::API2 is developed and maintained by Steve Simms, with patches from numerous contributors\nwho are credited in the Changes file.\n\nIt was originally written by Alfred Reibenschuh, extending code written by Martin Hosken.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "This program is free software: you can redistribute it and/or modify it under the terms of the\nGNU Lesser General Public License as published by the Free Software Foundation, either version\n2.1 of the License, or (at your option) any later version.\n\nThis library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\nthe GNU Lesser General Public License for more details.\n",
            "subsections": []
        }
    },
    "summary": "PDF::API2 - Create, modify, and examine PDF files",
    "flags": [],
    "examples": [],
    "see_also": []
}