admin管理员组

文章数量:1592418

目录

1、参考

2、实现

3、开发记录


1、参考

使用Qt的WebEngine和javascript的pdf.js模块构建的PDF查看器。

参考链接1:GitHub - Archie3d/qpdf: PDF viewer widget for Qt

参考链接2:GitHub - yshurik/qpdfjs: Desktop PDF Viewer based on Qt and PDF.JS technologies

pdfjs源码下载:Getting Started

2、实现

Print.js主页说明:Print.js - Javascript library for HTML elements, PDF and image files printing.

源码下载链接:Release v1.5.0 · crabbly/Print.js · GitHub

测试发现pdfjs与qtwenengineview结合,并不能调用打印机,这里添加了js+qt打印通信功能,调用qt的打印窗口:

实现效果,对应代码下载  https://download.csdn/download/qq_36939187/87336714

3、开发记录

QWebEngineView 设置无缓存

    QWebEngineProfile *pEngineProfile = page()->profile();

    if(nullptr == pEngineProfile)

    {

        return;

    }

    

    pEngineProfile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies); // 会话和持久性cookie都存储在内存中

    pEngineProfile->setHttpCacheType(QWebEngineProfile::NoCache);                       // 禁用内存和磁盘缓存。

本文标签: 阅读器PDFpdfjs