{
    "mode": "perldoc",
    "parameter": "PDF::API2::ViewerPreferences",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/PDF%3A%3AAPI2%3A%3AViewerPreferences/json",
    "generated": "2026-06-13T21:43:47Z",
    "sections": {
        "NAME": {
            "content": "PDF::API2::ViewerPreferences - How the PDF should be displayed or printed\n",
            "subsections": []
        },
        "METHODS": {
            "content": "$self = $class->new($pdf)\nCreates a new ViewerPreferences object from a PDF::API2 object.\n\n%preferences = $self->getpreferences()\nReturns a hash containing all of the viewer preferences that are defined in the PDF.\n\n$value = $self->getpreference($name)\nReturns the value of the specified viewer preference if present, or \"undef\" if not.\n\n$self->setpreferences(%values)\nSets one or more viewer preferences, as described in the preferences section below.\n",
            "subsections": []
        },
        "PREFERENCES": {
            "content": "Viewer Preferences describe how the document should be presented on screen or in print. Not all\nPDF viewers will respect these preferences.\n\nBoolean preferences default to false and take (or return) 0 or 1 as arguments.\n\nBounding Box preferences take (or return) one of \"mediabox\", \"cropbox\", \"bleedbox\",\n\"trimbox\", or \"artbox\".\n\nhidetoolbar (boolean)\nA flag specifying whether to hide the tool bars when the document is active.\n\nhidemenubar (boolean)\nA flag specifying whether to hide the menu bar when the document is active.\n\nhidewindowui (boolean)\nA flag specifying whether to hide the user interface elements in the document's window (such\nas scroll bars and navigation controls), leaving only the document's contents displayed.\n\nfitwindow (boolean)\nA flag specifying whether to resize the document's window to fit the size of the first\ndisplayed page.\n\ncenterwindow (boolean)\nA flag specifying whether to position the document's window in the center of the screen.\n\ndisplaydoctitle (boolean)\nA flag specifying whether the window's title bar should display the document title taken\nfrom the Title entry of the document information directory. If false, the title bar should\ninstead display the name of the PDF file containing the document.\n\nnonfullscreenpagemode (name)\nThe document's page mode, specifying how to display the document on exiting full-screen\nmode. Options are the same as \"pagemode\" in PDF::API2.\n\ndirection ('l2r' or 'r2l')\nThe predominant reading order for text (left-to-right or right-to-left).\n\nThis entry has no direct effect on the document's contents or page numbering but may be used\nto determine the relative positioning of pages when displayed side-by-side or printed n-up.\n\nviewarea (bounding box)\nThe name of the page boundary representing the area of a page that shall be displayed when\nviewing the document on the screen.\n\nviewclip (bounding box)\nThe name of the page boundary to which the contents of a page shall be clipped when viewing\nthe document on the screen.\n\nprintarea (bounding box)\nThe name of the page boundary representing the area of a page that shall be rendered when\nprinting the document.\n\nprintclip (bounding box)\nThe name of the page boundary to which the contents of a page shall be clipped when printing\nthe document.\n\nprintscaling ('none' or 'appdefault')\nThe page scaling option that shall be selected when a print dialog is displayed for this\ndocument. \"none\" represents no page scaling, and \"appdefault\" represents the reader's\ndefault print scaling.\n\nduplex ('simplex', 'duplexshort', or 'duplexlong')\nThe paper handling option that shall be used when printing the file from the print dialog.\nThe duplex values represent whether the page should be flipped on its short edge or long\nedge, respectively.\n\npicktraybypdfsize (boolean)\nA flag specifying whether the PDF page size shall be used to select the input paper tray.\nThis setting influences only the preset values used to populate the print dialog presented\nby the reader.\n\nprintpagerage (an array of integer pairs)\nThe page numbers used to initialize the print dialog box when the file is printed. The array\nshall contain an even number of integers to be interpreted in pairs, with each pair\nspecifying the first and last pages in a sub-range of pages to be printed. The first page of\nthe PDF file shall be denoted by 1.\n\nnumcopies (integer)\nThe number of copies that shall be printed when the print dialog is opened for this file.\n",
            "subsections": []
        }
    },
    "summary": "PDF::API2::ViewerPreferences - How the PDF should be displayed or printed",
    "flags": [],
    "examples": [],
    "see_also": []
}