ViewerPreferences Complete Reference

ViewerPreferences로 지원되는 뷰어에서 PDF 문서를 어떻게 표시할지, 그리고 일부 기본 인쇄 설정을 어떻게 초기화할지 제어할 수 있습니다. 현재 HotPDF 라이브러리는 14개의 ViewerPreferences 값과 관련 InitialZoom 속성을 지원합니다

Current Data Types

THPDFDirection = (LeftToRight, RightToLeft);
THPDFNonFullScreenPageMode = (
  nfpmUseNone, nfpmUseOutlines, nfpmUseThumbs, nfpmUseOC, nfpmUseAttachments
);
THPDFPrintScaling = (psNone, psAppDefault);
THPDFDuplex = (dupSimplex, dupDuplexFlipShortEdge, dupDuplexFlipLongEdge);
THPDFPageBoundary = (pbMediaBox, pbCropBox, pbBleedBox, pbTrimBox, pbArtBox);
THPDFInitialZoom = (
  FitNone, FitPage, FitWidth, FitHeight, FitBox, FitBoxWidth, FitBoxHeight,
  Zoom50, Zoom75, Zoom100, Zoom125, Zoom150, Zoom200
);

THPDFViewerPreference = (
  vpHideToolbar, vpHideMenubar, vpHideWindowUI, vpFitWindow, vpCenterWindow,
  vpDisplayDocTitle, vpDirection, vpNonFullScreenPageMode, vpPrintScaling,
  vpDuplex, vpPickTrayByPDFSize, vpNumCopies, vpPrintArea, vpPrintClip,
  vpViewArea, vpViewClip
);

THPDFViewerPreferences = set of THPDFViewerPreference;

Supported ViewerPreferences

Option Companion Property Description
vpHideToolbar None Hide the viewer toolbar.
vpHideMenubar None Hide the viewer menu bar.
vpHideWindowUI None 스크롤 막대와 탐색 컨트롤 같은 UI 요소를 숨깁니다
vpFitWindow None 문서 창 크기를 처음 표시되는 페이지에 맞춥니다
vpCenterWindow None 문서 창을 화면 중앙에 배치합니다
vpDisplayDocTitle Title 뷰어 제목 표시줄에 파일 이름 대신 문서 제목을 표시합니다
vpDirection Direction Store the predominant reading order using LeftToRight or RightToLeft.
vpNonFullScreenPageMode NonFullScreenPageMode 전체 화면 모드를 종료한 뒤 사용할 페이지 모드를 선택합니다
vpPrintScaling PrintScaling Choose psNone or psAppDefault for default print scaling.
vpDuplex Duplex Choose simplex or duplex printing behavior.
vpPickTrayByPDFSize None PDF 페이지 크기에 따라 프린터 용지함을 선택하도록 요청합니다
vpNumCopies NumCopies Store the suggested print copy count.
vpPrintArea PrintArea 인쇄 렌더링에 사용할 페이지 경계를 선택합니다
vpPrintClip PrintClip 인쇄 클리핑에 사용할 페이지 경계를 선택합니다
vpViewArea ViewArea 화면 보기 영역에 사용하는 페이지 경계(PDF 1.4 12.2). HotPDF v2.29.0부터 사용할 수 있습니다
vpViewClip ViewClip 화면 보기 클리핑에 사용하는 페이지 경계(PDF 1.4 12.2). HotPDF v2.29.0부터 사용할 수 있습니다

Companion Property Values

이 속성들은 해당하는 ViewerPreferences 플래그가 켜져 있을 때만 기록됩니다

Property Values
Direction LeftToRight, RightToLeft
NonFullScreenPageMode nfpmUseNone, nfpmUseOutlines, nfpmUseThumbs, nfpmUseOC, nfpmUseAttachments
PrintScaling psNone, psAppDefault
Duplex dupSimplex, dupDuplexFlipShortEdge, dupDuplexFlipLongEdge
PrintArea / PrintClip / ViewArea / ViewClip pbMediaBox, pbCropBox, pbBleedBox, pbTrimBox, pbArtBox

InitialZoom Integration

InitialZoom은 ViewerPreferences를 보완하며, 문서를 열었을 때의 초기 페이지 표시 모드를 제어합니다

기본값: HotPDF v2.3.11부터 기본값은 FitHeight(PDF /FitV destination)이며, 생성된 문서는 각 페이지가 뷰어 창의 높이에 맞춰진 상태로 열립니다. InitialZoom을 FitNone으로 설정하면 OpenAction을 생략하여 뷰어가 자체 기본 확대/축소 배율을 사용하게 됩니다

// Complete document presentation setup
HotPDF.ViewerPreferences := [vpFitWindow, vpCenterWindow, vpDisplayDocTitle];
HotPDF.InitialZoom := FitWidth;

// Technical document setup
HotPDF.ViewerPreferences := [vpDisplayDocTitle, vpPrintScaling];
HotPDF.InitialZoom := Zoom125;

// Presentation mode
HotPDF.ViewerPreferences := [vpFitWindow, vpHideToolbar, vpHideMenubar];
HotPDF.InitialZoom := FitPage;

Implementation Example

var
  VPref: THPDFViewerPreferences;
begin
  VPref := [vpFitWindow, vpCenterWindow, vpDisplayDocTitle];

  if EnableDirection then
  begin
    Include(VPref, vpDirection);
    HotPDF.Direction := RightToLeft;
  end;

  if EnablePrintScaling then
  begin
    Include(VPref, vpPrintScaling);
    HotPDF.PrintScaling := psNone;
  end;

  HotPDF.ViewerPreferences := VPref;
  HotPDF.InitialZoom := FitWidth;
end;

Compatibility Notes

  • Adobe Reader/Acrobat: Usually provides the most complete ViewerPreferences support.
  • 다른 뷰어: 이 값들은 필수 요구 사항이 아니라 환경 설정이므로 지원 범위가 다릅니다
  • Graceful Degradation: 규격을 준수하는 뷰어라면 지원하지 않는 설정은 안전하게 무시해야 합니다

Demo Applications

다음 데모는 현재 라이브러리 지원 범위에 맞춰 동기화되어 있습니다

  • Demo\Delphi\ViewerPref
  • Demo\CBuilder\ViewerPref