├── .gitignore ├── LICENSE ├── OfficeMaster_document_convert_system └── officemaster.lic ├── README.md ├── convertcases ├── img2ofd.ofd ├── img2pdf.pdf ├── ofd发票.ofd ├── path_ctm.pdf ├── path_text.pdf ├── pdf发票.pdf ├── test.png └── test.png.json ├── img2pdf.cpp ├── img2pdf.h ├── img2pdf.ui ├── include ├── public │ ├── DEPS │ ├── PRESUBMIT.py │ ├── README │ ├── cpp │ │ ├── fpdf_deleters.h │ │ └── fpdf_scopers.h │ ├── fpdf_annot.h │ ├── fpdf_attachment.h │ ├── fpdf_catalog.h │ ├── fpdf_dataavail.h │ ├── fpdf_doc.h │ ├── fpdf_edit.h │ ├── fpdf_ext.h │ ├── fpdf_flatten.h │ ├── fpdf_formfill.h │ ├── fpdf_fwlevent.h │ ├── fpdf_javascript.h │ ├── fpdf_ppo.h │ ├── fpdf_progressive.h │ ├── fpdf_save.h │ ├── fpdf_searchex.h │ ├── fpdf_signature.h │ ├── fpdf_structtree.h │ ├── fpdf_sysfontinfo.h │ ├── fpdf_text.h │ ├── fpdf_thumbnail.h │ ├── fpdf_transformpage.h │ └── fpdfview.h └── xilou_public │ ├── xilou_convert.h │ ├── xilou_errcode.h │ ├── xilou_logger.h │ ├── xilou_signature.h │ └── xilou_view.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── ofdcases ├── intro-数科.ofd ├── issue3 │ └── test2.ofd ├── path_AxialShd1.ofd └── 内嵌stroke字体.ofd ├── ofdmerge.cpp ├── ofdmerge.h ├── ofdmerge.ui ├── out └── release │ ├── API-MS-Win-core-xstate-l2-1-0.dll │ ├── FreeImage.dll │ ├── QtCore4.dll │ ├── QtGui4.dll │ ├── absl.dll │ ├── api-ms-win-core-console-l1-1-0.dll │ ├── api-ms-win-core-console-l1-2-0.dll │ ├── api-ms-win-core-datetime-l1-1-0.dll │ ├── api-ms-win-core-debug-l1-1-0.dll │ ├── api-ms-win-core-errorhandling-l1-1-0.dll │ ├── api-ms-win-core-file-l1-1-0.dll │ ├── api-ms-win-core-file-l1-2-0.dll │ ├── api-ms-win-core-file-l2-1-0.dll │ ├── api-ms-win-core-handle-l1-1-0.dll │ ├── api-ms-win-core-heap-l1-1-0.dll │ ├── api-ms-win-core-interlocked-l1-1-0.dll │ ├── api-ms-win-core-libraryloader-l1-1-0.dll │ ├── api-ms-win-core-localization-l1-2-0.dll │ ├── api-ms-win-core-memory-l1-1-0.dll │ ├── api-ms-win-core-namedpipe-l1-1-0.dll │ ├── api-ms-win-core-processenvironment-l1-1-0.dll │ ├── api-ms-win-core-processthreads-l1-1-0.dll │ ├── api-ms-win-core-processthreads-l1-1-1.dll │ ├── api-ms-win-core-profile-l1-1-0.dll │ ├── api-ms-win-core-rtlsupport-l1-1-0.dll │ ├── api-ms-win-core-string-l1-1-0.dll │ ├── api-ms-win-core-synch-l1-1-0.dll │ ├── api-ms-win-core-synch-l1-2-0.dll │ ├── api-ms-win-core-sysinfo-l1-1-0.dll │ ├── api-ms-win-core-timezone-l1-1-0.dll │ ├── api-ms-win-core-util-l1-1-0.dll │ ├── api-ms-win-crt-conio-l1-1-0.dll │ ├── api-ms-win-crt-convert-l1-1-0.dll │ ├── api-ms-win-crt-environment-l1-1-0.dll │ ├── api-ms-win-crt-filesystem-l1-1-0.dll │ ├── api-ms-win-crt-heap-l1-1-0.dll │ ├── api-ms-win-crt-locale-l1-1-0.dll │ ├── api-ms-win-crt-math-l1-1-0.dll │ ├── api-ms-win-crt-multibyte-l1-1-0.dll │ ├── api-ms-win-crt-private-l1-1-0.dll │ ├── api-ms-win-crt-process-l1-1-0.dll │ ├── api-ms-win-crt-runtime-l1-1-0.dll │ ├── api-ms-win-crt-stdio-l1-1-0.dll │ ├── api-ms-win-crt-string-l1-1-0.dll │ ├── api-ms-win-crt-time-l1-1-0.dll │ ├── api-ms-win-crt-utility-l1-1-0.dll │ ├── api-ms-win-downlevel-kernel32-l2-1-0.dll │ ├── api-ms-win-eventing-provider-l1-1-0.dll │ ├── cppgc.dll │ ├── dbgcore.dll │ ├── dbgeng.dll │ ├── dbghelp.dll │ ├── hbsubset.dll │ ├── hbsubset.lib │ ├── icui18n.dll │ ├── icui18n_hidden_visibility.dll │ ├── icuuc.dll │ ├── icuuc_hidden_visibility.dll │ ├── libc++.dll │ ├── msvcp100.dll │ ├── msvcp140.dll │ ├── msvcr100.dll │ ├── oes.dll │ ├── pdfium.dll │ ├── pdfium.dll.lib │ ├── snapshot_blob.bin │ ├── ucrtbase.dll │ ├── v8.dll │ ├── v8_build_config.json │ ├── v8_cppgc_shared_for_testing.dll │ ├── v8_libbase.dll │ ├── v8_libplatform.dll │ ├── vccorlib140.dll │ ├── vcruntime140.dll │ ├── xilou.exe │ └── zlib.dll ├── preview ├── 6F575221-72B1-4e0f-8EA1-5457D8205C03.png ├── annots.png ├── clips.jpg ├── drawparam.jpg ├── img_border.png ├── pdf2ofd.png ├── signed.png ├── ticket.png └── verify.png └── xilou.pro /.gitignore: -------------------------------------------------------------------------------- 1 | out/release/logs/rotating.txt 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2023, Chingliu 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /OfficeMaster_document_convert_system/officemaster.lic: -------------------------------------------------------------------------------- 1 | eoCw5vwwkSnpnaNoLCHhRDdFM2JtY0l5MVE1NWR1bjNSWXM5OU1UNTVuRW1ub3KJKFSWrG+CwqiPn5kOtubnRD/NAZ7DbfQMdtEEeXqiKMZDCXa0kgQJsRYap2vxBRmKhxv2GQqqGfTe9kLB7ukPXUKJp6xZf26S/AZh4HUJloglN/hUJrvH+DNfX1tbZ2vSyBgULdLQktDlB7/LiCbW80W4Y6Iuahe9QsoLx3LrU6ChKKdnDYM3q/KziaESheNZv1baFPTHkNskeA3l7vOocsAEmz8kwVc8Fbcl/7VO7bDxW0KIY/Eu93b0h5y6yMblNRCpBcZekX/zd6EFH5n8oA== -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XilouReader 2 | 专注pdf阅读,pdf处理,ofd阅读,ofd处理,pdf转ofd以及ofd转pdf引擎功能开发。基于pdfium的ofd/pdf双引擎版式阅读器。 3 | 4 | 引擎代码地址:https://github.com/Chingliu/xilou_core 5 | 现状 6 | 1。PDF阅读 7 | 2。OFD常规文档,发票,公文的阅读及签章验证通常不会有问题,有问题请报issue附上文档 8 | 9 | history: 10 | 2024-06-13:实现ofd文档合并 11 | 2024-06-10:实现了图像转pdf/ofd, 双层pdf/ofd,见convertcases下的test.png/test.png.json/img2ofd.ofd/img2pdf.pdf 12 | 2024-02-03:简单pdf转ofd 13 | 2023-12-25:实现PDF转.txt文件功能 14 | 15 | 16 | 目录说明: 17 | out/release目录下是windows下的预编译版本,只测试了windows11(windows10应该也可以) 18 | ofdcases目录用于上传ofd用例文档, 有任何渲染有问题的文档,欢迎 pull request 19 | convertcases目录用于上传pfd转ofd, ofd转pdf用例文档, 有任何有问题文档,欢迎 pull request 20 | OfficeMaster_document_convert_system 目录放置的是OfficeMaster多格式文档转换系统的授权文件 21 | 详见https://github.com/Chingliu/OfficeMaster_document_convert_system 或 22 | https://gitee.com/chingliu/OfficeMaster_document_convert_system 23 | 24 | TODO 25 | 1. 签章解析(ofd已支持签章解析及验章) 验章逻辑在https://github.com/Chingliu/gm_0031_38540_verifier 26 | 2. 字体裁剪 27 | 3. pdf转ofd 28 | 29 | preview: 30 | ![image](preview/drawparam.jpg) 31 | ![image](preview/ticket.png) 32 | ![image](preview/clips.jpg) 33 | ![image](preview/6F575221-72B1-4e0f-8EA1-5457D8205C03.png) 34 | ![image](preview/signed.png) 35 | ![image](preview/verify.png) 36 | ![image](preview/img_border.png) 37 | ![image](preview/annots.png) 38 | convert: 39 | ![image](preview/pdf2ofd.png) 40 | 41 | -------------------------------------------------------------------------------- /convertcases/img2ofd.ofd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/convertcases/img2ofd.ofd -------------------------------------------------------------------------------- /convertcases/img2pdf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/convertcases/img2pdf.pdf -------------------------------------------------------------------------------- /convertcases/ofd发票.ofd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/convertcases/ofd发票.ofd -------------------------------------------------------------------------------- /convertcases/path_ctm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/convertcases/path_ctm.pdf -------------------------------------------------------------------------------- /convertcases/path_text.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/convertcases/path_text.pdf -------------------------------------------------------------------------------- /convertcases/pdf发票.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/convertcases/pdf发票.pdf -------------------------------------------------------------------------------- /convertcases/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/convertcases/test.png -------------------------------------------------------------------------------- /convertcases/test.png.json: -------------------------------------------------------------------------------- 1 | { 2 | "taskId": 1, 3 | "ocrResult": [ 4 | { 5 | "text": "广东省人民政府办公厅", 6 | "location": { 7 | "left": 89.91585, 8 | "top": 87.620804, 9 | "right": 693.8248, 10 | "bottom": 151.00175 11 | }, 12 | "pos": { 13 | "x": 90.1736, 14 | "y": 87.620804 15 | } 16 | }, 17 | { 18 | "text": "特 急", 19 | "location": { 20 | "left": 108.79063, 21 | "top": 232.78854, 22 | "right": 173.12917, 23 | "bottom": 256.1844 24 | }, 25 | "pos": { 26 | "x": 108.79063, 27 | "y": 232.78854 28 | } 29 | }, 30 | { 31 | "text": "粤办秘函〔2013]8号", 32 | "location": { 33 | "left": 465.5771, 34 | "top": 232.78854, 35 | "right": 662.1021, 36 | "bottom": 253.8448 37 | }, 38 | "pos": { 39 | "x": 465.5771, 40 | "y": 232.78854 41 | } 42 | }, 43 | { 44 | "text": "广东省人民政府办公厅关于召开", 45 | "location": { 46 | "left": 203.54376, 47 | "top": 311.16458, 48 | "right": 591.9146, 49 | "bottom": 345.08856 50 | }, 51 | "pos": { 52 | "x": 203.54376, 53 | "y": 311.16458 54 | } 55 | }, 56 | { 57 | "text": "省网上办事大厅建设工作", 58 | "location": { 59 | "left": 240.9046, 60 | "top": 357.78195, 61 | "right": 552.2209, 62 | "bottom": 390.599 63 | }, 64 | "pos": { 65 | "x": 241.04675, 66 | "y": 357.78195 67 | } 68 | }, 69 | { 70 | "text": "电视电话会议的通知", 71 | "location": { 72 | "left": 266.7125, 73 | "top": 404.74792, 74 | "right": 525.23645, 75 | "bottom": 433.9927 76 | }, 77 | "pos": { 78 | "x": 266.7125, 79 | "y": 404.74792 80 | } 81 | }, 82 | { 83 | "text": "各地级以上市人民政府,顺德区人民政府,省有关单位:", 84 | "location": { 85 | "left": 111.13021, 86 | "top": 488.97293, 87 | "right": 575.53754, 88 | "bottom": 508.85938 89 | }, 90 | "pos": { 91 | "x": 111.13021, 92 | "y": 488.97293 93 | } 94 | }, 95 | { 96 | "text": "经省政府同意,定于2013年3月7日(星期四)上午9时30分", 97 | "location": { 98 | "left": 147.39375, 99 | "top": 522.8969, 100 | "right": 678.4792, 101 | "bottom": 542.7833 102 | }, 103 | "pos": { 104 | "x": 147.39375, 105 | "y": 522.8969 106 | } 107 | }, 108 | { 109 | "text": "召开省网上办事大厅建设工作电视电话会议,会期半天。届时,省政", 110 | "location": { 111 | "left": 112.3, 112 | "top": 557.99066, 113 | "right": 677.3094, 114 | "bottom": 577.8771 115 | }, 116 | "pos": { 117 | "x": 112.3, 118 | "y": 557.99066 119 | } 120 | }, 121 | { 122 | "text": "府有关领导同志将出席会议并讲话。现将有关事项通知如下:", 123 | "location": { 124 | "left": 111.10136, 125 | "top": 591.97626, 126 | "right": 612.9943, 127 | "bottom": 613.03827 128 | }, 129 | "pos": { 130 | "x": 111.10136, 131 | "y": 593.2341 132 | } 133 | }, 134 | { 135 | "text": "一、会议内容", 136 | "location": { 137 | "left": 148.41713, 138 | "top": 627.1675, 139 | "right": 264.52795, 140 | "bottom": 648.4815 141 | }, 142 | "pos": { 143 | "x": 148.41713, 144 | "y": 628.8962 145 | } 146 | }, 147 | { 148 | "text": "总结前一阶段我省网上办事大厅建设情况,分析工作中存在的主", 149 | "location": { 150 | "left": 148.56355, 151 | "top": 662.1021, 152 | "right": 678.4792, 153 | "bottom": 681.9886 154 | }, 155 | "pos": { 156 | "x": 148.56355, 157 | "y": 662.1021 158 | } 159 | }, 160 | { 161 | "text": "要问题,部署2013年省网上办事大厅建设工作", 162 | "location": { 163 | "left": 111.13021, 164 | "top": 697.19586, 165 | "right": 503.01044, 166 | "bottom": 715.91254 167 | }, 168 | "pos": { 169 | "x": 111.13021, 170 | "y": 697.19586 171 | } 172 | }, 173 | { 174 | "text": "二、会议地点", 175 | "location": { 176 | "left": 149.73334, 177 | "top": 731.1198, 178 | "right": 265.54272, 179 | "bottom": 752.1761 180 | }, 181 | "pos": { 182 | "x": 149.73334, 183 | "y": 731.1198 184 | } 185 | }, 186 | { 187 | "text": "省主会场设在省政府2号楼一楼迎宾厅。各地级以上市、顺德区", 188 | "location": { 189 | "left": 148.53645, 190 | "top": 765.03284, 191 | "right": 678.50366, 192 | "bottom": 786.1408 193 | }, 194 | "pos": { 195 | "x": 148.53645, 196 | "y": 766.26807 197 | } 198 | }, 199 | { 200 | "text": "设分会场。", 201 | "location": { 202 | "left": 111.1302, 203 | "top": 801.30725, 204 | "right": 197.69476, 205 | "bottom": 821.1937 206 | }, 207 | "pos": { 208 | "x": 111.1302, 209 | "y": 801.30725 210 | } 211 | }, 212 | { 213 | "text": "三、参会人员", 214 | "location": { 215 | "left": 148.56355, 216 | "top": 834.0614, 217 | "right": 263.20312, 218 | "bottom": 857.4572 219 | }, 220 | "pos": { 221 | "x": 148.56355, 222 | "y": 834.0614 223 | } 224 | }, 225 | { 226 | "text": "(一)省主会场", 227 | "location": { 228 | "left": 153.2427, 229 | "top": 869.1552, 230 | "right": 285.42917, 231 | "bottom": 891.3813 232 | }, 233 | "pos": { 234 | "x": 153.2427, 235 | "y": 869.1552 236 | } 237 | } 238 | ] 239 | } -------------------------------------------------------------------------------- /img2pdf.cpp: -------------------------------------------------------------------------------- 1 | #include "img2pdf.h" 2 | #include "ui_img2pdf.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | img2pdf::img2pdf(QWidget *parent) : 10 | QDialog(parent), 11 | ui(new Ui::img2pdf) 12 | { 13 | ui->setupUi(this); 14 | } 15 | 16 | img2pdf::~img2pdf() 17 | { 18 | delete ui; 19 | } 20 | 21 | void img2pdf::on_selectImgBtn_clicked() 22 | { 23 | m_imgpath = QFileDialog::getOpenFileName(this, tr("打开"), tr(""), tr("图像文件(*.png *.jpg)")); 24 | if (m_imgpath.isEmpty()) 25 | { 26 | return; 27 | } 28 | ui->imgpathEdit->setText(m_imgpath); 29 | } 30 | 31 | void img2pdf::on_save2Btn_clicked() 32 | { 33 | QString save2 = QFileDialog::getSaveFileName(this, tr("Save File"), 34 | "", 35 | tr("版式文件(*.pdf *.ofd)")); 36 | ui->dstpathEdit->setText(save2); 37 | QFileInfo file(save2); 38 | if(file.exists()){ 39 | ; 40 | }else{ 41 | XILOU_PACKAGE pkg = NULL; 42 | 43 | int iret = xilou_AppendImagePage(&pkg, m_imgpath.toUtf8().data()); 44 | if(iret != 0) 45 | { 46 | QString msg=QString(tr("插入图片错误: %1")).arg(iret); 47 | QMessageBox::warning(this, "Error", msg); 48 | return; 49 | } 50 | if(!m_txtpath.isEmpty()){ 51 | QFile jsonFile(m_txtpath); 52 | if(jsonFile.open(QIODevice::ReadOnly|QIODevice::Text)){ 53 | QByteArray ba = jsonFile.readAll(); 54 | iret = xilou_AddTextOnPage(pkg, 0, ba.data()); 55 | if(iret != 0){ 56 | QString msg=QString(tr("插入文字错误: %1")).arg(iret); 57 | QMessageBox::warning(this, "Error", msg); 58 | } 59 | }else{ 60 | QString msg=QString(tr("读取文件错误: %1")).arg(m_txtpath); 61 | QMessageBox::warning(this, "Error", msg); 62 | } 63 | 64 | } 65 | iret = xilou_Save2File(&pkg, save2.toUtf8().data()); 66 | if(pkg){ 67 | xilou_ClosePackage(pkg); 68 | } 69 | if(iret != 0) 70 | { 71 | QString msg=QString(tr("保存文件: %1")).arg(iret); 72 | QMessageBox::warning(this, "Error", msg); 73 | return; 74 | } 75 | QMessageBox::warning(this, "Suc", tr("转换成功")); 76 | } 77 | 78 | } 79 | 80 | void img2pdf::on_selectTextBtn_clicked() 81 | { 82 | m_txtpath = QFileDialog::getOpenFileName(this, tr("打开"), tr(""), tr("文本文件(*.json)")); 83 | if (m_txtpath.isEmpty()) 84 | { 85 | return; 86 | } 87 | ui->textpathEdit->setText(m_txtpath); 88 | } 89 | -------------------------------------------------------------------------------- /img2pdf.h: -------------------------------------------------------------------------------- 1 | #ifndef IMG2PDF_H 2 | #define IMG2PDF_H 3 | 4 | #include 5 | #include 6 | namespace Ui { 7 | class img2pdf; 8 | } 9 | 10 | class img2pdf : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit img2pdf(QWidget *parent = 0); 16 | ~img2pdf(); 17 | 18 | private slots: 19 | void on_selectImgBtn_clicked(); 20 | 21 | void on_save2Btn_clicked(); 22 | 23 | void on_selectTextBtn_clicked(); 24 | 25 | private: 26 | Ui::img2pdf *ui; 27 | QString m_imgpath; 28 | QString m_txtpath; 29 | }; 30 | 31 | #endif // IMG2PDF_H 32 | -------------------------------------------------------------------------------- /img2pdf.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | img2pdf 4 | 5 | 6 | 7 | 0 8 | 0 9 | 449 10 | 300 11 | 12 | 13 | 14 | 15 | 400 16 | 300 17 | 18 | 19 | 20 | Dialog 21 | 22 | 23 | 24 | 25 | 30 26 | 240 27 | 341 28 | 32 29 | 30 | 31 | 32 | Qt::Horizontal 33 | 34 | 35 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 36 | 37 | 38 | 39 | 40 | 41 | 20 42 | 39 43 | 381 44 | 121 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 250 53 | 0 54 | 55 | 56 | 57 | true 58 | 59 | 60 | 61 | 62 | 63 | 64 | 选择图像 65 | 66 | 67 | 68 | 69 | 70 | 71 | Qt::Horizontal 72 | 73 | 74 | 75 | 40 76 | 20 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | true 85 | 86 | 87 | 88 | 89 | 90 | 91 | Qt::Horizontal 92 | 93 | 94 | 95 | 40 96 | 20 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 插入文件 105 | 106 | 107 | 108 | 109 | 110 | 111 | 选择文本 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | Qt::Horizontal 122 | 123 | 124 | 125 | 40 126 | 20 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | buttonBox 138 | accepted() 139 | img2pdf 140 | accept() 141 | 142 | 143 | 248 144 | 254 145 | 146 | 147 | 157 148 | 274 149 | 150 | 151 | 152 | 153 | buttonBox 154 | rejected() 155 | img2pdf 156 | reject() 157 | 158 | 159 | 316 160 | 260 161 | 162 | 163 | 286 164 | 274 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /include/public/DEPS: -------------------------------------------------------------------------------- 1 | include_rules = [ 2 | # public/ needs to be standalone. Explicitly disallow everything. 3 | '-core', 4 | '-fpdfsdk', 5 | '-testing', 6 | '-third_party', 7 | '-v8', 8 | ] 9 | -------------------------------------------------------------------------------- /include/public/PRESUBMIT.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The PDFium Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | """Presubmit script for pdfium. 6 | 7 | See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 8 | for more details about the presubmit API built into depot_tools. 9 | """ 10 | 11 | USE_PYTHON3 = True 12 | 13 | 14 | def _CheckPublicHeaders(input_api, output_api): 15 | """Checks that the public headers match the API tests.""" 16 | src_path = input_api.os_path.dirname(input_api.PresubmitLocalPath()) 17 | check_script = input_api.os_path.join( 18 | src_path, 'testing' , 'tools' , 'api_check.py') 19 | cmd = [input_api.python_executable, check_script] 20 | try: 21 | input_api.subprocess.check_output(cmd) 22 | return [] 23 | except input_api.subprocess.CalledProcessError as error: 24 | return [output_api.PresubmitError('api_check.py failed:', 25 | long_text=error.output)] 26 | 27 | 28 | def CheckChangeOnUpload(input_api, output_api): 29 | results = [] 30 | results.extend(_CheckPublicHeaders(input_api, output_api)) 31 | return results 32 | 33 | 34 | def CheckChangeOnCommit(input_api, output_api): 35 | results = [] 36 | results.extend(_CheckPublicHeaders(input_api, output_api)) 37 | return results 38 | -------------------------------------------------------------------------------- /include/public/README: -------------------------------------------------------------------------------- 1 | public/ README 2 | 3 | The header files in this directory are the only ones that should ever be 4 | included by an embedder of PDFium. If there arises a need for functionality 5 | beyond what is present here, then a new API must be added here to provide it. 6 | 7 | These header files must be entirely contained in this directory; they must 8 | never include other header files from outside of it. 9 | 10 | These files must compile cleanly without warnings on both C and C++ compilers. 11 | 12 | Changes to these files must be carefully considered to avoid breaking 13 | compatibility. 14 | -------------------------------------------------------------------------------- /include/public/cpp/fpdf_deleters.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef PUBLIC_CPP_FPDF_DELETERS_H_ 6 | #define PUBLIC_CPP_FPDF_DELETERS_H_ 7 | 8 | #include "public/fpdf_annot.h" 9 | #include "public/fpdf_dataavail.h" 10 | #include "public/fpdf_edit.h" 11 | #include "public/fpdf_formfill.h" 12 | #include "public/fpdf_javascript.h" 13 | #include "public/fpdf_structtree.h" 14 | #include "public/fpdf_text.h" 15 | #include "public/fpdf_transformpage.h" 16 | #include "public/fpdfview.h" 17 | 18 | // Custom deleters for using FPDF_* types with std::unique_ptr<>. 19 | 20 | struct FPDFAnnotationDeleter { 21 | inline void operator()(FPDF_ANNOTATION annot) { FPDFPage_CloseAnnot(annot); } 22 | }; 23 | 24 | struct FPDFAvailDeleter { 25 | inline void operator()(FPDF_AVAIL avail) { FPDFAvail_Destroy(avail); } 26 | }; 27 | 28 | struct FPDFBitmapDeleter { 29 | inline void operator()(FPDF_BITMAP bitmap) { FPDFBitmap_Destroy(bitmap); } 30 | }; 31 | 32 | struct FPDFClipPathDeleter { 33 | inline void operator()(FPDF_CLIPPATH clip_path) { 34 | FPDF_DestroyClipPath(clip_path); 35 | } 36 | }; 37 | 38 | struct FPDFDocumentDeleter { 39 | inline void operator()(FPDF_DOCUMENT doc) { FPDF_CloseDocument(doc); } 40 | }; 41 | 42 | struct FPDFFontDeleter { 43 | inline void operator()(FPDF_FONT font) { FPDFFont_Close(font); } 44 | }; 45 | 46 | struct FPDFFormHandleDeleter { 47 | inline void operator()(FPDF_FORMHANDLE form) { 48 | FPDFDOC_ExitFormFillEnvironment(form); 49 | } 50 | }; 51 | 52 | struct FPDFJavaScriptActionDeleter { 53 | inline void operator()(FPDF_JAVASCRIPT_ACTION javascript) { 54 | FPDFDoc_CloseJavaScriptAction(javascript); 55 | } 56 | }; 57 | 58 | struct FPDFPageDeleter { 59 | inline void operator()(FPDF_PAGE page) { FPDF_ClosePage(page); } 60 | }; 61 | 62 | struct FPDFPageLinkDeleter { 63 | inline void operator()(FPDF_PAGELINK pagelink) { 64 | FPDFLink_CloseWebLinks(pagelink); 65 | } 66 | }; 67 | 68 | struct FPDFPageObjectDeleter { 69 | inline void operator()(FPDF_PAGEOBJECT object) { 70 | FPDFPageObj_Destroy(object); 71 | } 72 | }; 73 | 74 | struct FPDFStructTreeDeleter { 75 | inline void operator()(FPDF_STRUCTTREE tree) { FPDF_StructTree_Close(tree); } 76 | }; 77 | 78 | struct FPDFTextFindDeleter { 79 | inline void operator()(FPDF_SCHHANDLE handle) { FPDFText_FindClose(handle); } 80 | }; 81 | 82 | struct FPDFTextPageDeleter { 83 | inline void operator()(FPDF_TEXTPAGE text) { FPDFText_ClosePage(text); } 84 | }; 85 | 86 | #endif // PUBLIC_CPP_FPDF_DELETERS_H_ 87 | -------------------------------------------------------------------------------- /include/public/cpp/fpdf_scopers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef PUBLIC_CPP_FPDF_SCOPERS_H_ 6 | #define PUBLIC_CPP_FPDF_SCOPERS_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "public/cpp/fpdf_deleters.h" 12 | 13 | // Versions of FPDF types that clean up the object at scope exit. 14 | 15 | using ScopedFPDFAnnotation = 16 | std::unique_ptr::type, 17 | FPDFAnnotationDeleter>; 18 | 19 | using ScopedFPDFAvail = 20 | std::unique_ptr::type, FPDFAvailDeleter>; 21 | 22 | using ScopedFPDFBitmap = 23 | std::unique_ptr::type, FPDFBitmapDeleter>; 24 | 25 | using ScopedFPDFClipPath = 26 | std::unique_ptr::type, 27 | FPDFClipPathDeleter>; 28 | 29 | using ScopedFPDFDocument = 30 | std::unique_ptr::type, 31 | FPDFDocumentDeleter>; 32 | 33 | using ScopedFPDFFont = 34 | std::unique_ptr::type, FPDFFontDeleter>; 35 | 36 | using ScopedFPDFFormHandle = 37 | std::unique_ptr::type, 38 | FPDFFormHandleDeleter>; 39 | 40 | using ScopedFPDFJavaScriptAction = 41 | std::unique_ptr::type, 42 | FPDFJavaScriptActionDeleter>; 43 | 44 | using ScopedFPDFPage = 45 | std::unique_ptr::type, FPDFPageDeleter>; 46 | 47 | using ScopedFPDFPageLink = 48 | std::unique_ptr::type, 49 | FPDFPageLinkDeleter>; 50 | 51 | using ScopedFPDFPageObject = 52 | std::unique_ptr::type, 53 | FPDFPageObjectDeleter>; 54 | 55 | using ScopedFPDFStructTree = 56 | std::unique_ptr::type, 57 | FPDFStructTreeDeleter>; 58 | 59 | using ScopedFPDFTextFind = 60 | std::unique_ptr::type, 61 | FPDFTextFindDeleter>; 62 | 63 | using ScopedFPDFTextPage = 64 | std::unique_ptr::type, 65 | FPDFTextPageDeleter>; 66 | 67 | #endif // PUBLIC_CPP_FPDF_SCOPERS_H_ 68 | -------------------------------------------------------------------------------- /include/public/fpdf_attachment.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef PUBLIC_FPDF_ATTACHMENT_H_ 6 | #define PUBLIC_FPDF_ATTACHMENT_H_ 7 | 8 | // NOLINTNEXTLINE(build/include) 9 | #include "fpdfview.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif // __cplusplus 14 | 15 | // Experimental API. 16 | // Get the number of embedded files in |document|. 17 | // 18 | // document - handle to a document. 19 | // 20 | // Returns the number of embedded files in |document|. 21 | FPDF_EXPORT int FPDF_CALLCONV 22 | FPDFDoc_GetAttachmentCount(FPDF_DOCUMENT document); 23 | 24 | // Experimental API. 25 | // Add an embedded file with |name| in |document|. If |name| is empty, or if 26 | // |name| is the name of a existing embedded file in |document|, or if 27 | // |document|'s embedded file name tree is too deep (i.e. |document| has too 28 | // many embedded files already), then a new attachment will not be added. 29 | // 30 | // document - handle to a document. 31 | // name - name of the new attachment. 32 | // 33 | // Returns a handle to the new attachment object, or NULL on failure. 34 | FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV 35 | FPDFDoc_AddAttachment(FPDF_DOCUMENT document, FPDF_WIDESTRING name); 36 | 37 | // Experimental API. 38 | // Get the embedded attachment at |index| in |document|. Note that the returned 39 | // attachment handle is only valid while |document| is open. 40 | // 41 | // document - handle to a document. 42 | // index - the index of the requested embedded file. 43 | // 44 | // Returns the handle to the attachment object, or NULL on failure. 45 | FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV 46 | FPDFDoc_GetAttachment(FPDF_DOCUMENT document, int index); 47 | 48 | // Experimental API. 49 | // Delete the embedded attachment at |index| in |document|. Note that this does 50 | // not remove the attachment data from the PDF file; it simply removes the 51 | // file's entry in the embedded files name tree so that it does not appear in 52 | // the attachment list. This behavior may change in the future. 53 | // 54 | // document - handle to a document. 55 | // index - the index of the embedded file to be deleted. 56 | // 57 | // Returns true if successful. 58 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 59 | FPDFDoc_DeleteAttachment(FPDF_DOCUMENT document, int index); 60 | 61 | // Experimental API. 62 | // Get the name of the |attachment| file. |buffer| is only modified if |buflen| 63 | // is longer than the length of the file name. On errors, |buffer| is unmodified 64 | // and the returned length is 0. 65 | // 66 | // attachment - handle to an attachment. 67 | // buffer - buffer for holding the file name, encoded in UTF-16LE. 68 | // buflen - length of the buffer in bytes. 69 | // 70 | // Returns the length of the file name in bytes. 71 | FPDF_EXPORT unsigned long FPDF_CALLCONV 72 | FPDFAttachment_GetName(FPDF_ATTACHMENT attachment, 73 | FPDF_WCHAR* buffer, 74 | unsigned long buflen); 75 | 76 | // Experimental API. 77 | // Check if the params dictionary of |attachment| has |key| as a key. 78 | // 79 | // attachment - handle to an attachment. 80 | // key - the key to look for, encoded in UTF-8. 81 | // 82 | // Returns true if |key| exists. 83 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 84 | FPDFAttachment_HasKey(FPDF_ATTACHMENT attachment, FPDF_BYTESTRING key); 85 | 86 | // Experimental API. 87 | // Get the type of the value corresponding to |key| in the params dictionary of 88 | // the embedded |attachment|. 89 | // 90 | // attachment - handle to an attachment. 91 | // key - the key to look for, encoded in UTF-8. 92 | // 93 | // Returns the type of the dictionary value. 94 | FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV 95 | FPDFAttachment_GetValueType(FPDF_ATTACHMENT attachment, FPDF_BYTESTRING key); 96 | 97 | // Experimental API. 98 | // Set the string value corresponding to |key| in the params dictionary of the 99 | // embedded file |attachment|, overwriting the existing value if any. The value 100 | // type should be FPDF_OBJECT_STRING after this function call succeeds. 101 | // 102 | // attachment - handle to an attachment. 103 | // key - the key to the dictionary entry, encoded in UTF-8. 104 | // value - the string value to be set, encoded in UTF-16LE. 105 | // 106 | // Returns true if successful. 107 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 108 | FPDFAttachment_SetStringValue(FPDF_ATTACHMENT attachment, 109 | FPDF_BYTESTRING key, 110 | FPDF_WIDESTRING value); 111 | 112 | // Experimental API. 113 | // Get the string value corresponding to |key| in the params dictionary of the 114 | // embedded file |attachment|. |buffer| is only modified if |buflen| is longer 115 | // than the length of the string value. Note that if |key| does not exist in the 116 | // dictionary or if |key|'s corresponding value in the dictionary is not a 117 | // string (i.e. the value is not of type FPDF_OBJECT_STRING or 118 | // FPDF_OBJECT_NAME), then an empty string would be copied to |buffer| and the 119 | // return value would be 2. On other errors, nothing would be added to |buffer| 120 | // and the return value would be 0. 121 | // 122 | // attachment - handle to an attachment. 123 | // key - the key to the requested string value, encoded in UTF-8. 124 | // buffer - buffer for holding the string value encoded in UTF-16LE. 125 | // buflen - length of the buffer in bytes. 126 | // 127 | // Returns the length of the dictionary value string in bytes. 128 | FPDF_EXPORT unsigned long FPDF_CALLCONV 129 | FPDFAttachment_GetStringValue(FPDF_ATTACHMENT attachment, 130 | FPDF_BYTESTRING key, 131 | FPDF_WCHAR* buffer, 132 | unsigned long buflen); 133 | 134 | // Experimental API. 135 | // Set the file data of |attachment|, overwriting the existing file data if any. 136 | // The creation date and checksum will be updated, while all other dictionary 137 | // entries will be deleted. Note that only contents with |len| smaller than 138 | // INT_MAX is supported. 139 | // 140 | // attachment - handle to an attachment. 141 | // contents - buffer holding the file data to write to |attachment|. 142 | // len - length of file data in bytes. 143 | // 144 | // Returns true if successful. 145 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 146 | FPDFAttachment_SetFile(FPDF_ATTACHMENT attachment, 147 | FPDF_DOCUMENT document, 148 | const void* contents, 149 | unsigned long len); 150 | 151 | // Experimental API. 152 | // Get the file data of |attachment|. 153 | // When the attachment file data is readable, true is returned, and |out_buflen| 154 | // is updated to indicate the file data size. |buffer| is only modified if 155 | // |buflen| is non-null and long enough to contain the entire file data. Callers 156 | // must check both the return value and the input |buflen| is no less than the 157 | // returned |out_buflen| before using the data. 158 | // 159 | // Otherwise, when the attachment file data is unreadable or when |out_buflen| 160 | // is null, false is returned and |buffer| and |out_buflen| remain unmodified. 161 | // 162 | // attachment - handle to an attachment. 163 | // buffer - buffer for holding the file data from |attachment|. 164 | // buflen - length of the buffer in bytes. 165 | // out_buflen - pointer to the variable that will receive the minimum buffer 166 | // size to contain the file data of |attachment|. 167 | // 168 | // Returns true on success, false otherwise. 169 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 170 | FPDFAttachment_GetFile(FPDF_ATTACHMENT attachment, 171 | void* buffer, 172 | unsigned long buflen, 173 | unsigned long* out_buflen); 174 | 175 | #ifdef __cplusplus 176 | } // extern "C" 177 | #endif // __cplusplus 178 | 179 | #endif // PUBLIC_FPDF_ATTACHMENT_H_ 180 | -------------------------------------------------------------------------------- /include/public/fpdf_catalog.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef PUBLIC_FPDF_CATALOG_H_ 6 | #define PUBLIC_FPDF_CATALOG_H_ 7 | 8 | // NOLINTNEXTLINE(build/include) 9 | #include "fpdfview.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif // __cplusplus 14 | 15 | /** 16 | * Experimental API. 17 | * 18 | * Determine if |document| represents a tagged PDF. 19 | * 20 | * For the definition of tagged PDF, See (see 10.7 "Tagged PDF" in PDF 21 | * Reference 1.7). 22 | * 23 | * document - handle to a document. 24 | * 25 | * Returns |true| iff |document| is a tagged PDF. 26 | */ 27 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 28 | FPDFCatalog_IsTagged(FPDF_DOCUMENT document); 29 | 30 | #ifdef __cplusplus 31 | } // extern "C" 32 | #endif // __cplusplus 33 | 34 | #endif // PUBLIC_FPDF_CATALOG_H_ 35 | -------------------------------------------------------------------------------- /include/public/fpdf_dataavail.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_DATAAVAIL_H_ 8 | #define PUBLIC_FPDF_DATAAVAIL_H_ 9 | 10 | #include 11 | 12 | // NOLINTNEXTLINE(build/include) 13 | #include "fpdfview.h" 14 | 15 | #define PDF_LINEARIZATION_UNKNOWN -1 16 | #define PDF_NOT_LINEARIZED 0 17 | #define PDF_LINEARIZED 1 18 | 19 | #define PDF_DATA_ERROR -1 20 | #define PDF_DATA_NOTAVAIL 0 21 | #define PDF_DATA_AVAIL 1 22 | 23 | #define PDF_FORM_ERROR -1 24 | #define PDF_FORM_NOTAVAIL 0 25 | #define PDF_FORM_AVAIL 1 26 | #define PDF_FORM_NOTEXIST 2 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | // Interface for checking whether sections of the file are available. 33 | typedef struct _FX_FILEAVAIL { 34 | // Version number of the interface. Must be 1. 35 | int version; 36 | 37 | // Reports if the specified data section is currently available. A section is 38 | // available if all bytes in the section are available. 39 | // 40 | // Interface Version: 1 41 | // Implementation Required: Yes 42 | // 43 | // pThis - pointer to the interface structure. 44 | // offset - the offset of the data section in the file. 45 | // size - the size of the data section. 46 | // 47 | // Returns true if the specified data section at |offset| of |size| 48 | // is available. 49 | FPDF_BOOL (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, 50 | size_t offset, 51 | size_t size); 52 | } FX_FILEAVAIL; 53 | 54 | // Create a document availability provider. 55 | // 56 | // file_avail - pointer to file availability interface. 57 | // file - pointer to a file access interface. 58 | // 59 | // Returns a handle to the document availability provider, or NULL on error. 60 | // 61 | // FPDFAvail_Destroy() must be called when done with the availability provider. 62 | FPDF_EXPORT FPDF_AVAIL FPDF_CALLCONV FPDFAvail_Create(FX_FILEAVAIL* file_avail, 63 | FPDF_FILEACCESS* file); 64 | 65 | // Destroy the |avail| document availability provider. 66 | // 67 | // avail - handle to document availability provider to be destroyed. 68 | FPDF_EXPORT void FPDF_CALLCONV FPDFAvail_Destroy(FPDF_AVAIL avail); 69 | 70 | // Download hints interface. Used to receive hints for further downloading. 71 | typedef struct _FX_DOWNLOADHINTS { 72 | // Version number of the interface. Must be 1. 73 | int version; 74 | 75 | // Add a section to be downloaded. 76 | // 77 | // Interface Version: 1 78 | // Implementation Required: Yes 79 | // 80 | // pThis - pointer to the interface structure. 81 | // offset - the offset of the hint reported to be downloaded. 82 | // size - the size of the hint reported to be downloaded. 83 | // 84 | // The |offset| and |size| of the section may not be unique. Part of the 85 | // section might be already available. The download manager must deal with 86 | // overlapping sections. 87 | void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis, 88 | size_t offset, 89 | size_t size); 90 | } FX_DOWNLOADHINTS; 91 | 92 | // Checks if the document is ready for loading, if not, gets download hints. 93 | // 94 | // avail - handle to document availability provider. 95 | // hints - pointer to a download hints interface. 96 | // 97 | // Returns one of: 98 | // PDF_DATA_ERROR: A common error is returned. Data availability unknown. 99 | // PDF_DATA_NOTAVAIL: Data not yet available. 100 | // PDF_DATA_AVAIL: Data available. 101 | // 102 | // Applications should call this function whenever new data arrives, and process 103 | // all the generated download hints, if any, until the function returns 104 | // |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. 105 | // if hints is nullptr, the function just check current document availability. 106 | // 107 | // Once all data is available, call FPDFAvail_GetDocument() to get a document 108 | // handle. 109 | FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsDocAvail(FPDF_AVAIL avail, 110 | FX_DOWNLOADHINTS* hints); 111 | 112 | // Get document from the availability provider. 113 | // 114 | // avail - handle to document availability provider. 115 | // password - password for decrypting the PDF file. Optional. 116 | // 117 | // Returns a handle to the document. 118 | // 119 | // When FPDFAvail_IsDocAvail() returns TRUE, call FPDFAvail_GetDocument() to 120 | // retrieve the document handle. 121 | // See the comments for FPDF_LoadDocument() regarding the encoding for 122 | // |password|. 123 | FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV 124 | FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password); 125 | 126 | // Get the page number for the first available page in a linearized PDF. 127 | // 128 | // doc - document handle. 129 | // 130 | // Returns the zero-based index for the first available page. 131 | // 132 | // For most linearized PDFs, the first available page will be the first page, 133 | // however, some PDFs might make another page the first available page. 134 | // For non-linearized PDFs, this function will always return zero. 135 | FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc); 136 | 137 | // Check if |page_index| is ready for loading, if not, get the 138 | // |FX_DOWNLOADHINTS|. 139 | // 140 | // avail - handle to document availability provider. 141 | // page_index - index number of the page. Zero for the first page. 142 | // hints - pointer to a download hints interface. Populated if 143 | // |page_index| is not available. 144 | // 145 | // Returns one of: 146 | // PDF_DATA_ERROR: A common error is returned. Data availability unknown. 147 | // PDF_DATA_NOTAVAIL: Data not yet available. 148 | // PDF_DATA_AVAIL: Data available. 149 | // 150 | // This function can be called only after FPDFAvail_GetDocument() is called. 151 | // Applications should call this function whenever new data arrives and process 152 | // all the generated download |hints|, if any, until this function returns 153 | // |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. Applications can then perform page 154 | // loading. 155 | // if hints is nullptr, the function just check current availability of 156 | // specified page. 157 | FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsPageAvail(FPDF_AVAIL avail, 158 | int page_index, 159 | FX_DOWNLOADHINTS* hints); 160 | 161 | // Check if form data is ready for initialization, if not, get the 162 | // |FX_DOWNLOADHINTS|. 163 | // 164 | // avail - handle to document availability provider. 165 | // hints - pointer to a download hints interface. Populated if form is not 166 | // ready for initialization. 167 | // 168 | // Returns one of: 169 | // PDF_FORM_ERROR: A common eror, in general incorrect parameters. 170 | // PDF_FORM_NOTAVAIL: Data not available. 171 | // PDF_FORM_AVAIL: Data available. 172 | // PDF_FORM_NOTEXIST: No form data. 173 | // 174 | // This function can be called only after FPDFAvail_GetDocument() is called. 175 | // The application should call this function whenever new data arrives and 176 | // process all the generated download |hints|, if any, until the function 177 | // |PDF_FORM_ERROR|, |PDF_FORM_AVAIL| or |PDF_FORM_NOTEXIST|. 178 | // if hints is nullptr, the function just check current form availability. 179 | // 180 | // Applications can then perform page loading. It is recommend to call 181 | // FPDFDOC_InitFormFillEnvironment() when |PDF_FORM_AVAIL| is returned. 182 | FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsFormAvail(FPDF_AVAIL avail, 183 | FX_DOWNLOADHINTS* hints); 184 | 185 | // Check whether a document is a linearized PDF. 186 | // 187 | // avail - handle to document availability provider. 188 | // 189 | // Returns one of: 190 | // PDF_LINEARIZED 191 | // PDF_NOT_LINEARIZED 192 | // PDF_LINEARIZATION_UNKNOWN 193 | // 194 | // FPDFAvail_IsLinearized() will return |PDF_LINEARIZED| or |PDF_NOT_LINEARIZED| 195 | // when we have 1k of data. If the files size less than 1k, it returns 196 | // |PDF_LINEARIZATION_UNKNOWN| as there is insufficient information to determine 197 | // if the PDF is linearlized. 198 | FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsLinearized(FPDF_AVAIL avail); 199 | 200 | #ifdef __cplusplus 201 | } // extern "C" 202 | #endif // __cplusplus 203 | 204 | #endif // PUBLIC_FPDF_DATAAVAIL_H_ 205 | -------------------------------------------------------------------------------- /include/public/fpdf_doc.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_DOC_H_ 8 | #define PUBLIC_FPDF_DOC_H_ 9 | 10 | // NOLINTNEXTLINE(build/include) 11 | #include "fpdfview.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif // __cplusplus 16 | 17 | // Unsupported action type. 18 | #define PDFACTION_UNSUPPORTED 0 19 | // Go to a destination within current document. 20 | #define PDFACTION_GOTO 1 21 | // Go to a destination within another document. 22 | #define PDFACTION_REMOTEGOTO 2 23 | // URI, including web pages and other Internet resources. 24 | #define PDFACTION_URI 3 25 | // Launch an application or open a file. 26 | #define PDFACTION_LAUNCH 4 27 | // Go to a destination in an embedded file. 28 | #define PDFACTION_EMBEDDEDGOTO 5 29 | 30 | // View destination fit types. See pdfmark reference v9, page 48. 31 | #define PDFDEST_VIEW_UNKNOWN_MODE 0 32 | #define PDFDEST_VIEW_XYZ 1 33 | #define PDFDEST_VIEW_FIT 2 34 | #define PDFDEST_VIEW_FITH 3 35 | #define PDFDEST_VIEW_FITV 4 36 | #define PDFDEST_VIEW_FITR 5 37 | #define PDFDEST_VIEW_FITB 6 38 | #define PDFDEST_VIEW_FITBH 7 39 | #define PDFDEST_VIEW_FITBV 8 40 | 41 | // The file identifier entry type. See section 14.4 "File Identifiers" of the 42 | // ISO 32000-1:2008 spec. 43 | typedef enum { 44 | FILEIDTYPE_PERMANENT = 0, 45 | FILEIDTYPE_CHANGING = 1 46 | } FPDF_FILEIDTYPE; 47 | 48 | typedef struct _FS_QUADPOINTSF { 49 | FS_FLOAT x1; 50 | FS_FLOAT y1; 51 | FS_FLOAT x2; 52 | FS_FLOAT y2; 53 | FS_FLOAT x3; 54 | FS_FLOAT y3; 55 | FS_FLOAT x4; 56 | FS_FLOAT y4; 57 | } FS_QUADPOINTSF; 58 | 59 | // Get the first child of |bookmark|, or the first top-level bookmark item. 60 | // 61 | // document - handle to the document. 62 | // bookmark - handle to the current bookmark. Pass NULL for the first top 63 | // level item. 64 | // 65 | // Returns a handle to the first child of |bookmark| or the first top-level 66 | // bookmark item. NULL if no child or top-level bookmark found. 67 | FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV 68 | FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); 69 | 70 | // Get the next sibling of |bookmark|. 71 | // 72 | // document - handle to the document. 73 | // bookmark - handle to the current bookmark. 74 | // 75 | // Returns a handle to the next sibling of |bookmark|, or NULL if this is the 76 | // last bookmark at this level. 77 | FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV 78 | FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); 79 | 80 | // Get the title of |bookmark|. 81 | // 82 | // bookmark - handle to the bookmark. 83 | // buffer - buffer for the title. May be NULL. 84 | // buflen - the length of the buffer in bytes. May be 0. 85 | // 86 | // Returns the number of bytes in the title, including the terminating NUL 87 | // character. The number of bytes is returned regardless of the |buffer| and 88 | // |buflen| parameters. 89 | // 90 | // Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The 91 | // string is terminated by a UTF16 NUL character. If |buflen| is less than the 92 | // required length, or |buffer| is NULL, |buffer| will not be modified. 93 | FPDF_EXPORT unsigned long FPDF_CALLCONV 94 | FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, 95 | void* buffer, 96 | unsigned long buflen); 97 | 98 | // Find the bookmark with |title| in |document|. 99 | // 100 | // document - handle to the document. 101 | // title - the UTF-16LE encoded Unicode title for which to search. 102 | // 103 | // Returns the handle to the bookmark, or NULL if |title| can't be found. 104 | // 105 | // FPDFBookmark_Find() will always return the first bookmark found even if 106 | // multiple bookmarks have the same |title|. 107 | FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV 108 | FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title); 109 | 110 | // Get the destination associated with |bookmark|. 111 | // 112 | // document - handle to the document. 113 | // bookmark - handle to the bookmark. 114 | // 115 | // Returns the handle to the destination data, or NULL if no destination is 116 | // associated with |bookmark|. 117 | FPDF_EXPORT FPDF_DEST FPDF_CALLCONV 118 | FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); 119 | 120 | // Get the action associated with |bookmark|. 121 | // 122 | // bookmark - handle to the bookmark. 123 | // 124 | // Returns the handle to the action data, or NULL if no action is associated 125 | // with |bookmark|. 126 | // If this function returns a valid handle, it is valid as long as |bookmark| is 127 | // valid. 128 | // If this function returns NULL, FPDFBookmark_GetDest() should be called to get 129 | // the |bookmark| destination data. 130 | FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV 131 | FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark); 132 | 133 | // Get the type of |action|. 134 | // 135 | // action - handle to the action. 136 | // 137 | // Returns one of: 138 | // PDFACTION_UNSUPPORTED 139 | // PDFACTION_GOTO 140 | // PDFACTION_REMOTEGOTO 141 | // PDFACTION_URI 142 | // PDFACTION_LAUNCH 143 | FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION action); 144 | 145 | // Get the destination of |action|. 146 | // 147 | // document - handle to the document. 148 | // action - handle to the action. |action| must be a |PDFACTION_GOTO| or 149 | // |PDFACTION_REMOTEGOTO|. 150 | // 151 | // Returns a handle to the destination data, or NULL on error, typically 152 | // because the arguments were bad or the action was of the wrong type. 153 | // 154 | // In the case of |PDFACTION_REMOTEGOTO|, you must first call 155 | // FPDFAction_GetFilePath(), then load the document at that path, then pass 156 | // the document handle from that document as |document| to FPDFAction_GetDest(). 157 | FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document, 158 | FPDF_ACTION action); 159 | 160 | // Get the file path of |action|. 161 | // 162 | // action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or 163 | // |PDFACTION_REMOTEGOTO|. 164 | // buffer - a buffer for output the path string. May be NULL. 165 | // buflen - the length of the buffer, in bytes. May be 0. 166 | // 167 | // Returns the number of bytes in the file path, including the trailing NUL 168 | // character, or 0 on error, typically because the arguments were bad or the 169 | // action was of the wrong type. 170 | // 171 | // Regardless of the platform, the |buffer| is always in UTF-8 encoding. 172 | // If |buflen| is less than the returned length, or |buffer| is NULL, |buffer| 173 | // will not be modified. 174 | FPDF_EXPORT unsigned long FPDF_CALLCONV 175 | FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen); 176 | 177 | // Get the URI path of |action|. 178 | // 179 | // document - handle to the document. 180 | // action - handle to the action. Must be a |PDFACTION_URI|. 181 | // buffer - a buffer for the path string. May be NULL. 182 | // buflen - the length of the buffer, in bytes. May be 0. 183 | // 184 | // Returns the number of bytes in the URI path, including the trailing NUL 185 | // character, or 0 on error, typically because the arguments were bad or the 186 | // action was of the wrong type. 187 | // 188 | // The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less than the 189 | // returned length, or |buffer| is NULL, |buffer| will not be modified. 190 | FPDF_EXPORT unsigned long FPDF_CALLCONV 191 | FPDFAction_GetURIPath(FPDF_DOCUMENT document, 192 | FPDF_ACTION action, 193 | void* buffer, 194 | unsigned long buflen); 195 | 196 | // Get the page index of |dest|. 197 | // 198 | // document - handle to the document. 199 | // dest - handle to the destination. 200 | // 201 | // Returns the 0-based page index containing |dest|. Returns -1 on error. 202 | FPDF_EXPORT int FPDF_CALLCONV FPDFDest_GetDestPageIndex(FPDF_DOCUMENT document, 203 | FPDF_DEST dest); 204 | 205 | // Experimental API. 206 | // Get the view (fit type) specified by |dest|. 207 | // 208 | // dest - handle to the destination. 209 | // pNumParams - receives the number of view parameters, which is at most 4. 210 | // pParams - buffer to write the view parameters. Must be at least 4 211 | // FS_FLOATs long. 212 | // Returns one of the PDFDEST_VIEW_* constants, PDFDEST_VIEW_UNKNOWN_MODE if 213 | // |dest| does not specify a view. 214 | FPDF_EXPORT unsigned long FPDF_CALLCONV 215 | FPDFDest_GetView(FPDF_DEST dest, unsigned long* pNumParams, FS_FLOAT* pParams); 216 | 217 | // Get the (x, y, zoom) location of |dest| in the destination page, if the 218 | // destination is in [page /XYZ x y zoom] syntax. 219 | // 220 | // dest - handle to the destination. 221 | // hasXVal - out parameter; true if the x value is not null 222 | // hasYVal - out parameter; true if the y value is not null 223 | // hasZoomVal - out parameter; true if the zoom value is not null 224 | // x - out parameter; the x coordinate, in page coordinates. 225 | // y - out parameter; the y coordinate, in page coordinates. 226 | // zoom - out parameter; the zoom value. 227 | // Returns TRUE on successfully reading the /XYZ value. 228 | // 229 | // Note the [x, y, zoom] values are only set if the corresponding hasXVal, 230 | // hasYVal or hasZoomVal flags are true. 231 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 232 | FPDFDest_GetLocationInPage(FPDF_DEST dest, 233 | FPDF_BOOL* hasXVal, 234 | FPDF_BOOL* hasYVal, 235 | FPDF_BOOL* hasZoomVal, 236 | FS_FLOAT* x, 237 | FS_FLOAT* y, 238 | FS_FLOAT* zoom); 239 | 240 | // Find a link at point (|x|,|y|) on |page|. 241 | // 242 | // page - handle to the document page. 243 | // x - the x coordinate, in the page coordinate system. 244 | // y - the y coordinate, in the page coordinate system. 245 | // 246 | // Returns a handle to the link, or NULL if no link found at the given point. 247 | // 248 | // You can convert coordinates from screen coordinates to page coordinates using 249 | // FPDF_DeviceToPage(). 250 | FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFLink_GetLinkAtPoint(FPDF_PAGE page, 251 | double x, 252 | double y); 253 | 254 | // Find the Z-order of link at point (|x|,|y|) on |page|. 255 | // 256 | // page - handle to the document page. 257 | // x - the x coordinate, in the page coordinate system. 258 | // y - the y coordinate, in the page coordinate system. 259 | // 260 | // Returns the Z-order of the link, or -1 if no link found at the given point. 261 | // Larger Z-order numbers are closer to the front. 262 | // 263 | // You can convert coordinates from screen coordinates to page coordinates using 264 | // FPDF_DeviceToPage(). 265 | FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, 266 | double x, 267 | double y); 268 | 269 | // Get destination info for |link|. 270 | // 271 | // document - handle to the document. 272 | // link - handle to the link. 273 | // 274 | // Returns a handle to the destination, or NULL if there is no destination 275 | // associated with the link. In this case, you should call FPDFLink_GetAction() 276 | // to retrieve the action associated with |link|. 277 | FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document, 278 | FPDF_LINK link); 279 | 280 | // Get action info for |link|. 281 | // 282 | // link - handle to the link. 283 | // 284 | // Returns a handle to the action associated to |link|, or NULL if no action. 285 | // If this function returns a valid handle, it is valid as long as |link| is 286 | // valid. 287 | FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK link); 288 | 289 | // Enumerates all the link annotations in |page|. 290 | // 291 | // page - handle to the page. 292 | // start_pos - the start position, should initially be 0 and is updated with 293 | // the next start position on return. 294 | // link_annot - the link handle for |startPos|. 295 | // 296 | // Returns TRUE on success. 297 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page, 298 | int* start_pos, 299 | FPDF_LINK* link_annot); 300 | 301 | // Experimental API. 302 | // Gets FPDF_ANNOTATION object for |link_annot|. 303 | // 304 | // page - handle to the page in which FPDF_LINK object is present. 305 | // link_annot - handle to link annotation. 306 | // 307 | // Returns FPDF_ANNOTATION from the FPDF_LINK and NULL on failure, 308 | // if the input link annot or page is NULL. 309 | FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV 310 | FPDFLink_GetAnnot(FPDF_PAGE page, FPDF_LINK link_annot); 311 | 312 | // Get the rectangle for |link_annot|. 313 | // 314 | // link_annot - handle to the link annotation. 315 | // rect - the annotation rectangle. 316 | // 317 | // Returns true on success. 318 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetAnnotRect(FPDF_LINK link_annot, 319 | FS_RECTF* rect); 320 | 321 | // Get the count of quadrilateral points to the |link_annot|. 322 | // 323 | // link_annot - handle to the link annotation. 324 | // 325 | // Returns the count of quadrilateral points. 326 | FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountQuadPoints(FPDF_LINK link_annot); 327 | 328 | // Get the quadrilateral points for the specified |quad_index| in |link_annot|. 329 | // 330 | // link_annot - handle to the link annotation. 331 | // quad_index - the specified quad point index. 332 | // quad_points - receives the quadrilateral points. 333 | // 334 | // Returns true on success. 335 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 336 | FPDFLink_GetQuadPoints(FPDF_LINK link_annot, 337 | int quad_index, 338 | FS_QUADPOINTSF* quad_points); 339 | 340 | // Experimental API 341 | // Gets an additional-action from |page|. 342 | // 343 | // page - handle to the page, as returned by FPDF_LoadPage(). 344 | // aa_type - the type of the page object's addtional-action, defined 345 | // in public/fpdf_formfill.h 346 | // 347 | // Returns the handle to the action data, or NULL if there is no 348 | // additional-action of type |aa_type|. 349 | // If this function returns a valid handle, it is valid as long as |page| is 350 | // valid. 351 | FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDF_GetPageAAction(FPDF_PAGE page, 352 | int aa_type); 353 | 354 | // Experimental API. 355 | // Get the file identifer defined in the trailer of |document|. 356 | // 357 | // document - handle to the document. 358 | // id_type - the file identifier type to retrieve. 359 | // buffer - a buffer for the file identifier. May be NULL. 360 | // buflen - the length of the buffer, in bytes. May be 0. 361 | // 362 | // Returns the number of bytes in the file identifier, including the NUL 363 | // terminator. 364 | // 365 | // The |buffer| is always a byte string. The |buffer| is followed by a NUL 366 | // terminator. If |buflen| is less than the returned length, or |buffer| is 367 | // NULL, |buffer| will not be modified. 368 | FPDF_EXPORT unsigned long FPDF_CALLCONV 369 | FPDF_GetFileIdentifier(FPDF_DOCUMENT document, 370 | FPDF_FILEIDTYPE id_type, 371 | void* buffer, 372 | unsigned long buflen); 373 | 374 | // Get meta-data |tag| content from |document|. 375 | // 376 | // document - handle to the document. 377 | // tag - the tag to retrieve. The tag can be one of: 378 | // Title, Author, Subject, Keywords, Creator, Producer, 379 | // CreationDate, or ModDate. 380 | // For detailed explanations of these tags and their respective 381 | // values, please refer to PDF Reference 1.6, section 10.2.1, 382 | // 'Document Information Dictionary'. 383 | // buffer - a buffer for the tag. May be NULL. 384 | // buflen - the length of the buffer, in bytes. May be 0. 385 | // 386 | // Returns the number of bytes in the tag, including trailing zeros. 387 | // 388 | // The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two 389 | // bytes of zeros indicating the end of the string. If |buflen| is less than 390 | // the returned length, or |buffer| is NULL, |buffer| will not be modified. 391 | // 392 | // For linearized files, FPDFAvail_IsFormAvail must be called before this, and 393 | // it must have returned PDF_FORM_AVAIL or PDF_FORM_NOTEXIST. Before that, there 394 | // is no guarantee the metadata has been loaded. 395 | FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document, 396 | FPDF_BYTESTRING tag, 397 | void* buffer, 398 | unsigned long buflen); 399 | 400 | // Get the page label for |page_index| from |document|. 401 | // 402 | // document - handle to the document. 403 | // page_index - the 0-based index of the page. 404 | // buffer - a buffer for the page label. May be NULL. 405 | // buflen - the length of the buffer, in bytes. May be 0. 406 | // 407 | // Returns the number of bytes in the page label, including trailing zeros. 408 | // 409 | // The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two 410 | // bytes of zeros indicating the end of the string. If |buflen| is less than 411 | // the returned length, or |buffer| is NULL, |buffer| will not be modified. 412 | FPDF_EXPORT unsigned long FPDF_CALLCONV 413 | FPDF_GetPageLabel(FPDF_DOCUMENT document, 414 | int page_index, 415 | void* buffer, 416 | unsigned long buflen); 417 | 418 | #ifdef __cplusplus 419 | } // extern "C" 420 | #endif // __cplusplus 421 | 422 | #endif // PUBLIC_FPDF_DOC_H_ 423 | -------------------------------------------------------------------------------- /include/public/fpdf_ext.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_EXT_H_ 8 | #define PUBLIC_FPDF_EXT_H_ 9 | 10 | #include 11 | 12 | // NOLINTNEXTLINE(build/include) 13 | #include "fpdfview.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif // __cplusplus 18 | 19 | // Unsupported XFA form. 20 | #define FPDF_UNSP_DOC_XFAFORM 1 21 | // Unsupported portable collection. 22 | #define FPDF_UNSP_DOC_PORTABLECOLLECTION 2 23 | // Unsupported attachment. 24 | #define FPDF_UNSP_DOC_ATTACHMENT 3 25 | // Unsupported security. 26 | #define FPDF_UNSP_DOC_SECURITY 4 27 | // Unsupported shared review. 28 | #define FPDF_UNSP_DOC_SHAREDREVIEW 5 29 | // Unsupported shared form, acrobat. 30 | #define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT 6 31 | // Unsupported shared form, filesystem. 32 | #define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM 7 33 | // Unsupported shared form, email. 34 | #define FPDF_UNSP_DOC_SHAREDFORM_EMAIL 8 35 | // Unsupported 3D annotation. 36 | #define FPDF_UNSP_ANNOT_3DANNOT 11 37 | // Unsupported movie annotation. 38 | #define FPDF_UNSP_ANNOT_MOVIE 12 39 | // Unsupported sound annotation. 40 | #define FPDF_UNSP_ANNOT_SOUND 13 41 | // Unsupported screen media annotation. 42 | #define FPDF_UNSP_ANNOT_SCREEN_MEDIA 14 43 | // Unsupported screen rich media annotation. 44 | #define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA 15 45 | // Unsupported attachment annotation. 46 | #define FPDF_UNSP_ANNOT_ATTACHMENT 16 47 | // Unsupported signature annotation. 48 | #define FPDF_UNSP_ANNOT_SIG 17 49 | 50 | // Interface for unsupported feature notifications. 51 | typedef struct _UNSUPPORT_INFO { 52 | // Version number of the interface. Must be 1. 53 | int version; 54 | 55 | // Unsupported object notification function. 56 | // Interface Version: 1 57 | // Implementation Required: Yes 58 | // 59 | // pThis - pointer to the interface structure. 60 | // nType - the type of unsupported object. One of the |FPDF_UNSP_*| entries. 61 | void (*FSDK_UnSupport_Handler)(struct _UNSUPPORT_INFO* pThis, int nType); 62 | } UNSUPPORT_INFO; 63 | 64 | // Setup an unsupported object handler. 65 | // 66 | // unsp_info - Pointer to an UNSUPPORT_INFO structure. 67 | // 68 | // Returns TRUE on success. 69 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 70 | FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info); 71 | 72 | // Set replacement function for calls to time(). 73 | // 74 | // This API is intended to be used only for testing, thus may cause PDFium to 75 | // behave poorly in production environments. 76 | // 77 | // func - Function pointer to alternate implementation of time(), or 78 | // NULL to restore to actual time() call itself. 79 | FPDF_EXPORT void FPDF_CALLCONV FSDK_SetTimeFunction(time_t (*func)()); 80 | 81 | // Set replacement function for calls to localtime(). 82 | // 83 | // This API is intended to be used only for testing, thus may cause PDFium to 84 | // behave poorly in production environments. 85 | // 86 | // func - Function pointer to alternate implementation of localtime(), or 87 | // NULL to restore to actual localtime() call itself. 88 | FPDF_EXPORT void FPDF_CALLCONV 89 | FSDK_SetLocaltimeFunction(struct tm* (*func)(const time_t*)); 90 | 91 | // Unknown page mode. 92 | #define PAGEMODE_UNKNOWN -1 93 | // Document outline, and thumbnails hidden. 94 | #define PAGEMODE_USENONE 0 95 | // Document outline visible. 96 | #define PAGEMODE_USEOUTLINES 1 97 | // Thumbnail images visible. 98 | #define PAGEMODE_USETHUMBS 2 99 | // Full-screen mode, no menu bar, window controls, or other decorations visible. 100 | #define PAGEMODE_FULLSCREEN 3 101 | // Optional content group panel visible. 102 | #define PAGEMODE_USEOC 4 103 | // Attachments panel visible. 104 | #define PAGEMODE_USEATTACHMENTS 5 105 | 106 | // Get the document's PageMode. 107 | // 108 | // doc - Handle to document. 109 | // 110 | // Returns one of the |PAGEMODE_*| flags defined above. 111 | // 112 | // The page mode defines how the document should be initially displayed. 113 | FPDF_EXPORT int FPDF_CALLCONV FPDFDoc_GetPageMode(FPDF_DOCUMENT document); 114 | 115 | #ifdef __cplusplus 116 | } // extern "C" 117 | #endif // __cplusplus 118 | 119 | #endif // PUBLIC_FPDF_EXT_H_ 120 | -------------------------------------------------------------------------------- /include/public/fpdf_flatten.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_FLATTEN_H_ 8 | #define PUBLIC_FPDF_FLATTEN_H_ 9 | 10 | // NOLINTNEXTLINE(build/include) 11 | #include "fpdfview.h" 12 | 13 | // Flatten operation failed. 14 | #define FLATTEN_FAIL 0 15 | // Flatten operation succeed. 16 | #define FLATTEN_SUCCESS 1 17 | // Nothing to be flattened. 18 | #define FLATTEN_NOTHINGTODO 2 19 | 20 | // Flatten for normal display. 21 | #define FLAT_NORMALDISPLAY 0 22 | // Flatten for print. 23 | #define FLAT_PRINT 1 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif // __cplusplus 28 | 29 | // Flatten annotations and form fields into the page contents. 30 | // 31 | // page - handle to the page. 32 | // nFlag - One of the |FLAT_*| values denoting the page usage. 33 | // 34 | // Returns one of the |FLATTEN_*| values. 35 | // 36 | // Currently, all failures return |FLATTEN_FAIL| with no indication of the 37 | // cause. 38 | FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag); 39 | 40 | #ifdef __cplusplus 41 | } // extern "C" 42 | #endif // __cplusplus 43 | 44 | #endif // PUBLIC_FPDF_FLATTEN_H_ 45 | -------------------------------------------------------------------------------- /include/public/fpdf_fwlevent.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_FWLEVENT_H_ 8 | #define PUBLIC_FPDF_FWLEVENT_H_ 9 | 10 | // NOLINTNEXTLINE(build/include) 11 | #include "fpdfview.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif // __cplusplus 16 | 17 | // Key flags. 18 | typedef enum { 19 | FWL_EVENTFLAG_ShiftKey = 1 << 0, 20 | FWL_EVENTFLAG_ControlKey = 1 << 1, 21 | FWL_EVENTFLAG_AltKey = 1 << 2, 22 | FWL_EVENTFLAG_MetaKey = 1 << 3, 23 | FWL_EVENTFLAG_KeyPad = 1 << 4, 24 | FWL_EVENTFLAG_AutoRepeat = 1 << 5, 25 | FWL_EVENTFLAG_LeftButtonDown = 1 << 6, 26 | FWL_EVENTFLAG_MiddleButtonDown = 1 << 7, 27 | FWL_EVENTFLAG_RightButtonDown = 1 << 8, 28 | } FWL_EVENTFLAG; 29 | 30 | // Virtual keycodes. 31 | typedef enum { 32 | FWL_VKEY_Back = 0x08, 33 | FWL_VKEY_Tab = 0x09, 34 | FWL_VKEY_NewLine = 0x0A, 35 | FWL_VKEY_Clear = 0x0C, 36 | FWL_VKEY_Return = 0x0D, 37 | FWL_VKEY_Shift = 0x10, 38 | FWL_VKEY_Control = 0x11, 39 | FWL_VKEY_Menu = 0x12, 40 | FWL_VKEY_Pause = 0x13, 41 | FWL_VKEY_Capital = 0x14, 42 | FWL_VKEY_Kana = 0x15, 43 | FWL_VKEY_Hangul = 0x15, 44 | FWL_VKEY_Junja = 0x17, 45 | FWL_VKEY_Final = 0x18, 46 | FWL_VKEY_Hanja = 0x19, 47 | FWL_VKEY_Kanji = 0x19, 48 | FWL_VKEY_Escape = 0x1B, 49 | FWL_VKEY_Convert = 0x1C, 50 | FWL_VKEY_NonConvert = 0x1D, 51 | FWL_VKEY_Accept = 0x1E, 52 | FWL_VKEY_ModeChange = 0x1F, 53 | FWL_VKEY_Space = 0x20, 54 | FWL_VKEY_Prior = 0x21, 55 | FWL_VKEY_Next = 0x22, 56 | FWL_VKEY_End = 0x23, 57 | FWL_VKEY_Home = 0x24, 58 | FWL_VKEY_Left = 0x25, 59 | FWL_VKEY_Up = 0x26, 60 | FWL_VKEY_Right = 0x27, 61 | FWL_VKEY_Down = 0x28, 62 | FWL_VKEY_Select = 0x29, 63 | FWL_VKEY_Print = 0x2A, 64 | FWL_VKEY_Execute = 0x2B, 65 | FWL_VKEY_Snapshot = 0x2C, 66 | FWL_VKEY_Insert = 0x2D, 67 | FWL_VKEY_Delete = 0x2E, 68 | FWL_VKEY_Help = 0x2F, 69 | FWL_VKEY_0 = 0x30, 70 | FWL_VKEY_1 = 0x31, 71 | FWL_VKEY_2 = 0x32, 72 | FWL_VKEY_3 = 0x33, 73 | FWL_VKEY_4 = 0x34, 74 | FWL_VKEY_5 = 0x35, 75 | FWL_VKEY_6 = 0x36, 76 | FWL_VKEY_7 = 0x37, 77 | FWL_VKEY_8 = 0x38, 78 | FWL_VKEY_9 = 0x39, 79 | FWL_VKEY_A = 0x41, 80 | FWL_VKEY_B = 0x42, 81 | FWL_VKEY_C = 0x43, 82 | FWL_VKEY_D = 0x44, 83 | FWL_VKEY_E = 0x45, 84 | FWL_VKEY_F = 0x46, 85 | FWL_VKEY_G = 0x47, 86 | FWL_VKEY_H = 0x48, 87 | FWL_VKEY_I = 0x49, 88 | FWL_VKEY_J = 0x4A, 89 | FWL_VKEY_K = 0x4B, 90 | FWL_VKEY_L = 0x4C, 91 | FWL_VKEY_M = 0x4D, 92 | FWL_VKEY_N = 0x4E, 93 | FWL_VKEY_O = 0x4F, 94 | FWL_VKEY_P = 0x50, 95 | FWL_VKEY_Q = 0x51, 96 | FWL_VKEY_R = 0x52, 97 | FWL_VKEY_S = 0x53, 98 | FWL_VKEY_T = 0x54, 99 | FWL_VKEY_U = 0x55, 100 | FWL_VKEY_V = 0x56, 101 | FWL_VKEY_W = 0x57, 102 | FWL_VKEY_X = 0x58, 103 | FWL_VKEY_Y = 0x59, 104 | FWL_VKEY_Z = 0x5A, 105 | FWL_VKEY_LWin = 0x5B, 106 | FWL_VKEY_Command = 0x5B, 107 | FWL_VKEY_RWin = 0x5C, 108 | FWL_VKEY_Apps = 0x5D, 109 | FWL_VKEY_Sleep = 0x5F, 110 | FWL_VKEY_NumPad0 = 0x60, 111 | FWL_VKEY_NumPad1 = 0x61, 112 | FWL_VKEY_NumPad2 = 0x62, 113 | FWL_VKEY_NumPad3 = 0x63, 114 | FWL_VKEY_NumPad4 = 0x64, 115 | FWL_VKEY_NumPad5 = 0x65, 116 | FWL_VKEY_NumPad6 = 0x66, 117 | FWL_VKEY_NumPad7 = 0x67, 118 | FWL_VKEY_NumPad8 = 0x68, 119 | FWL_VKEY_NumPad9 = 0x69, 120 | FWL_VKEY_Multiply = 0x6A, 121 | FWL_VKEY_Add = 0x6B, 122 | FWL_VKEY_Separator = 0x6C, 123 | FWL_VKEY_Subtract = 0x6D, 124 | FWL_VKEY_Decimal = 0x6E, 125 | FWL_VKEY_Divide = 0x6F, 126 | FWL_VKEY_F1 = 0x70, 127 | FWL_VKEY_F2 = 0x71, 128 | FWL_VKEY_F3 = 0x72, 129 | FWL_VKEY_F4 = 0x73, 130 | FWL_VKEY_F5 = 0x74, 131 | FWL_VKEY_F6 = 0x75, 132 | FWL_VKEY_F7 = 0x76, 133 | FWL_VKEY_F8 = 0x77, 134 | FWL_VKEY_F9 = 0x78, 135 | FWL_VKEY_F10 = 0x79, 136 | FWL_VKEY_F11 = 0x7A, 137 | FWL_VKEY_F12 = 0x7B, 138 | FWL_VKEY_F13 = 0x7C, 139 | FWL_VKEY_F14 = 0x7D, 140 | FWL_VKEY_F15 = 0x7E, 141 | FWL_VKEY_F16 = 0x7F, 142 | FWL_VKEY_F17 = 0x80, 143 | FWL_VKEY_F18 = 0x81, 144 | FWL_VKEY_F19 = 0x82, 145 | FWL_VKEY_F20 = 0x83, 146 | FWL_VKEY_F21 = 0x84, 147 | FWL_VKEY_F22 = 0x85, 148 | FWL_VKEY_F23 = 0x86, 149 | FWL_VKEY_F24 = 0x87, 150 | FWL_VKEY_NunLock = 0x90, 151 | FWL_VKEY_Scroll = 0x91, 152 | FWL_VKEY_LShift = 0xA0, 153 | FWL_VKEY_RShift = 0xA1, 154 | FWL_VKEY_LControl = 0xA2, 155 | FWL_VKEY_RControl = 0xA3, 156 | FWL_VKEY_LMenu = 0xA4, 157 | FWL_VKEY_RMenu = 0xA5, 158 | FWL_VKEY_BROWSER_Back = 0xA6, 159 | FWL_VKEY_BROWSER_Forward = 0xA7, 160 | FWL_VKEY_BROWSER_Refresh = 0xA8, 161 | FWL_VKEY_BROWSER_Stop = 0xA9, 162 | FWL_VKEY_BROWSER_Search = 0xAA, 163 | FWL_VKEY_BROWSER_Favorites = 0xAB, 164 | FWL_VKEY_BROWSER_Home = 0xAC, 165 | FWL_VKEY_VOLUME_Mute = 0xAD, 166 | FWL_VKEY_VOLUME_Down = 0xAE, 167 | FWL_VKEY_VOLUME_Up = 0xAF, 168 | FWL_VKEY_MEDIA_NEXT_Track = 0xB0, 169 | FWL_VKEY_MEDIA_PREV_Track = 0xB1, 170 | FWL_VKEY_MEDIA_Stop = 0xB2, 171 | FWL_VKEY_MEDIA_PLAY_Pause = 0xB3, 172 | FWL_VKEY_MEDIA_LAUNCH_Mail = 0xB4, 173 | FWL_VKEY_MEDIA_LAUNCH_MEDIA_Select = 0xB5, 174 | FWL_VKEY_MEDIA_LAUNCH_APP1 = 0xB6, 175 | FWL_VKEY_MEDIA_LAUNCH_APP2 = 0xB7, 176 | FWL_VKEY_OEM_1 = 0xBA, 177 | FWL_VKEY_OEM_Plus = 0xBB, 178 | FWL_VKEY_OEM_Comma = 0xBC, 179 | FWL_VKEY_OEM_Minus = 0xBD, 180 | FWL_VKEY_OEM_Period = 0xBE, 181 | FWL_VKEY_OEM_2 = 0xBF, 182 | FWL_VKEY_OEM_3 = 0xC0, 183 | FWL_VKEY_OEM_4 = 0xDB, 184 | FWL_VKEY_OEM_5 = 0xDC, 185 | FWL_VKEY_OEM_6 = 0xDD, 186 | FWL_VKEY_OEM_7 = 0xDE, 187 | FWL_VKEY_OEM_8 = 0xDF, 188 | FWL_VKEY_OEM_102 = 0xE2, 189 | FWL_VKEY_ProcessKey = 0xE5, 190 | FWL_VKEY_Packet = 0xE7, 191 | FWL_VKEY_Attn = 0xF6, 192 | FWL_VKEY_Crsel = 0xF7, 193 | FWL_VKEY_Exsel = 0xF8, 194 | FWL_VKEY_Ereof = 0xF9, 195 | FWL_VKEY_Play = 0xFA, 196 | FWL_VKEY_Zoom = 0xFB, 197 | FWL_VKEY_NoName = 0xFC, 198 | FWL_VKEY_PA1 = 0xFD, 199 | FWL_VKEY_OEM_Clear = 0xFE, 200 | FWL_VKEY_Unknown = 0, 201 | } FWL_VKEYCODE; 202 | 203 | #ifdef __cplusplus 204 | } // extern "C" 205 | #endif // __cplusplus 206 | 207 | #endif // PUBLIC_FPDF_FWLEVENT_H_ 208 | -------------------------------------------------------------------------------- /include/public/fpdf_javascript.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef PUBLIC_FPDF_JAVASCRIPT_H_ 6 | #define PUBLIC_FPDF_JAVASCRIPT_H_ 7 | 8 | // NOLINTNEXTLINE(build/include) 9 | #include "fpdfview.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif // __cplusplus 14 | 15 | // Experimental API. 16 | // Get the number of JavaScript actions in |document|. 17 | // 18 | // document - handle to a document. 19 | // 20 | // Returns the number of JavaScript actions in |document| or -1 on error. 21 | FPDF_EXPORT int FPDF_CALLCONV 22 | FPDFDoc_GetJavaScriptActionCount(FPDF_DOCUMENT document); 23 | 24 | // Experimental API. 25 | // Get the JavaScript action at |index| in |document|. 26 | // 27 | // document - handle to a document. 28 | // index - the index of the requested JavaScript action. 29 | // 30 | // Returns the handle to the JavaScript action, or NULL on failure. 31 | // Caller owns the returned handle and must close it with 32 | // FPDFDoc_CloseJavaScriptAction(). 33 | FPDF_EXPORT FPDF_JAVASCRIPT_ACTION FPDF_CALLCONV 34 | FPDFDoc_GetJavaScriptAction(FPDF_DOCUMENT document, int index); 35 | 36 | // Experimental API. 37 | // Close a loaded FPDF_JAVASCRIPT_ACTION object. 38 | 39 | // javascript - Handle to a JavaScript action. 40 | FPDF_EXPORT void FPDF_CALLCONV 41 | FPDFDoc_CloseJavaScriptAction(FPDF_JAVASCRIPT_ACTION javascript); 42 | 43 | // Experimental API. 44 | // Get the name from the |javascript| handle. |buffer| is only modified if 45 | // |buflen| is longer than the length of the name. On errors, |buffer| is 46 | // unmodified and the returned length is 0. 47 | // 48 | // javascript - handle to an JavaScript action. 49 | // buffer - buffer for holding the name, encoded in UTF-16LE. 50 | // buflen - length of the buffer in bytes. 51 | // 52 | // Returns the length of the JavaScript action name in bytes. 53 | FPDF_EXPORT unsigned long FPDF_CALLCONV 54 | FPDFJavaScriptAction_GetName(FPDF_JAVASCRIPT_ACTION javascript, 55 | FPDF_WCHAR* buffer, 56 | unsigned long buflen); 57 | 58 | // Experimental API. 59 | // Get the script from the |javascript| handle. |buffer| is only modified if 60 | // |buflen| is longer than the length of the script. On errors, |buffer| is 61 | // unmodified and the returned length is 0. 62 | // 63 | // javascript - handle to an JavaScript action. 64 | // buffer - buffer for holding the name, encoded in UTF-16LE. 65 | // buflen - length of the buffer in bytes. 66 | // 67 | // Returns the length of the JavaScript action name in bytes. 68 | FPDF_EXPORT unsigned long FPDF_CALLCONV 69 | FPDFJavaScriptAction_GetScript(FPDF_JAVASCRIPT_ACTION javascript, 70 | FPDF_WCHAR* buffer, 71 | unsigned long buflen); 72 | 73 | #ifdef __cplusplus 74 | } // extern "C" 75 | #endif // __cplusplus 76 | 77 | #endif // PUBLIC_FPDF_JAVASCRIPT_H_ 78 | -------------------------------------------------------------------------------- /include/public/fpdf_ppo.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_PPO_H_ 8 | #define PUBLIC_FPDF_PPO_H_ 9 | 10 | // NOLINTNEXTLINE(build/include) 11 | #include "fpdfview.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | // Experimental API. 18 | // Import pages to a FPDF_DOCUMENT. 19 | // 20 | // dest_doc - The destination document for the pages. 21 | // src_doc - The document to be imported. 22 | // page_indices - An array of page indices to be imported. The first page is 23 | // zero. If |page_indices| is NULL, all pages from |src_doc| 24 | // are imported. 25 | // length - The length of the |page_indices| array. 26 | // index - The page index at which to insert the first imported page 27 | // into |dest_doc|. The first page is zero. 28 | // 29 | // Returns TRUE on success. Returns FALSE if any pages in |page_indices| is 30 | // invalid. 31 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 32 | FPDF_ImportPagesByIndex(FPDF_DOCUMENT dest_doc, 33 | FPDF_DOCUMENT src_doc, 34 | const int* page_indices, 35 | unsigned long length, 36 | int index); 37 | 38 | // Import pages to a FPDF_DOCUMENT. 39 | // 40 | // dest_doc - The destination document for the pages. 41 | // src_doc - The document to be imported. 42 | // pagerange - A page range string, Such as "1,3,5-7". The first page is one. 43 | // If |pagerange| is NULL, all pages from |src_doc| are imported. 44 | // index - The page index at which to insert the first imported page into 45 | // |dest_doc|. The first page is zero. 46 | // 47 | // Returns TRUE on success. Returns FALSE if any pages in |pagerange| is 48 | // invalid or if |pagerange| cannot be read. 49 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_ImportPages(FPDF_DOCUMENT dest_doc, 50 | FPDF_DOCUMENT src_doc, 51 | FPDF_BYTESTRING pagerange, 52 | int index); 53 | 54 | // Experimental API. 55 | // Create a new document from |src_doc|. The pages of |src_doc| will be 56 | // combined to provide |num_pages_on_x_axis x num_pages_on_y_axis| pages per 57 | // |output_doc| page. 58 | // 59 | // src_doc - The document to be imported. 60 | // output_width - The output page width in PDF "user space" units. 61 | // output_height - The output page height in PDF "user space" units. 62 | // num_pages_on_x_axis - The number of pages on X Axis. 63 | // num_pages_on_y_axis - The number of pages on Y Axis. 64 | // 65 | // Return value: 66 | // A handle to the created document, or NULL on failure. 67 | // 68 | // Comments: 69 | // number of pages per page = num_pages_on_x_axis * num_pages_on_y_axis 70 | // 71 | FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV 72 | FPDF_ImportNPagesToOne(FPDF_DOCUMENT src_doc, 73 | float output_width, 74 | float output_height, 75 | size_t num_pages_on_x_axis, 76 | size_t num_pages_on_y_axis); 77 | 78 | // Experimental API. 79 | // Create a template to generate form xobjects from |src_doc|'s page at 80 | // |src_page_index|, for use in |dest_doc|. 81 | // 82 | // Returns a handle on success, or NULL on failure. Caller owns the newly 83 | // created object. 84 | FPDF_EXPORT FPDF_XOBJECT FPDF_CALLCONV 85 | FPDF_NewXObjectFromPage(FPDF_DOCUMENT dest_doc, 86 | FPDF_DOCUMENT src_doc, 87 | int src_page_index); 88 | 89 | // Experimental API. 90 | // Close an FPDF_XOBJECT handle created by FPDF_NewXObjectFromPage(). 91 | // FPDF_PAGEOBJECTs created from the FPDF_XOBJECT handle are not affected. 92 | FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseXObject(FPDF_XOBJECT xobject); 93 | 94 | // Experimental API. 95 | // Create a new form object from an FPDF_XOBJECT object. 96 | // 97 | // Returns a new form object on success, or NULL on failure. Caller owns the 98 | // newly created object. 99 | FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV 100 | FPDF_NewFormObjectFromXObject(FPDF_XOBJECT xobject); 101 | 102 | // Copy the viewer preferences from |src_doc| into |dest_doc|. 103 | // 104 | // dest_doc - Document to write the viewer preferences into. 105 | // src_doc - Document to read the viewer preferences from. 106 | // 107 | // Returns TRUE on success. 108 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 109 | FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc); 110 | 111 | #ifdef __cplusplus 112 | } // extern "C" 113 | #endif // __cplusplus 114 | 115 | #endif // PUBLIC_FPDF_PPO_H_ 116 | -------------------------------------------------------------------------------- /include/public/fpdf_progressive.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_PROGRESSIVE_H_ 8 | #define PUBLIC_FPDF_PROGRESSIVE_H_ 9 | 10 | // clang-format off 11 | // NOLINTNEXTLINE(build/include) 12 | #include "fpdfview.h" 13 | 14 | // Flags for progressive process status. 15 | #define FPDF_RENDER_READY 0 16 | #define FPDF_RENDER_TOBECONTINUED 1 17 | #define FPDF_RENDER_DONE 2 18 | #define FPDF_RENDER_FAILED 3 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | // IFPDF_RENDERINFO interface. 25 | typedef struct _IFSDK_PAUSE { 26 | /* 27 | * Version number of the interface. Currently must be 1. 28 | */ 29 | int version; 30 | 31 | /* 32 | * Method: NeedToPauseNow 33 | * Check if we need to pause a progressive process now. 34 | * Interface Version: 35 | * 1 36 | * Implementation Required: 37 | * yes 38 | * Parameters: 39 | * pThis - Pointer to the interface structure itself 40 | * Return Value: 41 | * Non-zero for pause now, 0 for continue. 42 | */ 43 | FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis); 44 | 45 | // A user defined data pointer, used by user's application. Can be NULL. 46 | void* user; 47 | } IFSDK_PAUSE; 48 | 49 | // Experimental API. 50 | // Function: FPDF_RenderPageBitmapWithColorScheme_Start 51 | // Start to render page contents to a device independent bitmap 52 | // progressively with a specified color scheme for the content. 53 | // Parameters: 54 | // bitmap - Handle to the device independent bitmap (as the 55 | // output buffer). Bitmap handle can be created by 56 | // FPDFBitmap_Create function. 57 | // page - Handle to the page as returned by FPDF_LoadPage 58 | // function. 59 | // start_x - Left pixel position of the display area in the 60 | // bitmap coordinate. 61 | // start_y - Top pixel position of the display area in the 62 | // bitmap coordinate. 63 | // size_x - Horizontal size (in pixels) for displaying the 64 | // page. 65 | // size_y - Vertical size (in pixels) for displaying the page. 66 | // rotate - Page orientation: 0 (normal), 1 (rotated 90 67 | // degrees clockwise), 2 (rotated 180 degrees), 68 | // 3 (rotated 90 degrees counter-clockwise). 69 | // flags - 0 for normal display, or combination of flags 70 | // defined in fpdfview.h. With FPDF_ANNOT flag, it 71 | // renders all annotations that does not require 72 | // user-interaction, which are all annotations except 73 | // widget and popup annotations. 74 | // color_scheme - Color scheme to be used in rendering the |page|. 75 | // If null, this function will work similar to 76 | // FPDF_RenderPageBitmap_Start(). 77 | // pause - The IFSDK_PAUSE interface. A callback mechanism 78 | // allowing the page rendering process. 79 | // Return value: 80 | // Rendering Status. See flags for progressive process status for the 81 | // details. 82 | FPDF_EXPORT int FPDF_CALLCONV 83 | FPDF_RenderPageBitmapWithColorScheme_Start(FPDF_BITMAP bitmap, 84 | FPDF_PAGE page, 85 | int start_x, 86 | int start_y, 87 | int size_x, 88 | int size_y, 89 | int rotate, 90 | int flags, 91 | const FPDF_COLORSCHEME* color_scheme, 92 | IFSDK_PAUSE* pause); 93 | 94 | // Function: FPDF_RenderPageBitmap_Start 95 | // Start to render page contents to a device independent bitmap 96 | // progressively. 97 | // Parameters: 98 | // bitmap - Handle to the device independent bitmap (as the 99 | // output buffer). Bitmap handle can be created by 100 | // FPDFBitmap_Create(). 101 | // page - Handle to the page, as returned by FPDF_LoadPage(). 102 | // start_x - Left pixel position of the display area in the 103 | // bitmap coordinates. 104 | // start_y - Top pixel position of the display area in the bitmap 105 | // coordinates. 106 | // size_x - Horizontal size (in pixels) for displaying the page. 107 | // size_y - Vertical size (in pixels) for displaying the page. 108 | // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees 109 | // clockwise), 2 (rotated 180 degrees), 3 (rotated 90 110 | // degrees counter-clockwise). 111 | // flags - 0 for normal display, or combination of flags 112 | // defined in fpdfview.h. With FPDF_ANNOT flag, it 113 | // renders all annotations that does not require 114 | // user-interaction, which are all annotations except 115 | // widget and popup annotations. 116 | // pause - The IFSDK_PAUSE interface.A callback mechanism 117 | // allowing the page rendering process 118 | // Return value: 119 | // Rendering Status. See flags for progressive process status for the 120 | // details. 121 | FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, 122 | FPDF_PAGE page, 123 | int start_x, 124 | int start_y, 125 | int size_x, 126 | int size_y, 127 | int rotate, 128 | int flags, 129 | IFSDK_PAUSE* pause); 130 | 131 | // Function: FPDF_RenderPage_Continue 132 | // Continue rendering a PDF page. 133 | // Parameters: 134 | // page - Handle to the page, as returned by FPDF_LoadPage(). 135 | // pause - The IFSDK_PAUSE interface (a callback mechanism 136 | // allowing the page rendering process to be paused 137 | // before it's finished). This can be NULL if you 138 | // don't want to pause. 139 | // Return value: 140 | // The rendering status. See flags for progressive process status for 141 | // the details. 142 | FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPage_Continue(FPDF_PAGE page, 143 | IFSDK_PAUSE* pause); 144 | 145 | // Function: FPDF_RenderPage_Close 146 | // Release the resource allocate during page rendering. Need to be 147 | // called after finishing rendering or 148 | // cancel the rendering. 149 | // Parameters: 150 | // page - Handle to the page, as returned by FPDF_LoadPage(). 151 | // Return value: 152 | // None. 153 | FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage_Close(FPDF_PAGE page); 154 | 155 | #ifdef __cplusplus 156 | } 157 | #endif 158 | 159 | #endif // PUBLIC_FPDF_PROGRESSIVE_H_ 160 | -------------------------------------------------------------------------------- /include/public/fpdf_save.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_SAVE_H_ 8 | #define PUBLIC_FPDF_SAVE_H_ 9 | 10 | // clang-format off 11 | // NOLINTNEXTLINE(build/include) 12 | #include "fpdfview.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | // Structure for custom file write 19 | typedef struct FPDF_FILEWRITE_ { 20 | // 21 | // Version number of the interface. Currently must be 1. 22 | // 23 | int version; 24 | 25 | // Method: WriteBlock 26 | // Output a block of data in your custom way. 27 | // Interface Version: 28 | // 1 29 | // Implementation Required: 30 | // Yes 31 | // Comments: 32 | // Called by function FPDF_SaveDocument 33 | // Parameters: 34 | // pThis - Pointer to the structure itself 35 | // pData - Pointer to a buffer to output 36 | // size - The size of the buffer. 37 | // Return value: 38 | // Should be non-zero if successful, zero for error. 39 | int (*WriteBlock)(struct FPDF_FILEWRITE_* pThis, 40 | const void* pData, 41 | unsigned long size); 42 | } FPDF_FILEWRITE; 43 | 44 | // Flags for FPDF_SaveAsCopy() 45 | #define FPDF_INCREMENTAL 1 46 | #define FPDF_NO_INCREMENTAL 2 47 | #define FPDF_REMOVE_SECURITY 3 48 | 49 | // Function: FPDF_SaveAsCopy 50 | // Saves the copy of specified document in custom way. 51 | // Parameters: 52 | // document - Handle to document, as returned by 53 | // FPDF_LoadDocument() or FPDF_CreateNewDocument(). 54 | // pFileWrite - A pointer to a custom file write structure. 55 | // flags - The creating flags. 56 | // Return value: 57 | // TRUE for succeed, FALSE for failed. 58 | // 59 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SaveAsCopy(FPDF_DOCUMENT document, 60 | FPDF_FILEWRITE* pFileWrite, 61 | FPDF_DWORD flags); 62 | 63 | // Function: FPDF_SaveWithVersion 64 | // Same as FPDF_SaveAsCopy(), except the file version of the 65 | // saved document can be specified by the caller. 66 | // Parameters: 67 | // document - Handle to document. 68 | // pFileWrite - A pointer to a custom file write structure. 69 | // flags - The creating flags. 70 | // fileVersion - The PDF file version. File version: 14 for 1.4, 71 | // 15 for 1.5, ... 72 | // Return value: 73 | // TRUE if succeed, FALSE if failed. 74 | // 75 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 76 | FPDF_SaveWithVersion(FPDF_DOCUMENT document, 77 | FPDF_FILEWRITE* pFileWrite, 78 | FPDF_DWORD flags, 79 | int fileVersion); 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif // PUBLIC_FPDF_SAVE_H_ 86 | -------------------------------------------------------------------------------- /include/public/fpdf_searchex.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_SEARCHEX_H_ 8 | #define PUBLIC_FPDF_SEARCHEX_H_ 9 | 10 | // NOLINTNEXTLINE(build/include) 11 | #include "fpdfview.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif // __cplusplus 16 | 17 | // Get the character index in |text_page| internal character list. 18 | // 19 | // text_page - a text page information structure. 20 | // nTextIndex - index of the text returned from FPDFText_GetText(). 21 | // 22 | // Returns the index of the character in internal character list. -1 for error. 23 | FPDF_EXPORT int FPDF_CALLCONV 24 | FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex); 25 | 26 | // Get the text index in |text_page| internal character list. 27 | // 28 | // text_page - a text page information structure. 29 | // nCharIndex - index of the character in internal character list. 30 | // 31 | // Returns the index of the text returned from FPDFText_GetText(). -1 for error. 32 | FPDF_EXPORT int FPDF_CALLCONV 33 | FPDFText_GetTextIndexFromCharIndex(FPDF_TEXTPAGE text_page, int nCharIndex); 34 | 35 | #ifdef __cplusplus 36 | } // extern "C" 37 | #endif // __cplusplus 38 | 39 | #endif // PUBLIC_FPDF_SEARCHEX_H_ 40 | -------------------------------------------------------------------------------- /include/public/fpdf_signature.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef PUBLIC_FPDF_SIGNATURE_H_ 6 | #define PUBLIC_FPDF_SIGNATURE_H_ 7 | 8 | // NOLINTNEXTLINE(build/include) 9 | #include "fpdfview.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif // __cplusplus 14 | 15 | // Experimental API. 16 | // Function: FPDF_GetSignatureCount 17 | // Get total number of signatures in the document. 18 | // Parameters: 19 | // document - Handle to document. Returned by FPDF_LoadDocument(). 20 | // Return value: 21 | // Total number of signatures in the document on success, -1 on error. 22 | FPDF_EXPORT int FPDF_CALLCONV FPDF_GetSignatureCount(FPDF_DOCUMENT document); 23 | 24 | // Experimental API. 25 | // Function: FPDF_GetSignatureObject 26 | // Get the Nth signature of the document. 27 | // Parameters: 28 | // document - Handle to document. Returned by FPDF_LoadDocument(). 29 | // index - Index into the array of signatures of the document. 30 | // Return value: 31 | // Returns the handle to the signature, or NULL on failure. The caller 32 | // does not take ownership of the returned FPDF_SIGNATURE. Instead, it 33 | // remains valid until FPDF_CloseDocument() is called for the document. 34 | FPDF_EXPORT FPDF_SIGNATURE FPDF_CALLCONV 35 | FPDF_GetSignatureObject(FPDF_DOCUMENT document, int index); 36 | 37 | // Experimental API. 38 | // Function: FPDFSignatureObj_GetContents 39 | // Get the contents of a signature object. 40 | // Parameters: 41 | // signature - Handle to the signature object. Returned by 42 | // FPDF_GetSignatureObject(). 43 | // buffer - The address of a buffer that receives the contents. 44 | // length - The size, in bytes, of |buffer|. 45 | // Return value: 46 | // Returns the number of bytes in the contents on success, 0 on error. 47 | // 48 | // For public-key signatures, |buffer| is either a DER-encoded PKCS#1 binary or 49 | // a DER-encoded PKCS#7 binary. If |length| is less than the returned length, or 50 | // |buffer| is NULL, |buffer| will not be modified. 51 | FPDF_EXPORT unsigned long FPDF_CALLCONV 52 | FPDFSignatureObj_GetContents(FPDF_SIGNATURE signature, 53 | void* buffer, 54 | unsigned long length); 55 | 56 | // Experimental API. 57 | // Function: FPDFSignatureObj_GetByteRange 58 | // Get the byte range of a signature object. 59 | // Parameters: 60 | // signature - Handle to the signature object. Returned by 61 | // FPDF_GetSignatureObject(). 62 | // buffer - The address of a buffer that receives the 63 | // byte range. 64 | // length - The size, in ints, of |buffer|. 65 | // Return value: 66 | // Returns the number of ints in the byte range on 67 | // success, 0 on error. 68 | // 69 | // |buffer| is an array of pairs of integers (starting byte offset, 70 | // length in bytes) that describes the exact byte range for the digest 71 | // calculation. If |length| is less than the returned length, or 72 | // |buffer| is NULL, |buffer| will not be modified. 73 | FPDF_EXPORT unsigned long FPDF_CALLCONV 74 | FPDFSignatureObj_GetByteRange(FPDF_SIGNATURE signature, 75 | int* buffer, 76 | unsigned long length); 77 | 78 | // Experimental API. 79 | // Function: FPDFSignatureObj_GetSubFilter 80 | // Get the encoding of the value of a signature object. 81 | // Parameters: 82 | // signature - Handle to the signature object. Returned by 83 | // FPDF_GetSignatureObject(). 84 | // buffer - The address of a buffer that receives the encoding. 85 | // length - The size, in bytes, of |buffer|. 86 | // Return value: 87 | // Returns the number of bytes in the encoding name (including the 88 | // trailing NUL character) on success, 0 on error. 89 | // 90 | // The |buffer| is always encoded in 7-bit ASCII. If |length| is less than the 91 | // returned length, or |buffer| is NULL, |buffer| will not be modified. 92 | FPDF_EXPORT unsigned long FPDF_CALLCONV 93 | FPDFSignatureObj_GetSubFilter(FPDF_SIGNATURE signature, 94 | char* buffer, 95 | unsigned long length); 96 | 97 | // Experimental API. 98 | // Function: FPDFSignatureObj_GetReason 99 | // Get the reason (comment) of the signature object. 100 | // Parameters: 101 | // signature - Handle to the signature object. Returned by 102 | // FPDF_GetSignatureObject(). 103 | // buffer - The address of a buffer that receives the reason. 104 | // length - The size, in bytes, of |buffer|. 105 | // Return value: 106 | // Returns the number of bytes in the reason on success, 0 on error. 107 | // 108 | // Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The 109 | // string is terminated by a UTF16 NUL character. If |length| is less than the 110 | // returned length, or |buffer| is NULL, |buffer| will not be modified. 111 | FPDF_EXPORT unsigned long FPDF_CALLCONV 112 | FPDFSignatureObj_GetReason(FPDF_SIGNATURE signature, 113 | void* buffer, 114 | unsigned long length); 115 | 116 | // Experimental API. 117 | // Function: FPDFSignatureObj_GetTime 118 | // Get the time of signing of a signature object. 119 | // Parameters: 120 | // signature - Handle to the signature object. Returned by 121 | // FPDF_GetSignatureObject(). 122 | // buffer - The address of a buffer that receives the time. 123 | // length - The size, in bytes, of |buffer|. 124 | // Return value: 125 | // Returns the number of bytes in the encoding name (including the 126 | // trailing NUL character) on success, 0 on error. 127 | // 128 | // The |buffer| is always encoded in 7-bit ASCII. If |length| is less than the 129 | // returned length, or |buffer| is NULL, |buffer| will not be modified. 130 | // 131 | // The format of time is expected to be D:YYYYMMDDHHMMSS+XX'YY', i.e. it's 132 | // percision is seconds, with timezone information. This value should be used 133 | // only when the time of signing is not available in the (PKCS#7 binary) 134 | // signature. 135 | FPDF_EXPORT unsigned long FPDF_CALLCONV 136 | FPDFSignatureObj_GetTime(FPDF_SIGNATURE signature, 137 | char* buffer, 138 | unsigned long length); 139 | 140 | // Experimental API. 141 | // Function: FPDFSignatureObj_GetDocMDPPermission 142 | // Get the DocMDP permission of a signature object. 143 | // Parameters: 144 | // signature - Handle to the signature object. Returned by 145 | // FPDF_GetSignatureObject(). 146 | // Return value: 147 | // Returns the permission (1, 2 or 3) on success, 0 on error. 148 | FPDF_EXPORT unsigned int FPDF_CALLCONV 149 | FPDFSignatureObj_GetDocMDPPermission(FPDF_SIGNATURE signature); 150 | 151 | #ifdef __cplusplus 152 | } // extern "C" 153 | #endif // __cplusplus 154 | 155 | #endif // PUBLIC_FPDF_SIGNATURE_H_ 156 | -------------------------------------------------------------------------------- /include/public/fpdf_structtree.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_STRUCTTREE_H_ 8 | #define PUBLIC_FPDF_STRUCTTREE_H_ 9 | 10 | // clang-format off 11 | // NOLINTNEXTLINE(build/include) 12 | #include "fpdfview.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | // Function: FPDF_StructTree_GetForPage 19 | // Get the structure tree for a page. 20 | // Parameters: 21 | // page - Handle to the page, as returned by FPDF_LoadPage(). 22 | // Return value: 23 | // A handle to the structure tree or NULL on error. 24 | FPDF_EXPORT FPDF_STRUCTTREE FPDF_CALLCONV 25 | FPDF_StructTree_GetForPage(FPDF_PAGE page); 26 | 27 | // Function: FPDF_StructTree_Close 28 | // Release a resource allocated by FPDF_StructTree_GetForPage(). 29 | // Parameters: 30 | // struct_tree - Handle to the structure tree, as returned by 31 | // FPDF_StructTree_LoadPage(). 32 | // Return value: 33 | // None. 34 | FPDF_EXPORT void FPDF_CALLCONV 35 | FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree); 36 | 37 | // Function: FPDF_StructTree_CountChildren 38 | // Count the number of children for the structure tree. 39 | // Parameters: 40 | // struct_tree - Handle to the structure tree, as returned by 41 | // FPDF_StructTree_LoadPage(). 42 | // Return value: 43 | // The number of children, or -1 on error. 44 | FPDF_EXPORT int FPDF_CALLCONV 45 | FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree); 46 | 47 | // Function: FPDF_StructTree_GetChildAtIndex 48 | // Get a child in the structure tree. 49 | // Parameters: 50 | // struct_tree - Handle to the structure tree, as returned by 51 | // FPDF_StructTree_LoadPage(). 52 | // index - The index for the child, 0-based. 53 | // Return value: 54 | // The child at the n-th index or NULL on error. 55 | FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV 56 | FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index); 57 | 58 | // Function: FPDF_StructElement_GetAltText 59 | // Get the alt text for a given element. 60 | // Parameters: 61 | // struct_element - Handle to the struct element. 62 | // buffer - A buffer for output the alt text. May be NULL. 63 | // buflen - The length of the buffer, in bytes. May be 0. 64 | // Return value: 65 | // The number of bytes in the title, including the terminating NUL 66 | // character. The number of bytes is returned regardless of the 67 | // |buffer| and |buflen| parameters. 68 | // Comments: 69 | // Regardless of the platform, the |buffer| is always in UTF-16LE 70 | // encoding. The string is terminated by a UTF16 NUL character. If 71 | // |buflen| is less than the required length, or |buffer| is NULL, 72 | // |buffer| will not be modified. 73 | FPDF_EXPORT unsigned long FPDF_CALLCONV 74 | FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element, 75 | void* buffer, 76 | unsigned long buflen); 77 | 78 | // Experimental API. 79 | // Function: FPDF_StructElement_GetID 80 | // Get the ID for a given element. 81 | // Parameters: 82 | // struct_element - Handle to the struct element. 83 | // buffer - A buffer for output the ID string. May be NULL. 84 | // buflen - The length of the buffer, in bytes. May be 0. 85 | // Return value: 86 | // The number of bytes in the ID string, including the terminating NUL 87 | // character. The number of bytes is returned regardless of the 88 | // |buffer| and |buflen| parameters. 89 | // Comments: 90 | // Regardless of the platform, the |buffer| is always in UTF-16LE 91 | // encoding. The string is terminated by a UTF16 NUL character. If 92 | // |buflen| is less than the required length, or |buffer| is NULL, 93 | // |buffer| will not be modified. 94 | FPDF_EXPORT unsigned long FPDF_CALLCONV 95 | FPDF_StructElement_GetID(FPDF_STRUCTELEMENT struct_element, 96 | void* buffer, 97 | unsigned long buflen); 98 | 99 | // Experimental API. 100 | // Function: FPDF_StructElement_GetLang 101 | // Get the case-insensitive IETF BCP 47 language code for an element. 102 | // Parameters: 103 | // struct_element - Handle to the struct element. 104 | // buffer - A buffer for output the lang string. May be NULL. 105 | // buflen - The length of the buffer, in bytes. May be 0. 106 | // Return value: 107 | // The number of bytes in the ID string, including the terminating NUL 108 | // character. The number of bytes is returned regardless of the 109 | // |buffer| and |buflen| parameters. 110 | // Comments: 111 | // Regardless of the platform, the |buffer| is always in UTF-16LE 112 | // encoding. The string is terminated by a UTF16 NUL character. If 113 | // |buflen| is less than the required length, or |buffer| is NULL, 114 | // |buffer| will not be modified. 115 | FPDF_EXPORT unsigned long FPDF_CALLCONV 116 | FPDF_StructElement_GetLang(FPDF_STRUCTELEMENT struct_element, 117 | void* buffer, 118 | unsigned long buflen); 119 | 120 | // Experimental API. 121 | // Function: FPDF_StructElement_GetStringAttribute 122 | // Get a struct element attribute of type "name" or "string". 123 | // Parameters: 124 | // struct_element - Handle to the struct element. 125 | // attr_name - The name of the attribute to retrieve. 126 | // buffer - A buffer for output. May be NULL. 127 | // buflen - The length of the buffer, in bytes. May be 0. 128 | // Return value: 129 | // The number of bytes in the attribute value, including the 130 | // terminating NUL character. The number of bytes is returned 131 | // regardless of the |buffer| and |buflen| parameters. 132 | // Comments: 133 | // Regardless of the platform, the |buffer| is always in UTF-16LE 134 | // encoding. The string is terminated by a UTF16 NUL character. If 135 | // |buflen| is less than the required length, or |buffer| is NULL, 136 | // |buffer| will not be modified. 137 | FPDF_EXPORT unsigned long FPDF_CALLCONV 138 | FPDF_StructElement_GetStringAttribute(FPDF_STRUCTELEMENT struct_element, 139 | FPDF_BYTESTRING attr_name, 140 | void* buffer, 141 | unsigned long buflen); 142 | 143 | // Function: FPDF_StructElement_GetMarkedContentID 144 | // Get the marked content ID for a given element. 145 | // Parameters: 146 | // struct_element - Handle to the struct element. 147 | // Return value: 148 | // The marked content ID of the element. If no ID exists, returns 149 | // -1. 150 | FPDF_EXPORT int FPDF_CALLCONV 151 | FPDF_StructElement_GetMarkedContentID(FPDF_STRUCTELEMENT struct_element); 152 | 153 | // Function: FPDF_StructElement_GetType 154 | // Get the type (/S) for a given element. 155 | // Parameters: 156 | // struct_element - Handle to the struct element. 157 | // buffer - A buffer for output. May be NULL. 158 | // buflen - The length of the buffer, in bytes. May be 0. 159 | // Return value: 160 | // The number of bytes in the type, including the terminating NUL 161 | // character. The number of bytes is returned regardless of the 162 | // |buffer| and |buflen| parameters. 163 | // Comments: 164 | // Regardless of the platform, the |buffer| is always in UTF-16LE 165 | // encoding. The string is terminated by a UTF16 NUL character. If 166 | // |buflen| is less than the required length, or |buffer| is NULL, 167 | // |buffer| will not be modified. 168 | FPDF_EXPORT unsigned long FPDF_CALLCONV 169 | FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element, 170 | void* buffer, 171 | unsigned long buflen); 172 | 173 | // Function: FPDF_StructElement_GetTitle 174 | // Get the title (/T) for a given element. 175 | // Parameters: 176 | // struct_element - Handle to the struct element. 177 | // buffer - A buffer for output. May be NULL. 178 | // buflen - The length of the buffer, in bytes. May be 0. 179 | // Return value: 180 | // The number of bytes in the title, including the terminating NUL 181 | // character. The number of bytes is returned regardless of the 182 | // |buffer| and |buflen| parameters. 183 | // Comments: 184 | // Regardless of the platform, the |buffer| is always in UTF-16LE 185 | // encoding. The string is terminated by a UTF16 NUL character. If 186 | // |buflen| is less than the required length, or |buffer| is NULL, 187 | // |buffer| will not be modified. 188 | FPDF_EXPORT unsigned long FPDF_CALLCONV 189 | FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element, 190 | void* buffer, 191 | unsigned long buflen); 192 | 193 | // Function: FPDF_StructElement_CountChildren 194 | // Count the number of children for the structure element. 195 | // Parameters: 196 | // struct_element - Handle to the struct element. 197 | // Return value: 198 | // The number of children, or -1 on error. 199 | FPDF_EXPORT int FPDF_CALLCONV 200 | FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element); 201 | 202 | // Function: FPDF_StructElement_GetChildAtIndex 203 | // Get a child in the structure element. 204 | // Parameters: 205 | // struct_tree - Handle to the struct element. 206 | // index - The index for the child, 0-based. 207 | // Return value: 208 | // The child at the n-th index or NULL on error. 209 | // Comments: 210 | // If the child exists but is not an element, then this function will 211 | // return NULL. This will also return NULL for out of bounds indices. 212 | FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV 213 | FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element, 214 | int index); 215 | 216 | #ifdef __cplusplus 217 | } // extern "C" 218 | #endif 219 | 220 | #endif // PUBLIC_FPDF_STRUCTTREE_H_ 221 | -------------------------------------------------------------------------------- /include/public/fpdf_sysfontinfo.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_SYSFONTINFO_H_ 8 | #define PUBLIC_FPDF_SYSFONTINFO_H_ 9 | 10 | // clang-format off 11 | // NOLINTNEXTLINE(build/include) 12 | #include "fpdfview.h" 13 | 14 | /* Character sets for the font */ 15 | #define FXFONT_ANSI_CHARSET 0 16 | #define FXFONT_DEFAULT_CHARSET 1 17 | #define FXFONT_SYMBOL_CHARSET 2 18 | #define FXFONT_SHIFTJIS_CHARSET 128 19 | #define FXFONT_HANGEUL_CHARSET 129 20 | #define FXFONT_GB2312_CHARSET 134 21 | #define FXFONT_CHINESEBIG5_CHARSET 136 22 | #define FXFONT_ARABIC_CHARSET 178 23 | #define FXFONT_CYRILLIC_CHARSET 204 24 | #define FXFONT_EASTERNEUROPEAN_CHARSET 238 25 | 26 | /* Font pitch and family flags */ 27 | #define FXFONT_FF_FIXEDPITCH (1 << 0) 28 | #define FXFONT_FF_ROMAN (1 << 4) 29 | #define FXFONT_FF_SCRIPT (4 << 4) 30 | 31 | /* Typical weight values */ 32 | #define FXFONT_FW_NORMAL 400 33 | #define FXFONT_FW_BOLD 700 34 | 35 | // Exported Functions 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /* 41 | * Interface: FPDF_SYSFONTINFO 42 | * Interface for getting system font information and font mapping 43 | */ 44 | typedef struct _FPDF_SYSFONTINFO { 45 | /* 46 | * Version number of the interface. Currently must be 1. 47 | */ 48 | int version; 49 | 50 | /* 51 | * Method: Release 52 | * Give implementation a chance to release any data after the 53 | * interface is no longer used. 54 | * Interface Version: 55 | * 1 56 | * Implementation Required: 57 | * No 58 | * Parameters: 59 | * pThis - Pointer to the interface structure itself 60 | * Return Value: 61 | * None 62 | * Comments: 63 | * Called by PDFium during the final cleanup process. 64 | */ 65 | void (*Release)(struct _FPDF_SYSFONTINFO* pThis); 66 | 67 | /* 68 | * Method: EnumFonts 69 | * Enumerate all fonts installed on the system 70 | * Interface Version: 71 | * 1 72 | * Implementation Required: 73 | * No 74 | * Parameters: 75 | * pThis - Pointer to the interface structure itself 76 | * pMapper - An opaque pointer to internal font mapper, used 77 | * when calling FPDF_AddInstalledFont(). 78 | * Return Value: 79 | * None 80 | * Comments: 81 | * Implementations should call FPDF_AddIntalledFont() function for 82 | * each font found. Only TrueType/OpenType and Type1 fonts are accepted 83 | * by PDFium. 84 | */ 85 | void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper); 86 | 87 | /* 88 | * Method: MapFont 89 | * Use the system font mapper to get a font handle from requested 90 | * parameters. 91 | * Interface Version: 92 | * 1 93 | * Implementation Required: 94 | * Required if GetFont method is not implemented. 95 | * Parameters: 96 | * pThis - Pointer to the interface structure itself 97 | * weight - Weight of the requested font. 400 is normal and 98 | * 700 is bold. 99 | * bItalic - Italic option of the requested font, TRUE or 100 | * FALSE. 101 | * charset - Character set identifier for the requested font. 102 | * See above defined constants. 103 | * pitch_family - A combination of flags. See above defined 104 | * constants. 105 | * face - Typeface name. Currently use system local encoding 106 | * only. 107 | * bExact - Obsolete: this parameter is now ignored. 108 | * Return Value: 109 | * An opaque pointer for font handle, or NULL if system mapping is 110 | * not supported. 111 | * Comments: 112 | * If the system supports native font mapper (like Windows), 113 | * implementation can implement this method to get a font handle. 114 | * Otherwise, PDFium will do the mapping and then call GetFont 115 | * method. Only TrueType/OpenType and Type1 fonts are accepted 116 | * by PDFium. 117 | */ 118 | void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, 119 | int weight, 120 | FPDF_BOOL bItalic, 121 | int charset, 122 | int pitch_family, 123 | const char* face, 124 | FPDF_BOOL* bExact); 125 | 126 | /* 127 | * Method: GetFont 128 | * Get a handle to a particular font by its internal ID 129 | * Interface Version: 130 | * 1 131 | * Implementation Required: 132 | * Required if MapFont method is not implemented. 133 | * Return Value: 134 | * An opaque pointer for font handle. 135 | * Parameters: 136 | * pThis - Pointer to the interface structure itself 137 | * face - Typeface name in system local encoding. 138 | * Comments: 139 | * If the system mapping not supported, PDFium will do the font 140 | * mapping and use this method to get a font handle. 141 | */ 142 | void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face); 143 | 144 | /* 145 | * Method: GetFontData 146 | * Get font data from a font 147 | * Interface Version: 148 | * 1 149 | * Implementation Required: 150 | * Yes 151 | * Parameters: 152 | * pThis - Pointer to the interface structure itself 153 | * hFont - Font handle returned by MapFont or GetFont method 154 | * table - TrueType/OpenType table identifier (refer to 155 | * TrueType specification), or 0 for the whole file. 156 | * buffer - The buffer receiving the font data. Can be NULL if 157 | * not provided. 158 | * buf_size - Buffer size, can be zero if not provided. 159 | * Return Value: 160 | * Number of bytes needed, if buffer not provided or not large 161 | * enough, or number of bytes written into buffer otherwise. 162 | * Comments: 163 | * Can read either the full font file, or a particular 164 | * TrueType/OpenType table. 165 | */ 166 | unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis, 167 | void* hFont, 168 | unsigned int table, 169 | unsigned char* buffer, 170 | unsigned long buf_size); 171 | 172 | /* 173 | * Method: GetFaceName 174 | * Get face name from a font handle 175 | * Interface Version: 176 | * 1 177 | * Implementation Required: 178 | * No 179 | * Parameters: 180 | * pThis - Pointer to the interface structure itself 181 | * hFont - Font handle returned by MapFont or GetFont method 182 | * buffer - The buffer receiving the face name. Can be NULL if 183 | * not provided 184 | * buf_size - Buffer size, can be zero if not provided 185 | * Return Value: 186 | * Number of bytes needed, if buffer not provided or not large 187 | * enough, or number of bytes written into buffer otherwise. 188 | */ 189 | unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis, 190 | void* hFont, 191 | char* buffer, 192 | unsigned long buf_size); 193 | 194 | /* 195 | * Method: GetFontCharset 196 | * Get character set information for a font handle 197 | * Interface Version: 198 | * 1 199 | * Implementation Required: 200 | * No 201 | * Parameters: 202 | * pThis - Pointer to the interface structure itself 203 | * hFont - Font handle returned by MapFont or GetFont method 204 | * Return Value: 205 | * Character set identifier. See defined constants above. 206 | */ 207 | int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); 208 | 209 | /* 210 | * Method: DeleteFont 211 | * Delete a font handle 212 | * Interface Version: 213 | * 1 214 | * Implementation Required: 215 | * Yes 216 | * Parameters: 217 | * pThis - Pointer to the interface structure itself 218 | * hFont - Font handle returned by MapFont or GetFont method 219 | * Return Value: 220 | * None 221 | */ 222 | void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); 223 | } FPDF_SYSFONTINFO; 224 | 225 | /* 226 | * Struct: FPDF_CharsetFontMap 227 | * Provides the name of a font to use for a given charset value. 228 | */ 229 | typedef struct FPDF_CharsetFontMap_ { 230 | int charset; // Character Set Enum value, see FXFONT_*_CHARSET above. 231 | const char* fontname; // Name of default font to use with that charset. 232 | } FPDF_CharsetFontMap; 233 | 234 | /* 235 | * Function: FPDF_GetDefaultTTFMap 236 | * Returns a pointer to the default character set to TT Font name map. The 237 | * map is an array of FPDF_CharsetFontMap structs, with its end indicated 238 | * by a { -1, NULL } entry. 239 | * Parameters: 240 | * None. 241 | * Return Value: 242 | * Pointer to the Charset Font Map. 243 | */ 244 | FPDF_EXPORT const FPDF_CharsetFontMap* FPDF_CALLCONV FPDF_GetDefaultTTFMap(); 245 | 246 | /* 247 | * Function: FPDF_AddInstalledFont 248 | * Add a system font to the list in PDFium. 249 | * Comments: 250 | * This function is only called during the system font list building 251 | * process. 252 | * Parameters: 253 | * mapper - Opaque pointer to Foxit font mapper 254 | * face - The font face name 255 | * charset - Font character set. See above defined constants. 256 | * Return Value: 257 | * None. 258 | */ 259 | FPDF_EXPORT void FPDF_CALLCONV FPDF_AddInstalledFont(void* mapper, 260 | const char* face, 261 | int charset); 262 | 263 | /* 264 | * Function: FPDF_SetSystemFontInfo 265 | * Set the system font info interface into PDFium 266 | * Parameters: 267 | * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure 268 | * Return Value: 269 | * None 270 | * Comments: 271 | * Platform support implementation should implement required methods of 272 | * FFDF_SYSFONTINFO interface, then call this function during PDFium 273 | * initialization process. 274 | */ 275 | FPDF_EXPORT void FPDF_CALLCONV 276 | FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); 277 | 278 | /* 279 | * Function: FPDF_GetDefaultSystemFontInfo 280 | * Get default system font info interface for current platform 281 | * Parameters: 282 | * None 283 | * Return Value: 284 | * Pointer to a FPDF_SYSFONTINFO structure describing the default 285 | * interface, or NULL if the platform doesn't have a default interface. 286 | * Application should call FPDF_FreeDefaultSystemFontInfo to free the 287 | * returned pointer. 288 | * Comments: 289 | * For some platforms, PDFium implements a default version of system 290 | * font info interface. The default implementation can be passed to 291 | * FPDF_SetSystemFontInfo(). 292 | */ 293 | FPDF_EXPORT FPDF_SYSFONTINFO* FPDF_CALLCONV FPDF_GetDefaultSystemFontInfo(); 294 | 295 | /* 296 | * Function: FPDF_FreeDefaultSystemFontInfo 297 | * Free a default system font info interface 298 | * Parameters: 299 | * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure 300 | * Return Value: 301 | * None 302 | * Comments: 303 | * This function should be called on the output from 304 | * FPDF_SetSystemFontInfo() once it is no longer needed. 305 | */ 306 | FPDF_EXPORT void FPDF_CALLCONV 307 | FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); 308 | 309 | #ifdef __cplusplus 310 | } 311 | #endif 312 | 313 | #endif // PUBLIC_FPDF_SYSFONTINFO_H_ 314 | -------------------------------------------------------------------------------- /include/public/fpdf_thumbnail.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef PUBLIC_FPDF_THUMBNAIL_H_ 6 | #define PUBLIC_FPDF_THUMBNAIL_H_ 7 | 8 | #include 9 | 10 | // NOLINTNEXTLINE(build/include) 11 | #include "fpdfview.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | // Experimental API. 18 | // Gets the decoded data from the thumbnail of |page| if it exists. 19 | // This only modifies |buffer| if |buflen| less than or equal to the 20 | // size of the decoded data. Returns the size of the decoded 21 | // data or 0 if thumbnail DNE. Optional, pass null to just retrieve 22 | // the size of the buffer needed. 23 | // 24 | // page - handle to a page. 25 | // buffer - buffer for holding the decoded image data. 26 | // buflen - length of the buffer in bytes. 27 | FPDF_EXPORT unsigned long FPDF_CALLCONV 28 | FPDFPage_GetDecodedThumbnailData(FPDF_PAGE page, 29 | void* buffer, 30 | unsigned long buflen); 31 | 32 | // Experimental API. 33 | // Gets the raw data from the thumbnail of |page| if it exists. 34 | // This only modifies |buffer| if |buflen| is less than or equal to 35 | // the size of the raw data. Returns the size of the raw data or 0 36 | // if thumbnail DNE. Optional, pass null to just retrieve the size 37 | // of the buffer needed. 38 | // 39 | // page - handle to a page. 40 | // buffer - buffer for holding the raw image data. 41 | // buflen - length of the buffer in bytes. 42 | FPDF_EXPORT unsigned long FPDF_CALLCONV 43 | FPDFPage_GetRawThumbnailData(FPDF_PAGE page, 44 | void* buffer, 45 | unsigned long buflen); 46 | 47 | // Experimental API. 48 | // Returns the thumbnail of |page| as a FPDF_BITMAP. Returns a nullptr 49 | // if unable to access the thumbnail's stream. 50 | // 51 | // page - handle to a page. 52 | FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV 53 | FPDFPage_GetThumbnailAsBitmap(FPDF_PAGE page); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif // PUBLIC_FPDF_THUMBNAIL_H_ 60 | -------------------------------------------------------------------------------- /include/public/fpdf_transformpage.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 PDFium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 | 7 | #ifndef PUBLIC_FPDF_TRANSFORMPAGE_H_ 8 | #define PUBLIC_FPDF_TRANSFORMPAGE_H_ 9 | 10 | // NOLINTNEXTLINE(build/include) 11 | #include "fpdfview.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /** 18 | * Set "MediaBox" entry to the page dictionary. 19 | * 20 | * page - Handle to a page. 21 | * left - The left of the rectangle. 22 | * bottom - The bottom of the rectangle. 23 | * right - The right of the rectangle. 24 | * top - The top of the rectangle. 25 | */ 26 | FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetMediaBox(FPDF_PAGE page, 27 | float left, 28 | float bottom, 29 | float right, 30 | float top); 31 | 32 | /** 33 | * Set "CropBox" entry to the page dictionary. 34 | * 35 | * page - Handle to a page. 36 | * left - The left of the rectangle. 37 | * bottom - The bottom of the rectangle. 38 | * right - The right of the rectangle. 39 | * top - The top of the rectangle. 40 | */ 41 | FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page, 42 | float left, 43 | float bottom, 44 | float right, 45 | float top); 46 | 47 | /** 48 | * Set "BleedBox" entry to the page dictionary. 49 | * 50 | * page - Handle to a page. 51 | * left - The left of the rectangle. 52 | * bottom - The bottom of the rectangle. 53 | * right - The right of the rectangle. 54 | * top - The top of the rectangle. 55 | */ 56 | FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetBleedBox(FPDF_PAGE page, 57 | float left, 58 | float bottom, 59 | float right, 60 | float top); 61 | 62 | /** 63 | * Set "TrimBox" entry to the page dictionary. 64 | * 65 | * page - Handle to a page. 66 | * left - The left of the rectangle. 67 | * bottom - The bottom of the rectangle. 68 | * right - The right of the rectangle. 69 | * top - The top of the rectangle. 70 | */ 71 | FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetTrimBox(FPDF_PAGE page, 72 | float left, 73 | float bottom, 74 | float right, 75 | float top); 76 | 77 | /** 78 | * Set "ArtBox" entry to the page dictionary. 79 | * 80 | * page - Handle to a page. 81 | * left - The left of the rectangle. 82 | * bottom - The bottom of the rectangle. 83 | * right - The right of the rectangle. 84 | * top - The top of the rectangle. 85 | */ 86 | FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetArtBox(FPDF_PAGE page, 87 | float left, 88 | float bottom, 89 | float right, 90 | float top); 91 | 92 | /** 93 | * Get "MediaBox" entry from the page dictionary. 94 | * 95 | * page - Handle to a page. 96 | * left - Pointer to a float value receiving the left of the rectangle. 97 | * bottom - Pointer to a float value receiving the bottom of the rectangle. 98 | * right - Pointer to a float value receiving the right of the rectangle. 99 | * top - Pointer to a float value receiving the top of the rectangle. 100 | * 101 | * On success, return true and write to the out parameters. Otherwise return 102 | * false and leave the out parameters unmodified. 103 | */ 104 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetMediaBox(FPDF_PAGE page, 105 | float* left, 106 | float* bottom, 107 | float* right, 108 | float* top); 109 | 110 | /** 111 | * Get "CropBox" entry from the page dictionary. 112 | * 113 | * page - Handle to a page. 114 | * left - Pointer to a float value receiving the left of the rectangle. 115 | * bottom - Pointer to a float value receiving the bottom of the rectangle. 116 | * right - Pointer to a float value receiving the right of the rectangle. 117 | * top - Pointer to a float value receiving the top of the rectangle. 118 | * 119 | * On success, return true and write to the out parameters. Otherwise return 120 | * false and leave the out parameters unmodified. 121 | */ 122 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetCropBox(FPDF_PAGE page, 123 | float* left, 124 | float* bottom, 125 | float* right, 126 | float* top); 127 | 128 | /** 129 | * Get "BleedBox" entry from the page dictionary. 130 | * 131 | * page - Handle to a page. 132 | * left - Pointer to a float value receiving the left of the rectangle. 133 | * bottom - Pointer to a float value receiving the bottom of the rectangle. 134 | * right - Pointer to a float value receiving the right of the rectangle. 135 | * top - Pointer to a float value receiving the top of the rectangle. 136 | * 137 | * On success, return true and write to the out parameters. Otherwise return 138 | * false and leave the out parameters unmodified. 139 | */ 140 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetBleedBox(FPDF_PAGE page, 141 | float* left, 142 | float* bottom, 143 | float* right, 144 | float* top); 145 | 146 | /** 147 | * Get "TrimBox" entry from the page dictionary. 148 | * 149 | * page - Handle to a page. 150 | * left - Pointer to a float value receiving the left of the rectangle. 151 | * bottom - Pointer to a float value receiving the bottom of the rectangle. 152 | * right - Pointer to a float value receiving the right of the rectangle. 153 | * top - Pointer to a float value receiving the top of the rectangle. 154 | * 155 | * On success, return true and write to the out parameters. Otherwise return 156 | * false and leave the out parameters unmodified. 157 | */ 158 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetTrimBox(FPDF_PAGE page, 159 | float* left, 160 | float* bottom, 161 | float* right, 162 | float* top); 163 | 164 | /** 165 | * Get "ArtBox" entry from the page dictionary. 166 | * 167 | * page - Handle to a page. 168 | * left - Pointer to a float value receiving the left of the rectangle. 169 | * bottom - Pointer to a float value receiving the bottom of the rectangle. 170 | * right - Pointer to a float value receiving the right of the rectangle. 171 | * top - Pointer to a float value receiving the top of the rectangle. 172 | * 173 | * On success, return true and write to the out parameters. Otherwise return 174 | * false and leave the out parameters unmodified. 175 | */ 176 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetArtBox(FPDF_PAGE page, 177 | float* left, 178 | float* bottom, 179 | float* right, 180 | float* top); 181 | 182 | /** 183 | * Apply transforms to |page|. 184 | * 185 | * If |matrix| is provided it will be applied to transform the page. 186 | * If |clipRect| is provided it will be used to clip the resulting page. 187 | * If neither |matrix| or |clipRect| are provided this method returns |false|. 188 | * Returns |true| if transforms are applied. 189 | * 190 | * This function will transform the whole page, and would take effect to all the 191 | * objects in the page. 192 | * 193 | * page - Page handle. 194 | * matrix - Transform matrix. 195 | * clipRect - Clipping rectangle. 196 | */ 197 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 198 | FPDFPage_TransFormWithClip(FPDF_PAGE page, 199 | const FS_MATRIX* matrix, 200 | const FS_RECTF* clipRect); 201 | 202 | /** 203 | * Transform (scale, rotate, shear, move) the clip path of page object. 204 | * page_object - Handle to a page object. Returned by 205 | * FPDFPageObj_NewImageObj(). 206 | * 207 | * a - The coefficient "a" of the matrix. 208 | * b - The coefficient "b" of the matrix. 209 | * c - The coefficient "c" of the matrix. 210 | * d - The coefficient "d" of the matrix. 211 | * e - The coefficient "e" of the matrix. 212 | * f - The coefficient "f" of the matrix. 213 | */ 214 | FPDF_EXPORT void FPDF_CALLCONV 215 | FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, 216 | double a, 217 | double b, 218 | double c, 219 | double d, 220 | double e, 221 | double f); 222 | 223 | // Experimental API. 224 | // Get the clip path of the page object. 225 | // 226 | // page object - Handle to a page object. Returned by e.g. 227 | // FPDFPage_GetObject(). 228 | // 229 | // Returns the handle to the clip path, or NULL on failure. The caller does not 230 | // take ownership of the returned FPDF_CLIPPATH. Instead, it remains valid until 231 | // FPDF_ClosePage() is called for the page containing |page_object|. 232 | FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV 233 | FPDFPageObj_GetClipPath(FPDF_PAGEOBJECT page_object); 234 | 235 | // Experimental API. 236 | // Get number of paths inside |clip_path|. 237 | // 238 | // clip_path - handle to a clip_path. 239 | // 240 | // Returns the number of objects in |clip_path| or -1 on failure. 241 | FPDF_EXPORT int FPDF_CALLCONV FPDFClipPath_CountPaths(FPDF_CLIPPATH clip_path); 242 | 243 | // Experimental API. 244 | // Get number of segments inside one path of |clip_path|. 245 | // 246 | // clip_path - handle to a clip_path. 247 | // path_index - index into the array of paths of the clip path. 248 | // 249 | // Returns the number of segments or -1 on failure. 250 | FPDF_EXPORT int FPDF_CALLCONV 251 | FPDFClipPath_CountPathSegments(FPDF_CLIPPATH clip_path, int path_index); 252 | 253 | // Experimental API. 254 | // Get segment in one specific path of |clip_path| at index. 255 | // 256 | // clip_path - handle to a clip_path. 257 | // path_index - the index of a path. 258 | // segment_index - the index of a segment. 259 | // 260 | // Returns the handle to the segment, or NULL on failure. The caller does not 261 | // take ownership of the returned FPDF_PATHSEGMENT. Instead, it remains valid 262 | // until FPDF_ClosePage() is called for the page containing |clip_path|. 263 | FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV 264 | FPDFClipPath_GetPathSegment(FPDF_CLIPPATH clip_path, 265 | int path_index, 266 | int segment_index); 267 | 268 | /** 269 | * Create a new clip path, with a rectangle inserted. 270 | * 271 | * Caller takes ownership of the returned FPDF_CLIPPATH. It should be freed with 272 | * FPDF_DestroyClipPath(). 273 | * 274 | * left - The left of the clip box. 275 | * bottom - The bottom of the clip box. 276 | * right - The right of the clip box. 277 | * top - The top of the clip box. 278 | */ 279 | FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV FPDF_CreateClipPath(float left, 280 | float bottom, 281 | float right, 282 | float top); 283 | 284 | /** 285 | * Destroy the clip path. 286 | * 287 | * clipPath - A handle to the clip path. It will be invalid after this call. 288 | */ 289 | FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath); 290 | 291 | /** 292 | * Clip the page content, the page content that outside the clipping region 293 | * become invisible. 294 | * 295 | * A clip path will be inserted before the page content stream or content array. 296 | * In this way, the page content will be clipped by this clip path. 297 | * 298 | * page - A page handle. 299 | * clipPath - A handle to the clip path. (Does not take ownership.) 300 | */ 301 | FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page, 302 | FPDF_CLIPPATH clipPath); 303 | 304 | #ifdef __cplusplus 305 | } 306 | #endif 307 | 308 | #endif // PUBLIC_FPDF_TRANSFORMPAGE_H_ 309 | -------------------------------------------------------------------------------- /include/xilou_public/xilou_convert.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2023 chingliu. All rights reserved. 3 | * 4 | * @file xilou_convert.h 5 | * @author 余清留(chingliu) 6 | * @date 2023-5-01 7 | * @brief PDF/OFD互转接口 8 | */ 9 | #ifndef XILOU_PUBLIC_XILOU_CONVERT_H_ 10 | #define XILOU_PUBLIC_XILOU_CONVERT_H_ 11 | 12 | #include "xilou_view.h" 13 | 14 | // Exported Functions 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | XILOU_EXPORT bool XILOU_CALLCONV 20 | xilou_Convert(XILOU_UTF8STRING src_fpath, 21 | XILOU_UTF8STRING dest_fpath, 22 | XILOU_UTF8STRING page_range); 23 | ///////////////////////////////////////////////////////////////////////////////////// 24 | /// @brief 将图像作为新页面追加到文档中去 25 | /// @param[in/out] pkg 如果*pkg= NULL,会创建新文档,并在pkg中返回新文档句柄,否则追加到指定文档中 26 | /// @param[in] img_path 图像绝对路径,png,jpg 27 | /// @return 0成功,其它错误 28 | /// @since 29 | /// @author chingliu 30 | /// @note pkg需要关闭 xilou_ClosePackage,目前 pkg只能限定在pdf格式,ofd格式未实现 31 | XILOU_EXPORT int XILOU_CALLCONV 32 | xilou_AppendImagePage(XILOU_PACKAGE* pkg, XILOU_UTF8STRING img_path); 33 | 34 | ///////////////////////////////////////////////////////////////////////////////////// 35 | /// @brief 将pkg保存到dst_path指定的路径上 36 | /// @param[in] pkg 可以是xilout_openpackage,或xilou_AppendImagePage生成的pkg 37 | /// @param[dst_path] 目标路径 38 | /// @return 0成功,其它错误 39 | /// @since 40 | /// @author chingliu 41 | /// @note 实际上此函数是为xilou_AppendImagePage服务,所为目前未实现pkg为ofd的场景,pkg为ofd时保存会失败。 42 | XILOU_EXPORT int XILOU_CALLCONV xilou_Save2File(XILOU_PACKAGE* pkg, 43 | XILOU_UTF8STRING dst_path); 44 | 45 | ///////////////////////////////////////////////////////////////////////////////////// 46 | /// @brief 将text附加于指定页面上 47 | /// @param[in] pkg 可以是xilout_openpackage,或xilou_AppendImagePage生成的pkg 48 | /// @param[page_idx] 页码,从0开始, 49 | /// @param[txt_json] 一个UTF8编码的json格式的字符串,格式如下: 50 | /// { 51 | ///"ocrResult" : [ { 52 | /// "text" : "测试字符串", 53 | /// "location" : { 54 | /// "left" : 89.91585, 55 | /// "top" : 87.620804, 56 | /// "right" : 693.8248, 57 | /// "bottom" : 151.00175 58 | /// }, 59 | /// "pos" : {"x" : 90.1736, "y" : 87.620804} 60 | ///} ] 61 | ///} 62 | /// @return 0成功,其它错误 63 | /// @since 64 | /// @author chingliu 65 | /// @note 66 | XILOU_EXPORT int XILOU_CALLCONV xilou_AddTextOnPage(XILOU_PACKAGE pkg, 67 | int page_idx, 68 | XILOU_UTF8STRING txt_json); 69 | 70 | 71 | XILOU_EXPORT int XILOU_CALLCONV 72 | xilou_OfdMerge(XILOU_UTF8STRING merge2ofd_path, 73 | XILOU_UTF8STRING been_merged_ofd_path); 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif -------------------------------------------------------------------------------- /include/xilou_public/xilou_errcode.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2023 chingliu. All rights reserved. 3 | * 4 | * @file xilou_view.h 5 | * @author 余清留(chingliu) 6 | * @date 2023-5-01 7 | * @brief 引擎层错误码定义 8 | */ 9 | #ifndef XILOU_PUBLIC_XILOU_ERROR_CODE_HEADER_H 10 | #define XILOU_PUBLIC_XILOU_ERROR_CODE_HEADER_H 11 | 12 | 13 | 14 | /** 15 | * 成功 16 | */ 17 | #define XILOU_E_SUC 0 18 | 19 | /** 20 | * 未实现功能 21 | */ 22 | #define XILOU_E_NOTIMPLEMENT 1 23 | 24 | /** 25 | * 图像解析错误 26 | */ 27 | #define XILOU_E_LOADIMAGE 10000 28 | 29 | /** 30 | * 错误的文档句柄类型 31 | */ 32 | #define XILOU_E_FILEHANDLETYPE 10001 33 | 34 | /** 35 | * 生成新对象错误 36 | */ 37 | #define XILOU_E_NEWPAGEOBJECT 10002 38 | 39 | /** 40 | * 设置BITMAP错误 41 | */ 42 | #define XILOU_E_SETBITMAP 10003 43 | 44 | /** 45 | * 构建新页面错误 46 | */ 47 | #define XILOU_E_NEWPAGE 10004 48 | 49 | /** 50 | * 无效的参数 51 | */ 52 | #define XILOU_E_INVALIDPARAMETER 10005 53 | 54 | /** 55 | * 页码错误 56 | */ 57 | #define XILOU_E_INVALIDPAGEINDEX 10006 58 | 59 | /** 60 | * 附加文字的json格式错误 61 | */ 62 | #define XILOU_E_INVALIDTEXTJSON 10007 63 | 64 | /** 65 | * LoadPage错误 66 | */ 67 | #define XILOU_E_LOADPAGE 10008 68 | 69 | /** 70 | * 读取字体文件失败 71 | */ 72 | #define XILOU_E_READFONTFILE 10009 73 | /** 74 | * 加载字体资源失败 75 | */ 76 | #define XILOU_E_LOADFONTDATA 10010 77 | /** 78 | * PDF错误起始号 79 | */ 80 | #define XILOU_E_PDF 20000 81 | 82 | /** 83 | * PDF转OFD错误 84 | */ 85 | #define XILOU_E_PDF2OFD 20001 86 | 87 | /** 88 | * OFD错误起始号 89 | */ 90 | #define XILOU_E_OFD 40000 91 | /** 92 | * 无效的signature.xml 93 | */ 94 | #define XILOU_E_OFD_INVALID_SIGNATURE_XML 40001 95 | 96 | /** 97 | * 无效的signature.xml 98 | */ 99 | #define XILOU_E_OFD_OES_LOADER 40002 100 | /** 101 | * 条目的hash值发生了变化 102 | */ 103 | #define XILOU_E_OFD_ENTRY_HASH 40003 104 | 105 | /** 106 | * 签名值验证失败 107 | */ 108 | #define XILOU_E_OFD_SIGNED_VERIFY_ERROR 40004 109 | 110 | /** 111 | * feature not implement 112 | */ 113 | #define XILOU_E_FEATURE_NOT_IMPLEMENT_ERROR 40005 114 | 115 | /** 116 | * invalid handle 117 | */ 118 | #define XILOU_E_INVALID_HANDLE_ERROR 40006 119 | 120 | /** 121 | * out of range 122 | */ 123 | #define XILOU_E_OUT_OF_RANGE_ERROR 40007 124 | 125 | /** 126 | * 打开zip失败 127 | */ 128 | #define XILOU_E_FAILEDOPENZIP 40008 129 | 130 | #endif -------------------------------------------------------------------------------- /include/xilou_public/xilou_logger.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/include/xilou_public/xilou_logger.h -------------------------------------------------------------------------------- /include/xilou_public/xilou_signature.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2023 chingliu. All rights reserved. 3 | * 4 | * @file xilou_signature.h 5 | * @author 余清留(chingliu) 6 | * @date 2023-11-22 7 | * @brief PDF/OFD签名验签接口 8 | */ 9 | #ifndef XILOU_PUBLIC_XILOU_SIGNATURE_H_ 10 | #define XILOU_PUBLIC_XILOU_SIGNATURE_H_ 11 | 12 | #include "xilou_view.h" 13 | 14 | 15 | // Exported Functions 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | XILOU_EXPORT unsigned long XILOU_CALLCONV xilou_verify(XILOU_DOCUMENT document, 22 | int index); 23 | 24 | ///////////////////////////////////////////////////////////////////////////////////// 25 | /// @brief 获取签章数量 26 | /// @param[in] document 27 | /// 28 | /// @param[out] >0 签章数量 , <0 错误 29 | /// @return 30 | /// @since 31 | /// @author chingliu 32 | XILOU_EXPORT long XILOU_CALLCONV 33 | xilou_docsign_count(XILOU_DOCUMENT document); 34 | 35 | XILOU_EXPORT size_t XILOU_CALLCONV xilou_sig_errmsg(XILOU_DOCUMENT document, 36 | int index, unsigned char **errmsg); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif -------------------------------------------------------------------------------- /include/xilou_public/xilou_view.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2023 chingliu. All rights reserved. 3 | * 4 | * @file xilou_view.h 5 | * @author 余清留(chingliu) 6 | * @date 2023-5-01 7 | * @brief PDF/OFD双版式,库/文档/页相关接口 8 | */ 9 | #ifndef XILOU_PUBLIC_XILOU_VIEW_H_ 10 | #define XILOU_PUBLIC_XILOU_VIEW_H_ 11 | 12 | 13 | #include 14 | 15 | #if defined(_WIN32) && !defined(__WINDOWS__) 16 | #include 17 | #endif 18 | 19 | #if defined(COMPONENT_BUILD) 20 | #if defined(WIN32) 21 | #if defined(FPDF_IMPLEMENTATION) 22 | #define XILOU_EXPORT __declspec(dllexport) 23 | #else 24 | #define XILOU_EXPORT __declspec(dllimport) 25 | #endif // defined(FPDF_IMPLEMENTATION) 26 | #else 27 | #if defined(FPDF_IMPLEMENTATION) 28 | #define XILOU_EXPORT __attribute__((visibility("default"))) 29 | #else 30 | #define XILOU_EXPORT 31 | #endif // defined(FPDF_IMPLEMENTATION) 32 | #endif // defined(WIN32) 33 | #else 34 | #define XILOU_EXPORT 35 | #endif // defined(COMPONENT_BUILD) 36 | 37 | #if defined(WIN32) && defined(FPDFSDK_EXPORTS) 38 | #define XILOU_CALLCONV __stdcall 39 | #else 40 | #define XILOU_CALLCONV 41 | #endif 42 | 43 | 44 | typedef struct xilou_package_t__* XILOU_PACKAGE; 45 | typedef struct xilou_document_t__* XILOU_DOCUMENT; 46 | typedef struct xilou_page_t__* XILOU_PAGE; 47 | 48 | typedef struct fpdf_bitmap_t__* FPDF_BITMAP; 49 | typedef FPDF_BITMAP XILOU_BITMAP; 50 | 51 | //see FPDF_STRING 52 | typedef const char* XILOU_STRING; 53 | //see FPDF_BYTESTRING 54 | typedef const char* XILOU_BYTESTRING; 55 | 56 | typedef const char* XILOU_UTF8STRING; 57 | 58 | // Exported Functions 59 | #ifdef __cplusplus 60 | extern "C" { 61 | #endif 62 | 63 | ///////////////////////////////////////////////////////////////////////////////////// 64 | /// @brief 库初始化 65 | /// @param[in] 66 | /// @param[out] 67 | /// @param[in] 68 | /// @return 69 | /// @since 70 | /// @author chingliu 71 | /// @note 72 | XILOU_EXPORT void XILOU_CALLCONV xilou_InitLibrary(); 73 | 74 | ///////////////////////////////////////////////////////////////////////////////////// 75 | /// @brief 库释放 76 | /// @param[in] 77 | /// @param[out] 78 | /// @param[in] 79 | /// @return 80 | /// @since 81 | /// @author chingliu 82 | /// @note 83 | XILOU_EXPORT void XILOU_CALLCONV xilou_DestroyLibrary(); 84 | 85 | ///////////////////////////////////////////////////////////////////////////////////// 86 | /// @brief 载入文件 87 | /// @param[in] file_path 文件路径,UTF8编码 88 | /// @param[out] XILOU_PACKAGE 句柄 89 | /// @return 90 | /// @since 91 | /// @author chingliu 92 | /// @note 93 | XILOU_EXPORT XILOU_PACKAGE XILOU_CALLCONV 94 | xilou_OpenPackage(XILOU_UTF8STRING file_path, XILOU_BYTESTRING password); 95 | XILOU_EXPORT void XILOU_CALLCONV xilou_ClosePackage(XILOU_PACKAGE package); 96 | ///////////////////////////////////////////////////////////////////////////////////// 97 | /// @brief 打开包内指定文档 98 | /// @param[in] package xilou_OpenPackage返回的包句柄。 99 | /// @param[in] index 文档索引,从零开始。 100 | /// @param[out] XILOU_DOCUMENT 文件句柄 101 | /// @return 102 | /// @since 103 | /// @author chingliu 104 | /// @note 105 | XILOU_EXPORT XILOU_DOCUMENT XILOU_CALLCONV 106 | xilou_LoadDocument(XILOU_PACKAGE package, int index); 107 | XILOU_EXPORT void XILOU_CALLCONV xilou_DropDocument(XILOU_DOCUMENT document); 108 | 109 | ///////////////////////////////////////////////////////////////////////////////////// 110 | /// @brief 获取页面总数 111 | /// @param[in] document 文档句柄。 112 | /// @param[out] 页面数量 113 | /// @return 114 | /// @since 115 | /// @author chingliu 116 | /// @note 117 | XILOU_EXPORT int XILOU_CALLCONV xilou_GetPageCount(XILOU_DOCUMENT document); 118 | ///////////////////////////////////////////////////////////////////////////////////// 119 | /// @brief 载入指定页 120 | /// @param[in] document 文档句柄。 121 | /// @param[in] index 页面索引,从零开始。 122 | /// @param[out] XILOU_PAGE 页面句柄 123 | /// @return 124 | /// @since 125 | /// @author chingliu 126 | /// @note 127 | XILOU_EXPORT XILOU_PAGE XILOU_CALLCONV xilou_LoadPage(XILOU_DOCUMENT document, 128 | int page_index); 129 | XILOU_EXPORT void XILOU_CALLCONV xilou_DropPage(XILOU_PAGE page); 130 | 131 | ///////////////////////////////////////////////////////////////////////////////////// 132 | /// @brief 获取页面宽 133 | /// @param[in] page 页面句柄。 134 | /// @param[out] 页面宽 135 | /// @return 136 | /// @since 137 | /// @author chingliu 138 | /// @note Page width (excluding non-displayable area) measured in points。 One point is 1/72 inch (around 0.3528 mm). 139 | XILOU_EXPORT double XILOU_CALLCONV xilou_GetPageWidth(XILOU_PAGE page); 140 | ///////////////////////////////////////////////////////////////////////////////////// 141 | /// @brief 获取页面高 142 | /// @param[in] page 页面句柄。 143 | /// @param[out] 页面高 144 | /// @return 145 | /// @since 146 | /// @author chingliu 147 | /// @note Page height (excluding non-displayable area) measured in points。 One 148 | /// point is 1/72 inch (around 0.3528 mm). 149 | XILOU_EXPORT double XILOU_CALLCONV xilou_GetPageHeight(XILOU_PAGE page); 150 | 151 | 152 | // Page rendering flags. They can be combined with bit-wise OR. 153 | // 154 | // Set if annotations are to be rendered. 155 | #define XILOUPAGRRENDER_ANNOT 0x01 156 | // Set if using text rendering optimized for LCD display. This flag will only 157 | // take effect if anti-aliasing is enabled for text. 158 | #define XILOUPAGRRENDER_LCD_TEXT 0x02 159 | // Don't use the native text output available on some platforms 160 | #define XILOUPAGRRENDER_NO_NATIVETEXT 0x04 161 | // Grayscale output. 162 | #define XILOUPAGRRENDER_GRAYSCALE 0x08 163 | // Obsolete, has no effect, retained for compatibility. 164 | #define XILOUPAGRRENDER_DEBUG_INFO 0x80 165 | // Obsolete, has no effect, retained for compatibility. 166 | #define XILOUPAGRRENDER_NO_CATCH 0x100 167 | // Limit image cache size. 168 | #define XILOUPAGRRENDER_RENDER_LIMITEDIMAGECACHE 0x200 169 | // Always use halftone for image stretching. 170 | #define XILOUPAGRRENDER_RENDER_FORCEHALFTONE 0x400 171 | // Render for printing. 172 | #define XILOUPAGRRENDER_PRINTING 0x800 173 | // Set to disable anti-aliasing on text. This flag will also disable LCD 174 | // optimization for text rendering. 175 | #define XILOUPAGRRENDER_RENDER_NO_SMOOTHTEXT 0x1000 176 | // Set to disable anti-aliasing on images. 177 | #define XILOUPAGRRENDER_RENDER_NO_SMOOTHIMAGE 0x2000 178 | // Set to disable anti-aliasing on paths. 179 | #define XILOUPAGRRENDER_RENDER_NO_SMOOTHPATH 0x4000 180 | // Set whether to render in a reverse Byte order, this flag is only used when 181 | // rendering to a bitmap. 182 | #define XILOUPAGRRENDER_REVERSE_BYTE_ORDER 0x10 183 | // Set whether fill paths need to be stroked. This flag is only used when 184 | // FPDF_COLORSCHEME is passed in, since with a single fill color for paths the 185 | // boundaries of adjacent fill paths are less visible. 186 | #define XILOUPAGRRENDER_CONVERT_FILL_TO_STROKE 0x20 187 | ///////////////////////////////////////////////////////////////////////////////////// 188 | /// @brief 获取页面高 189 | /// @param[in] 参数详解见FPDF_RenderPageBitmap,与FPDF_RenderPageBitmap参数相同。 190 | /// @param[out] 191 | /// @return 192 | /// @since 193 | /// @author chingliu 194 | XILOU_EXPORT void XILOU_CALLCONV xilou_RenderPageBitmap(XILOU_BITMAP bitmap, 195 | XILOU_PAGE page, 196 | int start_x, 197 | int start_y, 198 | int size_x, 199 | int size_y, 200 | int rotate, 201 | int flags); 202 | 203 | #ifdef __cplusplus 204 | } 205 | #endif 206 | 207 | #endif -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | QTextCodec *codec = QTextCodec::codecForName("system"); 9 | QTextCodec::setCodecForLocale(codec); 10 | QTextCodec::setCodecForCStrings(codec); 11 | QTextCodec::setCodecForTr(codec); 12 | MainWindow w; 13 | w.show(); 14 | return a.exec(); 15 | } 16 | -------------------------------------------------------------------------------- /mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "img2pdf.h" 8 | #include "ofdmerge.h" 9 | MainWindow::MainWindow(QWidget *parent) 10 | : QMainWindow(parent) 11 | , ui(new Ui::MainWindow), pageIndex(0), m_scale(1.0f) 12 | { 13 | ui->setupUi(this); 14 | ui->verticalLayout->removeWidget(ui->scrollArea); 15 | ui->scrollArea = new CScrollArea(ui->centralwidget); 16 | ui->verticalLayout->addWidget(ui->scrollArea); 17 | xiloug_setloglevel(0); 18 | xilou_InitLibrary(); 19 | m_pkg = NULL; 20 | } 21 | 22 | MainWindow::~MainWindow() 23 | { 24 | delete ui; 25 | if(m_pkg) 26 | delete m_pkg; 27 | xilou_DestroyLibrary(); 28 | } 29 | 30 | void MainWindow::on_actionopen_triggered() 31 | { 32 | QString filePath = QFileDialog::getOpenFileName(this, tr("打开"), tr(""), tr("版式文件(*.pdf *.ofd)")); 33 | if (filePath.isEmpty()) 34 | { 35 | return; 36 | } 37 | if(m_pkg){ 38 | delete m_pkg; 39 | m_pkg = NULL; 40 | } 41 | m_pkg = new CPackageManager(filePath, QString()); 42 | if(!m_pkg) 43 | { 44 | QMessageBox::information(this, tr("错误"), tr("文件打开失败!")); 45 | return; 46 | } 47 | if (!m_pkg->GetDoc()) 48 | { 49 | QMessageBox::information(this, tr("错误"), tr("文件打开失败!")); 50 | return; 51 | } 52 | // 布置阅读区 53 | initView(); 54 | } 55 | 56 | void MainWindow::initView() 57 | { 58 | if (!m_pkg->GetDoc()) 59 | { 60 | return; 61 | } 62 | // 加载页 63 | XILOU_PAGE page = m_pkg->GetPage(pageIndex);//xilou_LoadPage(m_doc, pageIndex); 64 | if(!page) 65 | return; 66 | // 获取页大小 67 | double pageW = xilou_GetPageWidth(page); 68 | double pageH = xilou_GetPageHeight(page); 69 | pageW *= m_scale; 70 | pageH *= m_scale; 71 | #if 0 72 | // 创建页图片 73 | FPDF_BITMAP pagePixmap = FPDFBitmap_Create(pageW, pageH, 1); 74 | FPDFBitmap_FillRect(pagePixmap, 0, 0, pageW, pageH, 0xFFFFFFFF); 75 | xilou_RenderPageBitmap(pagePixmap, page, 0, 0, pageW, pageH, 0, XILOUPAGRRENDER_ANNOT | XILOUPAGRRENDER_REVERSE_BYTE_ORDER); 76 | // 获取Buffer 77 | void* bgrAbuffer = FPDFBitmap_GetBuffer(pagePixmap); 78 | int pixmapW = FPDFBitmap_GetWidth(pagePixmap); 79 | int pixmapH = FPDFBitmap_GetHeight(pagePixmap); 80 | // BGRA转RGBA 81 | unsigned char* rgbAbuffer = (unsigned char* )malloc(sizeof(char) * pixmapW * pixmapH * 4); 82 | ConvertBetweenBGRAandRGBA((unsigned char* )bgrAbuffer, pixmapW, pixmapH, rgbAbuffer); 83 | // 转换为QImage 84 | m_pageImg = QImage(rgbAbuffer, pixmapW, pixmapH, QImage::Format_RGB32); 85 | FPDFBitmap_Destroy(pagePixmap); 86 | #else 87 | m_pageImg = QImage(pageW, pageH, QImage::Format_ARGB32); 88 | Q_ASSERT(!m_pageImg.isNull()); 89 | m_pageImg.fill(0xFFFFFFFF); 90 | 91 | FPDF_BITMAP bitmap = FPDFBitmap_CreateEx(pageW, pageH, 92 | FPDFBitmap_BGRA, 93 | m_pageImg.scanLine(0), m_pageImg.bytesPerLine()); 94 | Q_ASSERT(bitmap); 95 | xilou_RenderPageBitmap(bitmap, page, 0, 0, pageW, pageH, 0, XILOUPAGRRENDER_ANNOT); 96 | FPDFBitmap_Destroy(bitmap); 97 | bitmap = nullptr; 98 | #endif 99 | if (pageW < ui->scrollArea->width()) 100 | { 101 | ui->scrollArea->horizontalScrollBar()->setRange(0, 0); 102 | } 103 | else 104 | { 105 | ui->scrollArea->horizontalScrollBar()->setRange(0, pageW - ui->scrollArea->width()); 106 | ui->scrollArea->horizontalScrollBar()->setPageStep(ui->scrollArea->viewport()->width()); 107 | ui->scrollArea->horizontalScrollBar()->setSingleStep(pageW / 10); 108 | } 109 | 110 | if (pageH < ui->scrollArea->height()) 111 | { 112 | ui->scrollArea->horizontalScrollBar()->setRange(0, 0); 113 | } 114 | else 115 | { 116 | ui->scrollArea->verticalScrollBar()->setRange(0, pageH - ui->scrollArea->height()); 117 | ui->scrollArea->verticalScrollBar()->setPageStep(ui->scrollArea->viewport()->height()); 118 | ui->scrollArea->verticalScrollBar()->setSingleStep(pageH / 10); 119 | } 120 | // 获取文档总数 121 | int pageCount = xilou_GetPageCount(m_pkg->GetDoc()); 122 | ui->actionpagecount->setText(tr("%1/%2").arg(pageIndex + 1).arg(pageCount)); 123 | ui->actionscale->setText(tr("%1%").arg(m_scale * 100, 0, 'f', 2)); 124 | ui->scrollArea->viewport()->update(); 125 | } 126 | 127 | void MainWindow::ConvertBetweenBGRAandRGBA(unsigned char* input, int pixel_width, 128 | int pixel_height, unsigned char* output) 129 | { 130 | int offset = 0; 131 | 132 | for (int y = 0; y < pixel_height; y++) 133 | { 134 | for (int x = 0; x < pixel_width; x++) 135 | { 136 | output[offset] = input[offset + 2]; 137 | output[offset + 1] = input[offset + 1]; 138 | output[offset + 2] = input[offset]; 139 | output[offset + 3] = input[offset + 3]; 140 | offset += 4; 141 | } 142 | } 143 | } 144 | 145 | void MainWindow::on_actionpre_triggered() 146 | { 147 | pageIndex = qMax(0, pageIndex - 1); 148 | initView(); 149 | } 150 | 151 | void MainWindow::on_actionfirst_triggered() 152 | { 153 | pageIndex = 0; 154 | initView(); 155 | } 156 | 157 | void MainWindow::on_actionnext_triggered() 158 | { 159 | // 获取文档总数 160 | int pageCount = xilou_GetPageCount(m_pkg->GetDoc()); 161 | pageIndex = qMin(pageCount - 1, pageIndex + 1); 162 | initView(); 163 | } 164 | 165 | void MainWindow::on_actionlast_triggered() 166 | { 167 | // 获取文档总数 168 | int pageCount = xilou_GetPageCount(m_pkg->GetDoc()); 169 | pageIndex = pageCount - 1; 170 | initView(); 171 | } 172 | 173 | void MainWindow::on_actionzoomout_triggered() 174 | { 175 | m_scale = qMin(64.0f, m_scale + 0.1); 176 | initView(); 177 | } 178 | 179 | void MainWindow::on_actionzoomin_triggered() 180 | { 181 | m_scale = qMax(0.1f, m_scale - 0.1); 182 | initView(); 183 | } 184 | 185 | 186 | CScrollArea::CScrollArea(QWidget *parent): 187 | QScrollArea(parent) 188 | { 189 | m_window = qobject_cast(window()); 190 | setFrameStyle(QScrollArea::NoFrame); 191 | // 绑定滚动信号 192 | connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onVscrollBarChange(int))); 193 | connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onHscrollBarChange(int))); 194 | } 195 | 196 | CScrollArea::~CScrollArea() 197 | { 198 | 199 | } 200 | 201 | void CScrollArea::paintEvent(QPaintEvent *) 202 | { 203 | if (m_window->m_pageImg.isNull()) 204 | { 205 | return; 206 | } 207 | QPainter painter(viewport()); 208 | int pageW = m_window->m_pageImg.width(); 209 | int pageH = m_window->m_pageImg.height(); 210 | int deltaX = 0; 211 | int deltaY = 0; 212 | if (pageW < width()) 213 | { 214 | deltaX = (width() - pageW) * 0.5; 215 | } 216 | else 217 | { 218 | deltaX = -horizontalScrollBar()->value(); 219 | } 220 | 221 | if (pageH < height()) 222 | { 223 | deltaY = (height() - pageH) * 0.5; 224 | } 225 | else 226 | { 227 | deltaY = -verticalScrollBar()->value(); 228 | } 229 | 230 | painter.drawImage(deltaX, deltaY, m_window->m_pageImg); 231 | } 232 | 233 | void CScrollArea::onVscrollBarChange(int) 234 | { 235 | viewport()->update(); 236 | } 237 | 238 | void CScrollArea::onHscrollBarChange(int) 239 | { 240 | viewport()->update(); 241 | } 242 | 243 | void MainWindow::on_actionToPDF_triggered() 244 | { 245 | QString save2 = QFileDialog::getSaveFileName(this, tr("Save File"), 246 | "", 247 | tr("版式文件(*.pdf *.ofd *.txt)")); 248 | xilou_Convert(m_pkg->GetFilePath().toUtf8().data(), save2.toUtf8().data(), QString("*").toUtf8().data()); 249 | } 250 | 251 | void MainWindow::on_actionverify_triggered() 252 | { 253 | if(m_pkg && m_pkg->GetDoc()){ 254 | long count = xilou_docsign_count(m_pkg->GetDoc()); 255 | QString allmsg; 256 | ; 257 | QString verify_msg(""); 258 | if(count <0){ 259 | QMessageBox::information(NULL, "verify", "error! not support"); 260 | return; 261 | } 262 | if(count ==0){ 263 | QMessageBox::information(NULL, "verify", "no signature!"); 264 | return; 265 | } 266 | while(count >0){ 267 | unsigned long vret = xilou_verify(m_pkg->GetDoc(), count -1); 268 | if(vret != XILOU_E_SUC){ 269 | unsigned char *utf8_msg; 270 | size_t len = xilou_sig_errmsg(m_pkg->GetDoc(), count -1, &utf8_msg); 271 | verify_msg = QString::fromUtf8((const char *)utf8_msg, len); 272 | } 273 | allmsg += QString("sign[%1] verify result[%2] message[%3]\r\n\r\n").arg(count -1).arg(vret == XILOU_E_SUC ? "success":"failed").arg(verify_msg); 274 | count--; 275 | } 276 | QMessageBox::information(NULL, "verify", allmsg); 277 | } 278 | } 279 | 280 | void MainWindow::on_actionImg2PDF_triggered() 281 | { 282 | img2pdf dlg; 283 | dlg.exec(); 284 | } 285 | 286 | void MainWindow::on_mergeofd_triggered() 287 | { 288 | ofdmerge dlg; 289 | dlg.exec(); 290 | } 291 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | QT_BEGIN_NAMESPACE 15 | namespace Ui { class MainWindow; } 16 | QT_END_NAMESPACE 17 | 18 | class CPackageManager{ 19 | XILOU_PACKAGE m_pkg; 20 | XILOU_DOCUMENT m_doc; 21 | std::map m_pages; 22 | int doc_idx; 23 | QString m_fpath; 24 | public: 25 | CPackageManager(QString fpath, QString password){ 26 | m_pkg = xilou_OpenPackage(fpath.toUtf8().data(), NULL); 27 | m_doc = xilou_LoadDocument(m_pkg, 0); 28 | doc_idx = 0; 29 | m_fpath = fpath; 30 | } 31 | void ReleaseDoc(){ 32 | if(m_doc){ 33 | std::map::iterator it = m_pages.begin(); 34 | for(;it != m_pages.end(); ++it){ 35 | xilou_DropPage(it->second); 36 | } 37 | xilou_DropDocument(m_doc); 38 | m_doc = NULL; 39 | } 40 | } 41 | ~CPackageManager(){ 42 | ReleaseDoc(); 43 | } 44 | QString GetFilePath()const{return m_fpath;} 45 | XILOU_DOCUMENT GetDoc(int index = 0){ 46 | if(doc_idx != index && m_doc){ 47 | ReleaseDoc(); 48 | } 49 | if(m_doc) return m_doc; 50 | else{ 51 | m_doc = xilou_LoadDocument(m_pkg, index); 52 | doc_idx = index; 53 | } 54 | return m_doc; 55 | } 56 | XILOU_PAGE GetPage(int index){ 57 | std::map::iterator it = m_pages.find(index); 58 | if(it != m_pages.end()) 59 | return it->second; 60 | XILOU_PAGE page = xilou_LoadPage(m_doc, index); 61 | if(page){ 62 | m_pages.insert(std::make_pair(index, page)); 63 | return page; 64 | } 65 | return NULL; 66 | } 67 | }; 68 | class MainWindow : public QMainWindow 69 | { 70 | Q_OBJECT 71 | 72 | public: 73 | MainWindow(QWidget *parent = nullptr); 74 | ~MainWindow(); 75 | 76 | private slots: 77 | void on_actionopen_triggered(); 78 | 79 | void on_actionpre_triggered(); 80 | 81 | void on_actionfirst_triggered(); 82 | 83 | void on_actionnext_triggered(); 84 | 85 | void on_actionlast_triggered(); 86 | 87 | void on_actionzoomout_triggered(); 88 | 89 | void on_actionzoomin_triggered(); 90 | 91 | void on_actionToPDF_triggered(); 92 | 93 | void on_actionverify_triggered(); 94 | 95 | void on_actionImg2PDF_triggered(); 96 | 97 | void on_mergeofd_triggered(); 98 | 99 | private: 100 | void initView(); 101 | void ConvertBetweenBGRAandRGBA(unsigned char *input, int pixel_width, int pixel_height, unsigned char *output); 102 | 103 | private: 104 | friend class CScrollArea; 105 | Ui::MainWindow *ui; 106 | CPackageManager *m_pkg; 107 | int pageIndex; 108 | float m_scale; 109 | QImage m_pageImg; 110 | }; 111 | 112 | class CScrollArea : public QScrollArea 113 | { 114 | Q_OBJECT 115 | 116 | public: 117 | CScrollArea(QWidget *parent = nullptr); 118 | ~CScrollArea(); 119 | 120 | protected: 121 | void paintEvent(QPaintEvent *); 122 | 123 | private slots: 124 | void onVscrollBarChange(int); 125 | void onHscrollBarChange(int); 126 | 127 | private: 128 | MainWindow *m_window; 129 | }; 130 | 131 | #endif // MAINWINDOW_H 132 | -------------------------------------------------------------------------------- /mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1220 10 | 857 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 0 20 | 21 | 22 | 10 23 | 24 | 25 | 10 26 | 27 | 28 | 10 29 | 30 | 31 | 10 32 | 33 | 34 | 35 | 36 | 37 | 800 38 | 600 39 | 40 | 41 | 42 | QFrame::NoFrame 43 | 44 | 45 | 0 46 | 47 | 48 | true 49 | 50 | 51 | 52 | 53 | 0 54 | 0 55 | 1200 56 | 800 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 0 68 | 0 69 | 1220 70 | 17 71 | 72 | 73 | 74 | 75 | 76 | toolBar 77 | 78 | 79 | TopToolBarArea 80 | 81 | 82 | false 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 打开 103 | 104 | 105 | 106 | 107 | 上一页 108 | 109 | 110 | 111 | 112 | 下一页 113 | 114 | 115 | 116 | 117 | 第一页 118 | 119 | 120 | 121 | 122 | 最后一页 123 | 124 | 125 | 126 | 127 | 放大 128 | 129 | 130 | 131 | 132 | 缩小 133 | 134 | 135 | 136 | 137 | false 138 | 139 | 140 | 0/0 141 | 142 | 143 | 144 | 145 | false 146 | 147 | 148 | 100% 149 | 150 | 151 | 152 | 153 | 转换 154 | 155 | 156 | pdf2ofd/ofd2pdf/pdf2txt/ofd2txt 157 | 158 | 159 | 160 | 161 | 验章 162 | 163 | 164 | 签章验证 165 | 166 | 167 | 168 | 169 | 图片转版式 170 | 171 | 172 | png2pdf,png2ofd 173 | 174 | 175 | 176 | 177 | ofd合并 178 | 179 | 180 | 181 | 182 | 183 | CScrollArea 184 | QScrollArea 185 |
mainwindow.h
186 | 1 187 |
188 |
189 | 190 | 191 |
192 | -------------------------------------------------------------------------------- /ofdcases/intro-数科.ofd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/ofdcases/intro-数科.ofd -------------------------------------------------------------------------------- /ofdcases/issue3/test2.ofd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/ofdcases/issue3/test2.ofd -------------------------------------------------------------------------------- /ofdcases/path_AxialShd1.ofd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/ofdcases/path_AxialShd1.ofd -------------------------------------------------------------------------------- /ofdcases/内嵌stroke字体.ofd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/ofdcases/内嵌stroke字体.ofd -------------------------------------------------------------------------------- /ofdmerge.cpp: -------------------------------------------------------------------------------- 1 | #include "ofdmerge.h" 2 | #include "ui_ofdmerge.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | ofdmerge::ofdmerge(QWidget *parent) : 9 | QDialog(parent), 10 | ui(new Ui::ofdmerge) 11 | { 12 | ui->setupUi(this); 13 | } 14 | 15 | ofdmerge::~ofdmerge() 16 | { 17 | delete ui; 18 | } 19 | 20 | void ofdmerge::on_sourceButton_clicked() 21 | { 22 | m_src = QFileDialog::getOpenFileName(this, tr("打开"), tr(""), tr("版式文件(*.ofd)")); 23 | if (m_src.isEmpty()) 24 | { 25 | return; 26 | } 27 | ui->sourcePathEdit->setText(m_src); 28 | } 29 | 30 | void ofdmerge::on_targetButton_clicked() 31 | { 32 | m_target = QFileDialog::getOpenFileName(this, tr("打开"), tr(""), tr("版式文件(*.ofd)")); 33 | if(m_target.isEmpty()){ 34 | return ; 35 | } 36 | ui->targetPathEdit->setText(m_target); 37 | } 38 | 39 | void ofdmerge::on_buttonBox_accepted() 40 | { 41 | xilou_OfdMerge(m_target.toUtf8().data(), m_src.toUtf8().data()); 42 | } 43 | -------------------------------------------------------------------------------- /ofdmerge.h: -------------------------------------------------------------------------------- 1 | #ifndef OFDMERGE_H 2 | #define OFDMERGE_H 3 | 4 | #include 5 | #include 6 | namespace Ui { 7 | class ofdmerge; 8 | } 9 | 10 | class ofdmerge : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit ofdmerge(QWidget *parent = 0); 16 | ~ofdmerge(); 17 | 18 | private slots: 19 | void on_sourceButton_clicked(); 20 | 21 | void on_targetButton_clicked(); 22 | 23 | void on_buttonBox_accepted(); 24 | 25 | private: 26 | Ui::ofdmerge *ui; 27 | QString m_src; 28 | QString m_target; 29 | }; 30 | 31 | #endif // OFDMERGE_H 32 | -------------------------------------------------------------------------------- /ofdmerge.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ofdmerge 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 400 16 | 300 17 | 18 | 19 | 20 | Dialog 21 | 22 | 23 | 24 | 25 | 30 26 | 240 27 | 341 28 | 32 29 | 30 | 31 | 32 | Qt::Horizontal 33 | 34 | 35 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 36 | 37 | 38 | 39 | 40 | 41 | 19 42 | 60 43 | 361 44 | 81 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 250 53 | 0 54 | 55 | 56 | 57 | true 58 | 59 | 60 | 61 | 62 | 63 | 64 | Qt::Horizontal 65 | 66 | 67 | 68 | 40 69 | 20 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 选择源文件 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 250 86 | 0 87 | 88 | 89 | 90 | true 91 | 92 | 93 | 94 | 95 | 96 | 97 | Qt::Horizontal 98 | 99 | 100 | 101 | 40 102 | 20 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 选目标文件 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | buttonBox 121 | accepted() 122 | ofdmerge 123 | accept() 124 | 125 | 126 | 248 127 | 254 128 | 129 | 130 | 157 131 | 274 132 | 133 | 134 | 135 | 136 | buttonBox 137 | rejected() 138 | ofdmerge 139 | reject() 140 | 141 | 142 | 316 143 | 260 144 | 145 | 146 | 286 147 | 274 148 | 149 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /out/release/API-MS-Win-core-xstate-l2-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/API-MS-Win-core-xstate-l2-1-0.dll -------------------------------------------------------------------------------- /out/release/FreeImage.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/FreeImage.dll -------------------------------------------------------------------------------- /out/release/QtCore4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/QtCore4.dll -------------------------------------------------------------------------------- /out/release/QtGui4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/QtGui4.dll -------------------------------------------------------------------------------- /out/release/absl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/absl.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-console-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-console-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-console-l1-2-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-console-l1-2-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-datetime-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-datetime-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-debug-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-debug-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-errorhandling-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-errorhandling-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-file-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-file-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-file-l1-2-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-file-l1-2-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-file-l2-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-file-l2-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-handle-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-handle-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-heap-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-heap-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-interlocked-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-interlocked-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-libraryloader-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-libraryloader-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-localization-l1-2-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-localization-l1-2-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-memory-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-memory-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-namedpipe-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-namedpipe-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-processenvironment-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-processenvironment-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-processthreads-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-processthreads-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-processthreads-l1-1-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-processthreads-l1-1-1.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-profile-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-profile-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-rtlsupport-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-rtlsupport-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-string-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-string-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-synch-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-synch-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-synch-l1-2-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-synch-l1-2-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-sysinfo-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-sysinfo-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-timezone-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-timezone-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-core-util-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-core-util-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-conio-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-conio-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-convert-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-convert-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-environment-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-environment-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-filesystem-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-filesystem-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-heap-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-heap-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-locale-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-locale-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-math-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-math-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-multibyte-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-multibyte-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-private-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-private-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-process-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-process-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-runtime-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-runtime-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-stdio-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-stdio-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-string-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-string-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-time-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-time-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-crt-utility-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-crt-utility-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-downlevel-kernel32-l2-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-downlevel-kernel32-l2-1-0.dll -------------------------------------------------------------------------------- /out/release/api-ms-win-eventing-provider-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/api-ms-win-eventing-provider-l1-1-0.dll -------------------------------------------------------------------------------- /out/release/cppgc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/cppgc.dll -------------------------------------------------------------------------------- /out/release/dbgcore.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/dbgcore.dll -------------------------------------------------------------------------------- /out/release/dbgeng.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/dbgeng.dll -------------------------------------------------------------------------------- /out/release/dbghelp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/dbghelp.dll -------------------------------------------------------------------------------- /out/release/hbsubset.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/hbsubset.dll -------------------------------------------------------------------------------- /out/release/hbsubset.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/hbsubset.lib -------------------------------------------------------------------------------- /out/release/icui18n.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/icui18n.dll -------------------------------------------------------------------------------- /out/release/icui18n_hidden_visibility.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/icui18n_hidden_visibility.dll -------------------------------------------------------------------------------- /out/release/icuuc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/icuuc.dll -------------------------------------------------------------------------------- /out/release/icuuc_hidden_visibility.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/icuuc_hidden_visibility.dll -------------------------------------------------------------------------------- /out/release/libc++.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/libc++.dll -------------------------------------------------------------------------------- /out/release/msvcp100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/msvcp100.dll -------------------------------------------------------------------------------- /out/release/msvcp140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/msvcp140.dll -------------------------------------------------------------------------------- /out/release/msvcr100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/msvcr100.dll -------------------------------------------------------------------------------- /out/release/oes.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/oes.dll -------------------------------------------------------------------------------- /out/release/pdfium.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/pdfium.dll -------------------------------------------------------------------------------- /out/release/pdfium.dll.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/pdfium.dll.lib -------------------------------------------------------------------------------- /out/release/snapshot_blob.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/snapshot_blob.bin -------------------------------------------------------------------------------- /out/release/ucrtbase.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/ucrtbase.dll -------------------------------------------------------------------------------- /out/release/v8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/v8.dll -------------------------------------------------------------------------------- /out/release/v8_build_config.json: -------------------------------------------------------------------------------- 1 | {"current_cpu": "x86", "dcheck_always_on": false, "is_android": false, "is_asan": false, "is_cfi": false, "is_clang": true, "is_component_build": true, "is_debug": false, "is_full_debug": false, "is_gcov_coverage": false, "is_msan": false, "is_tsan": false, "is_ubsan_vptr": false, "target_cpu": "x86", "v8_current_cpu": "x86", "v8_enable_atomic_marking_state": true, "v8_enable_atomic_object_field_writes": true, "v8_enable_concurrent_marking": true, "v8_enable_single_generation": false, "v8_enable_i18n_support": true, "v8_enable_verify_predictable": false, "v8_enable_verify_csa": false, "v8_enable_lite_mode": false, "v8_enable_runtime_call_stats": true, "v8_enable_pointer_compression": false, "v8_enable_pointer_compression_shared_cage": false, "v8_enable_virtual_memory_cage": false, "v8_enable_third_party_heap": false, "v8_enable_webassembly": false, "v8_control_flow_integrity": false, "v8_target_cpu": "x86"} -------------------------------------------------------------------------------- /out/release/v8_cppgc_shared_for_testing.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/v8_cppgc_shared_for_testing.dll -------------------------------------------------------------------------------- /out/release/v8_libbase.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/v8_libbase.dll -------------------------------------------------------------------------------- /out/release/v8_libplatform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/v8_libplatform.dll -------------------------------------------------------------------------------- /out/release/vccorlib140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/vccorlib140.dll -------------------------------------------------------------------------------- /out/release/vcruntime140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/vcruntime140.dll -------------------------------------------------------------------------------- /out/release/xilou.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/xilou.exe -------------------------------------------------------------------------------- /out/release/zlib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/out/release/zlib.dll -------------------------------------------------------------------------------- /preview/6F575221-72B1-4e0f-8EA1-5457D8205C03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/preview/6F575221-72B1-4e0f-8EA1-5457D8205C03.png -------------------------------------------------------------------------------- /preview/annots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/preview/annots.png -------------------------------------------------------------------------------- /preview/clips.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/preview/clips.jpg -------------------------------------------------------------------------------- /preview/drawparam.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/preview/drawparam.jpg -------------------------------------------------------------------------------- /preview/img_border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/preview/img_border.png -------------------------------------------------------------------------------- /preview/pdf2ofd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/preview/pdf2ofd.png -------------------------------------------------------------------------------- /preview/signed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/preview/signed.png -------------------------------------------------------------------------------- /preview/ticket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/preview/ticket.png -------------------------------------------------------------------------------- /preview/verify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chingliu/XilouReader/3aa4aebd9ca0e1efcdde52408b3b5bc8daacdc6e/preview/verify.png -------------------------------------------------------------------------------- /xilou.pro: -------------------------------------------------------------------------------- 1 | QT += core gui 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | CONFIG += c++11 6 | 7 | # You can make your code fail to compile if it uses deprecated APIs. 8 | # In order to do so, uncomment the following line. 9 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 10 | 11 | SOURCES += \ 12 | main.cpp \ 13 | mainwindow.cpp \ 14 | img2pdf.cpp \ 15 | ofdmerge.cpp 16 | 17 | HEADERS += \ 18 | mainwindow.h \ 19 | img2pdf.h \ 20 | ofdmerge.h 21 | 22 | FORMS += \ 23 | mainwindow.ui \ 24 | img2pdf.ui \ 25 | img2pdf.ui \ 26 | ofdmerge.ui 27 | 28 | # Default rules for deployment. 29 | qnx: target.path = /tmp/$${TARGET}/bin 30 | else: unix:!android: target.path = /opt/$${TARGET}/bin 31 | !isEmpty(target.path): INSTALLS += target 32 | 33 | CONFIG += debug_and_release 34 | 35 | INCLUDEPATH += $$PWD/include/public 36 | INCLUDEPATH += $$PWD/include/xilou_public 37 | CONFIG(debug, debug|release){ 38 | LIBS += -L$$PWD/out/debug -lpdfium.dll 39 | DESTDIR = $$PWD/out/debug 40 | }else{ 41 | LIBS += -L$$PWD/out/release -lpdfium.dll 42 | DESTDIR = $$PWD/out/release 43 | } 44 | 45 | --------------------------------------------------------------------------------