首页| 论坛| 消息
主题:简易预览PDF 原来还可以这么搞。
fzw003发表于 2020-01-15 15:37
最近在做一个数据的输出的时候,简单的用QPdfWriter 输出pdf ,可是要做预览的时候尴住了。
找到下列pdf的render库:
poppler-qt4 C++/Qtyes??Win, Mac?, Linux, …GPL v2+ Hummus C++yesyesyesWin, Mac, LinuxApache 2.0 PoDoFoC++yesyesyesWin, Mac, LinuxLGPL
靠,这些都啥玩意。还要编译相应的库到各个平台。是不是有病,我只是想简单view一个image。但是我要累死累活。
我不想用Qt的webvengine自带的pdf控件,也不想用pdf的第三方库。就只想自己绘制的pdf自己搞个预览。
http://www.softwareace.cn/?p=342
Graphics View
Qt’s Graphics View framework can be a more suitable alternative for creating PDF documents with content that is mainly based on arbitrarily positioned and transformed 2D graphical items rather than continuous flowed rich text.
To export the content of a graphics scene or view (or a part of it) to PDF, you need to manually initialize a QPainter configured to paint on a PDF-creating QPrinter (as described above), and pass it to QGraphicsScene::render or QGraphicsView::render。
看到这马上想到了什么有木有?是不是很不屑。 何必多此一举呢。 要用到的人肯定真香的。item + scene +view;

原谅我没有华丽的润色。现实追不上这该死的想法.
happy enjoy.

浏览大图
回帖(5):
5楼:太厉害了,向楼主学习啊
4楼:XChinux:mupdf
这个可以看下能否帮助你。将PDF转成图片。 (2020-01-16 15:55) 
3楼:从 Qt 5.13 开始,Qt WebEngine 开始支持 pdf

全部回帖(5)»
最新回帖
收藏本帖
发新帖