/ViewerPreferences /Duplex hint —
the simplex / duplex paper-handling mode the PDF author would like the print dialog to default
to.property PrintPaperHandling: TPrintPaperHandling; // read only
The /Duplex entry of /ViewerPreferences recommends how the
printer should handle paper for the document (PDF 32000-1 § 12.2 Table 150). PDFium
decodes the named token and exposes it as a TPrintPaperHandling enum value:
phUndefined — the entry is absent. Treat as "use printer/viewer default".phSimplex — /Simplex. Single-sided printing.phDuplexFlipShortEdge — /DuplexFlipShortEdge. Two-sided printing, pages flip along the short edge (typical for landscape-style notebooks and calendars).phDuplexFlipLongEdge — /DuplexFlipLongEdge. Two-sided printing, pages flip along the long edge (the standard portrait book-style binding).Like the other print-related properties this is a hint baked into the file by the
author; PDFium does not enforce it. To honour the preference your printing layer must
forward the value to the printer driver. Under Windows GDI, call
SetPdfPrintPaperHandlingDevMode to set DEVMODE.dmFields and
DEVMODE.dmDuplex to DMDUP_SIMPLEX,
DMDUP_VERTICAL (long edge), or DMDUP_HORIZONTAL (short edge)
before StartDoc.
Pair this property with PrintScaling, PrintCopies and PrintPageRanges so all of the document's print preferences populate your print dialog as one consistent default set.
phUndefined.phSimplex and let the user override.
// Pre-select the duplex radio buttons and prepare the printer DevMode.
begin
case Pdf1.PrintPaperHandling of
phSimplex: radioSimplex.Checked := True;
phDuplexFlipLongEdge: radioDuplexLong.Checked := True;
phDuplexFlipShortEdge: radioDuplexShort.Checked := True;
else
radioPrinterDefault.Checked := True; // phUndefined
end;
if SetPdfPrintPaperHandlingDevMode(DevMode, Pdf1.PrintPaperHandling) then
ApplyPrinterDevMode(DevMode);
end;