/ViewerPreferences /Duplex 提示的已解碼值 — 也就是 PDF 作者希望列印對話框預設採用的單面或雙面紙張處理模式property PrintPaperHandling: TPrintPaperHandling; // read only
/ViewerPreferences 的 /Duplex 項目會建議印表機應如何為此文件處理紙張(PDF 32000-1 § 12.2 Table 150)。PDFium 會解碼該具名權杖,並以 TPrintPaperHandling 列舉值的形式公開:
phUndefined — 項目不存在。視為「使用印表機 / 檢視器預設值」phSimplex — /Simplex。單面列印phDuplexFlipShortEdge — /DuplexFlipShortEdge。雙面列印,頁面沿短邊翻轉(橫向式筆記本與月曆的典型設定)phDuplexFlipLongEdge — /DuplexFlipLongEdge。雙面列印,頁面沿長邊翻轉(直向書籍裝訂的標準方式)與其他列印相關屬性一樣,這是作者內嵌在檔案中的提示;PDFium 不會強制套用。若要遵循此偏好,您的列印層必須把該值轉送給印表機驅動程式。在 Windows GDI 下,請在 StartDoc 之前呼叫 SetPdfPrintPaperHandlingDevMode,將 DEVMODE.dmFields 與 DEVMODE.dmDuplex 設為 DMDUP_SIMPLEX、DMDUP_VERTICAL(長邊)或 DMDUP_HORIZONTAL(短邊)
將此屬性與 PrintScaling、PrintCopies 與 PrintPageRanges 搭配,讓文件的所有列印偏好以一套一致的預設組合填入您的列印對話框
phUndefinedphSimplex 並讓使用者覆寫
// 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;