Viewer preferences

edit

Set the viewer preferences

document.PageLayout = PdfPageLayout.TwoPageRight;
document.PageMode = PdfPageMode.UseOutlines;
var preferences = document.ViewerPreferences;
preferences.DisplayDocumentTitle = true;
preferences.HideToolbar = true;
preferences.Direction = PdfReadingDirection.RightToLeft;
preferences.DisablePrintScaling = true;
preferences.Duplex = PdfDuplexMode.DuplexFlipLongEdge;
preferences.PrintPageRanges = [(0, 0), (2, 4)];
preferences.NumberOfCopies = 2;
PropertyEffect
PdfDocument.PageLayoutOne page at a time, one column, or two pages side by side
PdfDocument.PageModeThe panel next to the pages: the bookmarks, the thumbnails, the layers, the attachments, or full screen
HideToolbar, HideMenubar, HideWindowUIHide the elements of the viewer
FitWindow, CenterWindowResize the window to the first page, center it
DisplayDocumentTitleShow the title of the document instead of the file name, which PDF/UA requires
DirectionThe reading order, which sets the side of the pages shown side by side
DisablePrintScaling, Duplex, PrintPageRanges, NumberOfCopiesThe settings of the print dialog
  • The page ranges are zero-based page indexes, both ends included; the file stores page numbers.
  • The dictionary is created when a value is set, and removed when the last one is reset.
  • EnforcedPreferences lists the preferences viewers must not let the user override.
  • Viewers may ignore any of these preferences.