Referencia completa de ViewerPreferences

ViewerPreferences permite controlar cómo se presentan los documentos PDF en visores compatibles y cómo se inicializan algunas configuraciones de impresión predeterminadas. La biblioteca HotPDF actual admite 14 valores ViewerPreferences más la propiedad relacionada 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 Descripción
vpHideToolbar None Hide the viewer toolbar.
vpHideMenubar None Hide the viewer menu bar.
vpHideWindowUI None Hide UI elements such as scroll bars and navigation controls.
vpFitWindow None Resize the document window to fit the first displayed page.
vpCenterWindow None Center the document window on the screen.
vpDisplayDocTitle Title Display the document title instead of the file name in the viewer caption.
vpDirection Direction Store the predominant reading order using LeftToRight or RightToLeft.
vpNonFullScreenPageMode NonFullScreenPageMode Choose the page mode to use after leaving full-screen mode.
vpPrintScaling PrintScaling Choose psNone or psAppDefault for default print scaling.
vpDuplex Duplex Choose simplex or duplex printing behavior.
vpPickTrayByPDFSize None Request printer tray selection based on the PDF page size.
vpNumCopies NumCopies Store the suggested print copy count.
vpPrintArea PrintArea Select the page boundary used for print rendering.
vpPrintClip PrintClip Select the page boundary used for print clipping.
vpViewArea ViewArea Page boundary used for the on-screen view area (PDF 1.4 12.2). Available since HotPDF v2.29.0.
vpViewClip ViewClip Page boundary used for the on-screen view clipping (PDF 1.4 12.2). Available since HotPDF v2.29.0.

Companion Property Values

Estas propiedades se escriben solo cuando la marca ViewerPreferences correspondiente está habilitada

Propiedad 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 complementa ViewerPreferences controlando el modo inicial de visualización de página cuando se abre el documento

Valor predeterminado: Desde HotPDF v2.3.11, el valor predeterminado es FitHeight (destino PDF /FitV), por lo que los documentos generados se abren con cada página ajustada a la altura de la ventana del visor. Establezca InitialZoom en FitNone para omitir OpenAction y permitir que el visor vuelva a su propio zoom predeterminado

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

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: normalmente proporciona el soporte ViewerPreferences más completo
  • Otros visores: el soporte varía porque estos valores son preferencias, no requisitos obligatorios
  • Degradación gradual: los visores conformes deben ignorar de forma segura las configuraciones no compatibles

Demo Applications

Las siguientes demos están sincronizadas con el soporte actual de la biblioteca:

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