WPF 使用PdfiumViewer实现PDF预览与打印

1.引用Nuget包:PdfiumViewer

2.Xaml代码,需要使用<WindowsFormsHost>标签,可能这个包是为winform设计的。

XML 复制代码
    xmlns:pdfium="clr-namespace:PdfiumViewer;assembly=PdfiumViewer"

    <WindowsFormsHost>
        <pdfium:PdfViewer x:Name="pdfViewer" Width="300" Height="300"/>
    </WindowsFormsHost>

3.后台代码,非常简单,绑定一下PDF文件路径即可。

cs 复制代码
        public PrintingPDF(string PDFPath)
        {
            InitializeComponent();

            try
            {
                var document = PdfDocument.Load(PDFPath);
                pdfViewer.Document = document;
            }
            catch (Exception ex)
            {
                
            }
        }
相关推荐
w20180010 小时前
一至六年级下册数学第五单元测试卷(人教版+苏教版)
pdf
w20180013 小时前
人教版小学一至六年级下册语文期中考试试卷PDF可打印
pdf
w20180015 小时前
小学一至六年级下册数学期中考试试卷PDF(人教版+苏教版+冀教版+北师版)
pdf
yivifu16 小时前
使用PyMuPDF基于对PDF文档内容的分析自动识别并删除PDF文件中的水印
python·pdf·pymupdf·去水印
tanis_207716 小时前
PDF 解析后输出什么格式?MinerU 五类下游场景的选型指南
人工智能·pdf·csdn开发云
tanis_20771 天前
扫描版中文 PDF 怎么提取文字:用 MinerU 做 OCR + 结构化一体处理
人工智能·pdf·ocr
tanis_20771 天前
MinerU2.5-Pro 中文 PDF 识别准确率全解:OmniDocBench v1.6 权威基准数据
人工智能·python·pdf
小林敲代码77881 天前
基于 PDFBox 的 PDF 水印管理:使用 OCG 层实现精准添加与一键去除
pdf
tanis_20771 天前
学术论文 PDF 的版面自动还原:MinerU 对多栏排版、浮动图表与脚注区域的识别实战
人工智能·pdf·ocr
tanis_20771 天前
从 PDF 中精准提取表格、图片与公式:MinerU 结构化元素抽取的 3 种方案
pdf