PDF::AP...erences(3)
π PDF::API2::ViewerPreferences β aka how ur PDF wants to be shown off
User Contributed Perl Documentation β¨ bestie we're in the User Contributed zone and it's giving cozy.
πΈ NAME πΈ
PDF::API2::ViewerPreferences β it's literally the vibe manual for how a PDF should be displayed or printed π«Ά
β¨ METHODS β¨
$self = $class->new($pdf)β makes u a shiny brand-new ViewerPreferences object, built from aPDF::API2object. iconic constructor behavior π%preferences = $self->get_preferences()β hands u back a hash stuffed with all the viewer preferences that are defined in the PDF. the whole collection, no gatekeeping π$value = $self->get_preference($name)β gimme the value of that specific viewer preference if it's there, orundefif it's not. no value, no problem, justundefπ$self->set_preferences(%values)β sets one or more viewer preferences, and the deets for all of them live in the PREFERENCES section right down below β¬οΈ
π PREFERENCES π
Viewer Preferences are basically the little notes u leave for the PDF viewer about how the doc should be presented on screen or in print. Plot twist: not all PDF viewers will actually respect these preferences. rude of them, honestly π
Boolean preferences default to false and take (or return) 0 or 1 as arguments.
Bounding Box preferences take (or return) one of media_box, crop_box, bleed_box, trim_box, or art_box.
hide_toolbar(boolean) β a flag saying whether to hide the tool bars while the document is active. bye toolbars πhide_menubar(boolean) β a flag saying whether to hide the menu bar while the document is active.hide_window_ui(boolean) β a flag saying whether to hide the user interface elements in the document's window β think scroll bars and navigation controls β leaving only the document's contents on display. full main-character minimalism β¨fit_window(boolean) β a flag saying whether to resize the document's window so it fits the size of the first displayed page. snug fit, we love to see it π§center_window(boolean) β a flag saying whether to position the document's window in the center of the screen. symmetry queen πdisplay_doc_title(boolean) β a flag saying whether the window's title bar should display the document title, which it takes from theTitleentry of the document information directory. if it's false, the title bar should instead show the name of the PDF file containing the document. pick ur fighter π₯non_full_screen_page_mode(name) β the document's page mode, specifying how to display the document when it exits full-screen mode. the options are the same aspage_modeinPDF::API2, except theattachmentsandfull_screenoptions aren't supported. so close, yet so limited πdirection('l2r'or'r2l') β the predominant reading order for text, left-to-right or right-to-left.
This entry has no direct effect on the document's contents or page numbering, but it may be used to determine the relative positioning of pages when they're displayed side-by-side or printed n-up. it's a layout hint, not a plot twist, iykyk π¦
view_area(bounding box) β the name of the page boundary representing the area of a page that shall be displayed when viewing the document on the screen.view_clip(bounding box) β the name of the page boundary to which the contents of a page shall be clipped when viewing the document on the screen. βοΈprint_area(bounding box) β the name of the page boundary representing the area of a page that shall be rendered when printing the document. π¨οΈprint_clip(bounding box) β the name of the page boundary to which the contents of a page shall be clipped when printing the document.print_scaling('none'or'app_default') β the page scaling option that shall be selected when a print dialog is displayed for this document.nonerepresents no page scaling, andapp_defaultrepresents the reader's default print scaling. no notes, perfect as is πduplex('simplex','duplex_short', or'duplex_long') β the paper handling option that shall be used when printing the file from the print dialog. the duplex values represent whether the page should be flipped on its short edge or long edge, respectively. double-sided and thriving π₯pick_tray_by_pdf_size(boolean) β a flag saying whether the PDF page size shall be used to select the input paper tray. this setting influences only the preset values used to populate the print dialog presented by the reader. tray behavior, but make it presets only πprint_page_rage(an array of integer pairs) β the page numbers used to initialize the print dialog box when the file is printed. the array shall contain an even number of integers to be interpreted in pairs, with each pair specifying the first and last pages in a sub-range of pages to be printed. the first page of the PDF file shall be denoted by1. (and yes bestie, the name really isprint_page_ragein here β we do not fix the source, we respect the source π)num_copies(integer) β the number of copies that shall be printed when the print dialog is opened for this file. go off, print it 47 times, that's between u and ur printer π
β οΈ quick reminder from ur girl: viewer preferences are requests, not laws. not every PDF viewer will respect them, so don't come for me if a toolbar stays visible π
perl v5.42.0 Β· 2025-09-01 β mwah, that's the whole page, no cap. stay slay, go forth and configure ur viewer prefs πβ¨π
π¦ where this page comes from
- fedora 43: perl-PDF-API2 2.048-1.fc43 Β· LGPL-2.1-or-later AND (GPL-1.0-or-later OR Artistic-1.0-Perl) AND (MIT OR Artistic-1.0-Perl)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms