PDFiumViewer 是一個(gè)基于 Chromium 的 PDF 閱讀器控件,用于在 WPF、WinForms 和 UWP 應(yīng)用程序中顯示 PDF 文件。要在 PDFiumViewer 中設(shè)置選項(xiàng),您需要使用其配置類(lèi) PdfiumViewerSettings
。以下是一些常見(jiàn)的設(shè)置選項(xiàng):
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.ZoomLevel = 1.5; // 設(shè)置縮放比例為 150%
pdfViewer.UpdateLayout();
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.PageLayout = PdfiumViewerPageLayout.SinglePage; // 設(shè)置頁(yè)面布局為單頁(yè)
pdfViewer.UpdateLayout();
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.RotationAngle = 90; // 設(shè)置旋轉(zhuǎn)角度為 90°
pdfViewer.UpdateLayout();
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.TextSelectionEnabled = true; // 啟用文本選擇功能
pdfViewer.UpdateLayout();
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.SmoothZoom = true; // 設(shè)置平滑縮放為啟用
pdfViewer.UpdateLayout();
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.ShowToolbar = true; // 顯示工具欄
pdfViewer.UpdateLayout();
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.ShowMenuBar = true; // 顯示菜單欄
pdfViewer.UpdateLayout();
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.ShowStatusBar = true; // 顯示狀態(tài)欄
pdfViewer.UpdateLayout();
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.ShowNavigationBar = true; // 顯示導(dǎo)航欄
pdfViewer.UpdateLayout();
PdfiumViewerSettings settings = pdfViewer.Settings;
settings.BackgroundColor = Colors.White; // 設(shè)置背景顏色為白色
pdfViewer.UpdateLayout();
請(qǐng)注意,這些設(shè)置選項(xiàng)可能會(huì)因 PDFiumViewer 的版本而有所不同。在使用這些設(shè)置時(shí),請(qǐng)確保查閱您正在使用的 PDFiumViewer 版本的文檔以獲取最新的信息。