PDFiumVCL Docs

PrintPaperHandling property

Dieser API-Eintrag behält Bezeichner, Signaturen, Codeblöcke und PDF-Begriffe in ihrer Originalform.
Component: TPdf  ·  Unit: PDFium
Decoded value of the document's /ViewerPreferences /Duplex hint — the simplex / duplex paper-handling mode the PDF author would like the print dialog to default to.

Syntax

property PrintPaperHandling: TPrintPaperHandling; // read only

Description

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:

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.

Remarks

Example

// 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;

See Also

PrintCopies, PrintScaling, PrintPageRanges, SetPdfPrintPaperHandlingDevMode, ViewerPreference