├── .gitignore ├── 3rdparty └── pdfium-win-x64 │ ├── LICENSE │ ├── PDFiumConfig.cmake │ ├── VERSION │ ├── args.gn │ └── include │ ├── 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 ├── CMakeLists.txt ├── LICENSE ├── QtPdf └── qtpdfglobal.h ├── README.md ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── qpdfbookmarkmodel.cpp ├── qpdfbookmarkmodel.h ├── qpdfdestination.cpp ├── qpdfdestination.h ├── qpdfdestination_p.h ├── qpdfdocument.cpp ├── qpdfdocument.h ├── qpdfdocument_p.h ├── qpdfdocumentrenderoptions.h ├── qpdflinkmodel.cpp ├── qpdflinkmodel_p.h ├── qpdflinkmodel_p_p.h ├── qpdfnamespace.h ├── qpdfpagenavigation.cpp ├── qpdfpagenavigation.h ├── qpdfpagerenderer.cpp ├── qpdfpagerenderer.h ├── qpdfsearchmodel.cpp ├── qpdfsearchmodel.h ├── qpdfsearchmodel_p.h ├── qpdfsearchresult.cpp ├── qpdfsearchresult.h ├── qpdfsearchresult_p.h ├── qpdfselection.cpp ├── qpdfselection.h ├── qpdfselection_p.h ├── qtpdf-config.h ├── qtpdf-config_p.h ├── qtpdfglobal.h └── third_party └── pdfium └── public ├── 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 /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # build 35 | build 36 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/PDFiumConfig.cmake: -------------------------------------------------------------------------------- 1 | # PDFium Package Configuration for CMake 2 | # 3 | # To use PDFium in you CMake project: 4 | # 5 | # 1. set the environment variable PDFium_DIR to the folder containing this file. 6 | # 2. in your CMakeLists.txt, add 7 | # find_package(PDFium) 8 | # 3. then link you excecutable with PDFium 9 | # target_link_libraries(my_exe pdfium) 10 | 11 | include(FindPackageHandleStandardArgs) 12 | 13 | find_path(PDFium_INCLUDE_DIR 14 | NAMES "fpdfview.h" 15 | PATHS "${CMAKE_CURRENT_LIST_DIR}" 16 | PATH_SUFFIXES "include" 17 | ) 18 | 19 | if(MSVC) 20 | if(CMAKE_CL_64) 21 | set(PDFium_ARCH x64) 22 | else() 23 | set(PDFium_ARCH x86) 24 | endif() 25 | 26 | find_file(PDFium_LIBRARY 27 | NAMES "pdfium.dll" 28 | PATHS "${CMAKE_CURRENT_LIST_DIR}" 29 | PATH_SUFFIXES "${PDFium_ARCH}/bin") 30 | 31 | find_file(PDFium_IMPLIB 32 | NAMES "pdfium.dll.lib" 33 | PATHS "${CMAKE_CURRENT_LIST_DIR}" 34 | PATH_SUFFIXES "${PDFium_ARCH}/lib") 35 | 36 | add_library(pdfium SHARED IMPORTED) 37 | set_target_properties(pdfium 38 | PROPERTIES 39 | IMPORTED_LOCATION "${PDFium_LIBRARY}" 40 | IMPORTED_IMPLIB "${PDFium_IMPLIB}" 41 | INTERFACE_INCLUDE_DIRECTORIES "${PDFium_INCLUDE_DIR};${PDFium_INCLUDE_DIR}/cpp" 42 | ) 43 | 44 | find_package_handle_standard_args(PDFium 45 | REQUIRED_VARS PDFium_LIBRARY PDFium_IMPLIB PDFium_INCLUDE_DIR 46 | ) 47 | else() 48 | find_library(PDFium_LIBRARY 49 | NAMES "pdfium" 50 | PATHS "${CMAKE_CURRENT_LIST_DIR}" 51 | PATH_SUFFIXES "lib") 52 | 53 | add_library(pdfium SHARED IMPORTED) 54 | set_target_properties(pdfium 55 | PROPERTIES 56 | IMPORTED_LOCATION "${PDFium_LIBRARY}" 57 | INTERFACE_INCLUDE_DIRECTORIES "${PDFium_INCLUDE_DIR};${PDFium_INCLUDE_DIR}/cpp" 58 | ) 59 | 60 | find_package_handle_standard_args(PDFium 61 | REQUIRED_VARS PDFium_LIBRARY PDFium_INCLUDE_DIR 62 | ) 63 | endif() -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/VERSION: -------------------------------------------------------------------------------- 1 | MAJOR=97 2 | MINOR=0 3 | BUILD=4690 4 | PATCH=0 5 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/args.gn: -------------------------------------------------------------------------------- 1 | is_debug = false 2 | pdf_is_standalone = true 3 | target_cpu = "x64" 4 | target_os = "win" 5 | pdf_enable_v8 = false 6 | pdf_enable_xfa = false 7 | pdf_use_win32_gdi = true 8 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 "../fpdf_annot.h" 9 | #include "../fpdf_dataavail.h" 10 | #include "../fpdf_edit.h" 11 | #include "../fpdf_formfill.h" 12 | #include "../fpdf_javascript.h" 13 | #include "../fpdf_structtree.h" 14 | #include "../fpdf_text.h" 15 | #include "../fpdf_transformpage.h" 16 | #include "../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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 "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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /3rdparty/pdfium-win-x64/include/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 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1.0) 2 | 3 | project(CMakePdfDemo) 4 | 5 | set(CMAKE_CXX_STANDARD 14) 6 | 7 | IF (WIN32) 8 | MESSAGE(STATUS "Now is windows") 9 | set(CMAKE_PREFIX_PATH "C:\\Qt\\5.15.2\\msvc2019_64\\bin") 10 | set(Qt5_DIR "C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5") 11 | set(PDFium_DIR "${CMAKE_SOURCE_DIR}/3rdparty/pdfium-win-x64") 12 | ELSEIF (APPLE) 13 | MESSAGE(STATUS "Now is Apple systens.") 14 | ELSEIF (UNIX) 15 | MESSAGE(STATUS "Now is UNIX-like OS's.") 16 | ENDIF () 17 | 18 | set(CMAKE_AUTOMOC ON) 19 | set(CMAKE_AUTORCC ON) 20 | set(CMAKE_AUTOUIC ON) 21 | 22 | if(CMAKE_VERSION VERSION_LESS "3.7.0") 23 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 24 | endif() 25 | 26 | find_package(Qt5 COMPONENTS Widgets REQUIRED) 27 | get_target_property(QtCore_location Qt5::Widgets LOCATION) 28 | 29 | 30 | find_package(Qt5 COMPONENTS Core REQUIRED) 31 | get_target_property(QtCore_location Qt5::Core LOCATION) 32 | 33 | find_package(Qt5 COMPONENTS Network REQUIRED) 34 | get_target_property(QtCore_location Qt5::Network LOCATION) 35 | 36 | add_executable(CMakePdfDemo 37 | mainwindow.ui 38 | mainwindow.cpp 39 | mainwindow.h 40 | main.cpp 41 | 42 | qpdfbookmarkmodel.h 43 | qpdfbookmarkmodel.cpp 44 | qpdfdestination_p.h 45 | qpdfdestination.cpp 46 | qpdfdocument_p.h 47 | qpdfdocument.cpp 48 | qpdfdocument.h 49 | qpdfdocumentrenderoptions.h 50 | qpdflinkmodel_p_p.h 51 | qpdflinkmodel_p.h 52 | qpdflinkmodel.cpp 53 | qpdfnamespace.h 54 | qpdfpagenavigation.cpp 55 | qpdfpagenavigation.h 56 | qpdfpagerenderer.cpp 57 | qpdfpagerenderer.h 58 | qpdfsearchmodel_p.h 59 | qpdfsearchmodel.cpp 60 | qpdfsearchmodel.h 61 | qpdfsearchresult_p.h 62 | qpdfsearchresult.cpp 63 | qpdfsearchresult.h 64 | qpdfselection_p.h 65 | qpdfselection.cpp 66 | qpdfselection.h 67 | qtpdf-config_p.h 68 | qtpdf-config.h 69 | qtpdfglobal.h 70 | ) 71 | 72 | find_package(PDFium) 73 | 74 | target_link_libraries(CMakePdfDemo Qt5::Widgets Qt5::Core Qt5::GuiPrivate Qt5::CorePrivate Qt5::Network pdfium) 75 | 76 | #todo windows copy 77 | add_custom_command(TARGET ${PROJECT_NAME} 78 | PRE_BUILD 79 | COMMAND echo "executing a fake command" 80 | COMMENT "This command will be executed before building target Test1" 81 | ) 82 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 QPDFReader 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /QtPdf/qtpdfglobal.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QTPDFGLOBAL_H 38 | #define QTPDFGLOBAL_H 39 | 40 | #include 41 | 42 | QT_BEGIN_NAMESPACE 43 | 44 | #ifndef Q_PDF_EXPORT 45 | # ifndef QT_STATIC 46 | # if defined(QT_BUILD_PDF_LIB) 47 | # define Q_PDF_EXPORT Q_DECL_EXPORT 48 | # else 49 | # define Q_PDF_EXPORT Q_DECL_IMPORT 50 | # endif 51 | # else 52 | # define Q_PDF_EXPORT 53 | # endif 54 | #endif 55 | 56 | #define Q_PDF_PRIVATE_EXPORT Q_PDF_EXPORT 57 | 58 | QT_END_NAMESPACE 59 | 60 | #endif // QTPDFGLOBAL_H 61 | 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CMakePdfDemo 2 | 3 | # 这是个demo 4 | vs2019编译器(3rdparty里是msvc编译的,所以本工程也得是vs2019编译 5 | # 编译依赖 6 | ## 本地依赖 7 | - 编译器 msvc2019 8 | - Qt5.0 或者更高 9 | 10 | ## 编译前准备 11 | 需要手动修改cmakelist中的两个Qt的参数 12 | 13 | ```cmake 14 | set(CMAKE_PREFIX_PATH "C:\\Qt\\5.15.2\\msvc2019_64\\bin") 15 | set(Qt5_DIR "C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5") 16 | ``` 17 | 18 | # 编译 19 | ```shell 20 | git clone https://github.com/QPdfReader/CMakePdfDemo.git 21 | cd CMakePdfDemo 22 | mkdir build 23 | cd build 24 | cmake ../ 25 | msbuild CMakePdfDemo.sln 26 | ``` 27 | 28 | ## 编译后需要拷贝运行后需要提示的 29 | 30 | - Qt5Widgets.dll 31 | - Qt5Core.dll 32 | - Qt5Gui.dll 33 | 34 | 别忘了把plugins\platforms这个文件夹拷贝到运行目录 35 | 36 | 37 | # 这只是个demo,后面会统一处理这些恶心的地方 -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | #include 4 | 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QCoreApplication::setAttribute(Qt::AA_ForceRasterWidgets); 9 | QApplication a(argc, argv); 10 | MainWindow w; 11 | w.show(); 12 | 13 | return a.exec(); 14 | } 15 | -------------------------------------------------------------------------------- /mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | #include 4 | #include 5 | 6 | 7 | #include "qpdfdocument.h" 8 | 9 | MainWindow::MainWindow(QWidget *parent) : 10 | QMainWindow(parent), 11 | ui(new Ui::MainWindow) 12 | { 13 | ui->setupUi(this); 14 | testPdf(); 15 | } 16 | 17 | MainWindow::~MainWindow() 18 | { 19 | delete ui; 20 | } 21 | 22 | void MainWindow::testPdf() 23 | { 24 | QPdfDocument pdfDoc; 25 | QPdfDocument::DocumentError docError = pdfDoc.load("C:\\Users\\zhangpf\\Project\\KTodo\\build\\1.pdf"); 26 | qDebug() << docError << endl; 27 | int nCount = pdfDoc.pageCount(); 28 | qDebug() << nCount << endl; 29 | } 30 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class MainWindow; 8 | } 9 | 10 | class MainWindow : public QMainWindow 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit MainWindow(QWidget *parent = nullptr); 16 | ~MainWindow(); 17 | // void paintEvent(QPaintEvent* e); 18 | void testPdf(); 19 | 20 | private: 21 | Ui::MainWindow *ui; 22 | }; 23 | 24 | #endif // MAINWINDOW_H 25 | -------------------------------------------------------------------------------- /mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 521 10 | 413 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /qpdfbookmarkmodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFBOOKMARKMODEL_H 38 | #define QPDFBOOKMARKMODEL_H 39 | 40 | #include "qtpdfglobal.h" 41 | #include 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | class QPdfDocument; 46 | class QPdfBookmarkModelPrivate; 47 | 48 | class QPdfBookmarkModel : public QAbstractItemModel 49 | { 50 | Q_OBJECT 51 | 52 | Q_PROPERTY(QPdfDocument* document READ document WRITE setDocument NOTIFY documentChanged) 53 | Q_PROPERTY(StructureMode structureMode READ structureMode WRITE setStructureMode NOTIFY structureModeChanged) 54 | 55 | public: 56 | enum StructureMode 57 | { 58 | TreeMode, 59 | ListMode 60 | }; 61 | Q_ENUM(StructureMode) 62 | 63 | enum Role 64 | { 65 | TitleRole = Qt::DisplayRole, 66 | LevelRole = Qt::UserRole, 67 | PageNumberRole 68 | }; 69 | Q_ENUM(Role) 70 | 71 | explicit QPdfBookmarkModel(QObject *parent = nullptr); 72 | 73 | QPdfDocument* document() const; 74 | void setDocument(QPdfDocument *document); 75 | 76 | StructureMode structureMode() const; 77 | void setStructureMode(StructureMode mode); 78 | 79 | QVariant data(const QModelIndex &index, int role) const override; 80 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; 81 | QModelIndex parent(const QModelIndex &index) const override; 82 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; 83 | int columnCount(const QModelIndex &parent = QModelIndex()) const override; 84 | QHash roleNames() const override; 85 | 86 | Q_SIGNALS: 87 | void documentChanged(QPdfDocument *document); 88 | void structureModeChanged(QPdfBookmarkModel::StructureMode structureMode); 89 | 90 | private: 91 | Q_DECLARE_PRIVATE(QPdfBookmarkModel) 92 | 93 | Q_PRIVATE_SLOT(d_func(), void _q_documentStatusChanged()) 94 | }; 95 | 96 | QT_END_NAMESPACE 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /qpdfdestination.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #include "qpdfdestination.h" 38 | #include "qpdfdestination_p.h" 39 | 40 | QT_BEGIN_NAMESPACE 41 | 42 | /*! 43 | \class QPdfDestination 44 | \since 5.15 45 | \inmodule QtPdf 46 | 47 | \brief The QPdfDestination class defines a location on a page in a PDF 48 | document, and a suggested zoom level at which it is intended to be viewed. 49 | */ 50 | 51 | /*! 52 | Constructs an invalid Destination. 53 | 54 | \sa valid 55 | */ 56 | QPdfDestination::QPdfDestination() 57 | : d(new QPdfDestinationPrivate()) 58 | { 59 | } 60 | 61 | QPdfDestination::QPdfDestination(int page, QPointF location, qreal zoom) 62 | : d(new QPdfDestinationPrivate(page, location, zoom)) 63 | { 64 | } 65 | 66 | QPdfDestination::QPdfDestination(QPdfDestinationPrivate *d) 67 | : d(d) 68 | { 69 | } 70 | 71 | QPdfDestination::QPdfDestination(const QPdfDestination &other) 72 | : d(other.d) 73 | { 74 | } 75 | 76 | QPdfDestination::QPdfDestination(QPdfDestination &&other) noexcept 77 | : d(std::move(other.d)) 78 | { 79 | } 80 | 81 | QPdfDestination::~QPdfDestination() 82 | { 83 | } 84 | 85 | QPdfDestination &QPdfDestination::operator=(const QPdfDestination &other) 86 | { 87 | d = other.d; 88 | return *this; 89 | } 90 | 91 | /*! 92 | \property QPdfDestination::valid 93 | 94 | This property holds whether the destination is valid. 95 | */ 96 | bool QPdfDestination::isValid() const 97 | { 98 | return d->page >= 0; 99 | } 100 | 101 | /*! 102 | \property QPdfDestination::page 103 | 104 | This property holds the page number. 105 | */ 106 | int QPdfDestination::page() const 107 | { 108 | return d->page; 109 | } 110 | 111 | /*! 112 | \property QPdfDestination::location 113 | 114 | This property holds the location on the page, in units of points. 115 | */ 116 | QPointF QPdfDestination::location() const 117 | { 118 | return d->location; 119 | } 120 | 121 | /*! 122 | \property QPdfDestination::zoom 123 | 124 | This property holds the suggested magnification level, where 1.0 means default scale 125 | (1 pixel = 1 point). 126 | */ 127 | qreal QPdfDestination::zoom() const 128 | { 129 | return d->zoom; 130 | } 131 | 132 | QDebug operator<<(QDebug dbg, const QPdfDestination& dest) 133 | { 134 | QDebugStateSaver saver(dbg); 135 | dbg.nospace(); 136 | dbg << "QPdfDestination(page=" << dest.page() 137 | << " location=" << dest.location() 138 | << " zoom=" << dest.zoom(); 139 | dbg << ')'; 140 | return dbg; 141 | } 142 | 143 | QT_END_NAMESPACE 144 | 145 | #include "moc_qpdfdestination.cpp" 146 | -------------------------------------------------------------------------------- /qpdfdestination.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFDESTINATION_H 38 | #define QPDFDESTINATION_H 39 | 40 | #include "qtpdfglobal.h" 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | QT_BEGIN_NAMESPACE 47 | 48 | class QPdfDestinationPrivate; 49 | 50 | class QPdfDestination 51 | { 52 | Q_GADGET 53 | Q_PROPERTY(bool valid READ isValid) 54 | Q_PROPERTY(int page READ page) 55 | Q_PROPERTY(QPointF location READ location) 56 | Q_PROPERTY(qreal zoom READ zoom) 57 | 58 | public: 59 | ~QPdfDestination(); 60 | QPdfDestination(const QPdfDestination &other); 61 | QPdfDestination &operator=(const QPdfDestination &other); 62 | QPdfDestination(QPdfDestination &&other) noexcept; 63 | QPdfDestination &operator=(QPdfDestination &&other) noexcept { swap(other); return *this; } 64 | void swap(QPdfDestination &other) noexcept { d.swap(other.d); } 65 | bool isValid() const; 66 | int page() const; 67 | QPointF location() const; 68 | qreal zoom() const; 69 | 70 | protected: 71 | QPdfDestination(); 72 | QPdfDestination(int page, QPointF location, qreal zoom); 73 | QPdfDestination(QPdfDestinationPrivate *d); 74 | friend class QPdfDocument; 75 | friend class QQuickPdfNavigationStack; 76 | 77 | protected: 78 | QExplicitlySharedDataPointer d; 79 | }; 80 | 81 | QDebug operator<<(QDebug, const QPdfDestination &); 82 | 83 | QT_END_NAMESPACE 84 | 85 | #endif // QPDFDESTINATION_H 86 | -------------------------------------------------------------------------------- /qpdfdestination_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFDESTINATION_P_H 38 | #define QPDFDESTINATION_P_H 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists purely as an 45 | // implementation detail. This header file may change from version to 46 | // version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | 51 | #include 52 | 53 | QT_BEGIN_NAMESPACE 54 | 55 | class QPdfDestinationPrivate : public QSharedData 56 | { 57 | public: 58 | QPdfDestinationPrivate() = default; 59 | QPdfDestinationPrivate(int page, QPointF location, qreal zoom) 60 | : page(page), 61 | location(location), 62 | zoom(zoom) { } 63 | 64 | int page = -1; 65 | QPointF location; 66 | qreal zoom = 1; 67 | }; 68 | 69 | QT_END_NAMESPACE 70 | 71 | #endif // QPDFDESTINATION_P_H 72 | -------------------------------------------------------------------------------- /qpdfdocument.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFDOCUMENT_H 38 | #define QPDFDOCUMENT_H 39 | 40 | #include "qtpdfglobal.h" 41 | 42 | #include 43 | #include 44 | #include "qpdfdocumentrenderoptions.h" 45 | #include "qpdfselection.h" 46 | 47 | QT_BEGIN_NAMESPACE 48 | 49 | class QPdfDocumentPrivate; 50 | class QNetworkReply; 51 | 52 | class QPdfDocument : public QObject 53 | { 54 | Q_OBJECT 55 | 56 | Q_PROPERTY(int pageCount READ pageCount NOTIFY pageCountChanged FINAL) 57 | Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged FINAL) 58 | Q_PROPERTY(Status status READ status NOTIFY statusChanged FINAL) 59 | 60 | public: 61 | enum Status { 62 | Null, 63 | Loading, 64 | Ready, 65 | Unloading, 66 | Error 67 | }; 68 | Q_ENUM(Status) 69 | 70 | enum DocumentError { 71 | NoError, 72 | UnknownError, 73 | DataNotYetAvailableError, 74 | FileNotFoundError, 75 | InvalidFileFormatError, 76 | IncorrectPasswordError, 77 | UnsupportedSecuritySchemeError 78 | }; 79 | Q_ENUM(DocumentError) 80 | 81 | enum MetaDataField { 82 | Title, 83 | Subject, 84 | Author, 85 | Keywords, 86 | Producer, 87 | Creator, 88 | CreationDate, 89 | ModificationDate 90 | }; 91 | Q_ENUM(MetaDataField) 92 | 93 | explicit QPdfDocument(QObject *parent = nullptr); 94 | ~QPdfDocument(); 95 | 96 | DocumentError load(const QString &fileName); 97 | 98 | Status status() const; 99 | 100 | void load(QIODevice *device); 101 | void setPassword(const QString &password); 102 | QString password() const; 103 | 104 | QVariant metaData(MetaDataField field) const; 105 | 106 | DocumentError error() const; 107 | 108 | void close(); 109 | 110 | int pageCount() const; 111 | 112 | QSizeF pageSize(int page) const; 113 | 114 | QImage render(int page, QSize imageSize, QPdfDocumentRenderOptions options = QPdfDocumentRenderOptions()); 115 | 116 | Q_INVOKABLE QPdfSelection getSelection(int page, QPointF start, QPointF end); 117 | Q_INVOKABLE QPdfSelection getSelectionAtIndex(int page, int startIndex, int maxLength); 118 | Q_INVOKABLE QPdfSelection getAllText(int page); 119 | 120 | Q_SIGNALS: 121 | void passwordChanged(); 122 | void passwordRequired(); 123 | void statusChanged(QPdfDocument::Status status); 124 | void pageCountChanged(int pageCount); 125 | 126 | private: 127 | friend class QPdfBookmarkModelPrivate; 128 | friend class QPdfLinkModelPrivate; 129 | friend class QPdfSearchModel; 130 | friend class QPdfSearchModelPrivate; 131 | friend class QQuickPdfSelection; 132 | 133 | Q_PRIVATE_SLOT(d, void _q_tryLoadingWithSizeFromContentHeader()) 134 | Q_PRIVATE_SLOT(d, void _q_copyFromSequentialSourceDevice()) 135 | QScopedPointer d; 136 | }; 137 | 138 | QT_END_NAMESPACE 139 | 140 | #endif // QPDFDOCUMENT_H 141 | -------------------------------------------------------------------------------- /qpdfdocument_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFDOCUMENT_P_H 38 | #define QPDFDOCUMENT_P_H 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists purely as an 45 | // implementation detail. This header file may change from version to 46 | // version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | 51 | #include "qpdfdocument.h" 52 | 53 | #include "third_party/pdfium/public/fpdfview.h" 54 | #include "third_party/pdfium/public/fpdf_dataavail.h" 55 | 56 | #include 57 | #include 58 | #include 59 | #include 60 | 61 | QT_BEGIN_NAMESPACE 62 | 63 | class QPdfMutexLocker : public QMutexLocker 64 | { 65 | public: 66 | QPdfMutexLocker(); 67 | }; 68 | 69 | class Q_PDF_PRIVATE_EXPORT QPdfDocumentPrivate: public FPDF_FILEACCESS, public FX_FILEAVAIL, public FX_DOWNLOADHINTS 70 | { 71 | public: 72 | QPdfDocumentPrivate(); 73 | ~QPdfDocumentPrivate(); 74 | 75 | QPdfDocument *q; 76 | 77 | FPDF_AVAIL avail; 78 | FPDF_DOCUMENT doc; 79 | bool loadComplete; 80 | 81 | QPointer device; 82 | QScopedPointer ownDevice; 83 | QBuffer asyncBuffer; 84 | QPointer sequentialSourceDevice; 85 | QByteArray password; 86 | 87 | QPdfDocument::Status status; 88 | QPdfDocument::DocumentError lastError; 89 | int pageCount; 90 | 91 | void clear(); 92 | 93 | void load(QIODevice *device, bool ownDevice); 94 | void loadAsync(QIODevice *device); 95 | 96 | void _q_tryLoadingWithSizeFromContentHeader(); 97 | void initiateAsyncLoadWithTotalSizeKnown(quint64 totalSize); 98 | void _q_copyFromSequentialSourceDevice(); 99 | void tryLoadDocument(); 100 | void checkComplete(); 101 | bool checkPageComplete(int page); 102 | void setStatus(QPdfDocument::Status status); 103 | 104 | static FPDF_BOOL fpdf_IsDataAvail(struct _FX_FILEAVAIL* pThis, size_t offset, size_t size); 105 | static int fpdf_GetBlock(void* param, unsigned long position, unsigned char* pBuf, unsigned long size); 106 | static void fpdf_AddSegment(struct _FX_DOWNLOADHINTS* pThis, size_t offset, size_t size); 107 | void updateLastError(); 108 | QString getText(FPDF_TEXTPAGE textPage, int startIndex, int count); 109 | QPointF getCharPosition(FPDF_TEXTPAGE textPage, double pageHeight, int charIndex); 110 | QRectF getCharBox(FPDF_TEXTPAGE textPage, double pageHeight, int charIndex); 111 | 112 | struct TextPosition { 113 | QPointF position; 114 | qreal height = 0; 115 | int charIndex = -1; 116 | }; 117 | TextPosition hitTest(int page, QPointF position); 118 | }; 119 | 120 | QT_END_NAMESPACE 121 | 122 | #endif // QPDFDOCUMENT_P_H 123 | -------------------------------------------------------------------------------- /qpdfdocumentrenderoptions.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König 4 | ** Copyright (C) 2020 The Qt Company Ltd. 5 | ** Contact: http://www.qt.io/licensing/ 6 | ** 7 | ** This file is part of the QtPDF module of the Qt Toolkit. 8 | ** 9 | ** $QT_BEGIN_LICENSE:LGPL3$ 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** GNU Lesser General Public License Usage 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser 20 | ** General Public License version 3 as published by the Free Software 21 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 22 | ** packaging of this file. Please review the following information to 23 | ** ensure the GNU Lesser General Public License version 3 requirements 24 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 25 | ** 26 | ** GNU General Public License Usage 27 | ** Alternatively, this file may be used under the terms of the GNU 28 | ** General Public License version 2.0 or later as published by the Free 29 | ** Software Foundation and appearing in the file LICENSE.GPL included in 30 | ** the packaging of this file. Please review the following information to 31 | ** ensure the GNU General Public License version 2.0 requirements will be 32 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 33 | ** 34 | ** $QT_END_LICENSE$ 35 | ** 36 | ****************************************************************************/ 37 | 38 | #ifndef QPDFDOCUMENTRENDEROPTIONS_H 39 | #define QPDFDOCUMENTRENDEROPTIONS_H 40 | 41 | #include "qpdfnamespace.h" 42 | #include 43 | #include 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | class QPdfDocumentRenderOptions 48 | { 49 | public: 50 | Q_DECL_CONSTEXPR QPdfDocumentRenderOptions() noexcept : m_renderFlags(0), m_rotation(0), m_reserved(0) {} 51 | 52 | Q_DECL_CONSTEXPR QPdf::Rotation rotation() const noexcept { return static_cast(m_rotation); } 53 | Q_DECL_RELAXED_CONSTEXPR void setRotation(QPdf::Rotation r) noexcept { m_rotation = r; } 54 | 55 | Q_DECL_CONSTEXPR QPdf::RenderFlags renderFlags() const noexcept { return static_cast(m_renderFlags); } 56 | Q_DECL_RELAXED_CONSTEXPR void setRenderFlags(QPdf::RenderFlags r) noexcept { m_renderFlags = r; } 57 | 58 | Q_DECL_CONSTEXPR QRect scaledClipRect() const noexcept { return m_clipRect; } 59 | Q_DECL_RELAXED_CONSTEXPR void setScaledClipRect(const QRect &r) noexcept { m_clipRect = r; } 60 | 61 | Q_DECL_CONSTEXPR QSize scaledSize() const noexcept { return m_scaledSize; } 62 | Q_DECL_RELAXED_CONSTEXPR void setScaledSize(const QSize &s) noexcept { m_scaledSize = s; } 63 | 64 | private: 65 | friend Q_DECL_CONSTEXPR inline bool operator==(QPdfDocumentRenderOptions lhs, QPdfDocumentRenderOptions rhs) noexcept; 66 | 67 | QRect m_clipRect; 68 | QSize m_scaledSize; 69 | 70 | quint32 m_renderFlags : 8; 71 | quint32 m_rotation : 3; 72 | quint32 m_reserved : 21; 73 | quint32 m_reserved2 = 0; 74 | }; 75 | 76 | Q_DECLARE_TYPEINFO(QPdfDocumentRenderOptions, Q_PRIMITIVE_TYPE); 77 | 78 | Q_DECL_CONSTEXPR inline bool operator==(QPdfDocumentRenderOptions lhs, QPdfDocumentRenderOptions rhs) noexcept 79 | { 80 | return lhs.m_clipRect == rhs.m_clipRect && lhs.m_scaledSize == rhs.m_scaledSize && 81 | lhs.m_renderFlags == rhs.m_renderFlags && lhs.m_rotation == rhs.m_rotation && 82 | lhs.m_reserved == rhs.m_reserved && lhs.m_reserved2 == rhs.m_reserved2; // fix -Wunused-private-field 83 | } 84 | 85 | Q_DECL_CONSTEXPR inline bool operator!=(QPdfDocumentRenderOptions lhs, QPdfDocumentRenderOptions rhs) noexcept 86 | { 87 | return !operator==(lhs, rhs); 88 | } 89 | 90 | QT_END_NAMESPACE 91 | 92 | Q_DECLARE_METATYPE(QPdfDocumentRenderOptions) 93 | 94 | #endif // QPDFDOCUMENTRENDEROPTIONS_H 95 | -------------------------------------------------------------------------------- /qpdflinkmodel_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFLINKMODEL_P_H 38 | #define QPDFLINKMODEL_P_H 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists purely as an 45 | // implementation detail. This header file may change from version to 46 | // version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | 51 | #include "qtpdfglobal.h" 52 | #include "qpdfdocument.h" 53 | 54 | #include 55 | #include 56 | 57 | QT_BEGIN_NAMESPACE 58 | 59 | class QPdfLinkModelPrivate; 60 | 61 | class QPdfLinkModel : public QAbstractListModel 62 | { 63 | Q_OBJECT 64 | Q_PROPERTY(QPdfDocument *document READ document WRITE setDocument NOTIFY documentChanged) 65 | Q_PROPERTY(int page READ page WRITE setPage NOTIFY pageChanged) 66 | 67 | public: 68 | enum class Role : int { 69 | Rect = Qt::UserRole, 70 | Url, 71 | Page, 72 | Location, 73 | Zoom, 74 | _Count 75 | }; 76 | Q_ENUM(Role) 77 | explicit QPdfLinkModel(QObject *parent = nullptr); 78 | ~QPdfLinkModel(); 79 | 80 | QPdfDocument *document() const; 81 | 82 | QHash roleNames() const override; 83 | int rowCount(const QModelIndex &parent) const override; 84 | QVariant data(const QModelIndex &index, int role) const override; 85 | 86 | int page() const; 87 | 88 | public Q_SLOTS: 89 | void setDocument(QPdfDocument *document); 90 | void setPage(int page); 91 | 92 | Q_SIGNALS: 93 | void documentChanged(); 94 | void pageChanged(int page); 95 | 96 | private Q_SLOTS: 97 | void onStatusChanged(QPdfDocument::Status status); 98 | 99 | private: 100 | QHash m_roleNames; 101 | Q_DECLARE_PRIVATE(QPdfLinkModel) 102 | }; 103 | 104 | QT_END_NAMESPACE 105 | 106 | #endif // QPDFLINKMODEL_P_H 107 | -------------------------------------------------------------------------------- /qpdflinkmodel_p_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFLINKMODEL_P_P_H 38 | #define QPDFLINKMODEL_P_P_H 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists purely as an 45 | // implementation detail. This header file may change from version to 46 | // version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | 51 | #include "qpdflinkmodel_p.h" 52 | #include 53 | 54 | #include "third_party/pdfium/public/fpdfview.h" 55 | 56 | #include 57 | 58 | QT_BEGIN_NAMESPACE 59 | 60 | class QPdfLinkModelPrivate: public QAbstractItemModelPrivate 61 | { 62 | Q_DECLARE_PUBLIC(QPdfLinkModel) 63 | 64 | public: 65 | QPdfLinkModelPrivate(); 66 | 67 | void update(); 68 | 69 | struct Link { 70 | // where it is on the current page 71 | QRectF rect; 72 | int textStart = -1; 73 | int textCharCount = 0; 74 | // destination inside PDF 75 | int page = -1; // -1 means look at the url instead 76 | QPointF location; 77 | qreal zoom = 0; // 0 means no specified zoom: don't change when clicking 78 | // web destination 79 | QUrl url; 80 | 81 | QString toString() const; 82 | }; 83 | 84 | QPdfDocument *document = nullptr; 85 | QVector links; 86 | int page = 0; 87 | }; 88 | 89 | QT_END_NAMESPACE 90 | 91 | #endif // QPDFLINKMODEL_P_P_H 92 | -------------------------------------------------------------------------------- /qpdfnamespace.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König 4 | ** Copyright (C) 2020 The Qt Company Ltd. 5 | ** Contact: http://www.qt.io/licensing/ 6 | ** 7 | ** This file is part of the QtPDF module of the Qt Toolkit. 8 | ** 9 | ** $QT_BEGIN_LICENSE:LGPL3$ 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** GNU Lesser General Public License Usage 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser 20 | ** General Public License version 3 as published by the Free Software 21 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 22 | ** packaging of this file. Please review the following information to 23 | ** ensure the GNU Lesser General Public License version 3 requirements 24 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 25 | ** 26 | ** GNU General Public License Usage 27 | ** Alternatively, this file may be used under the terms of the GNU 28 | ** General Public License version 2.0 or later as published by the Free 29 | ** Software Foundation and appearing in the file LICENSE.GPL included in 30 | ** the packaging of this file. Please review the following information to 31 | ** ensure the GNU General Public License version 2.0 requirements will be 32 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 33 | ** 34 | ** $QT_END_LICENSE$ 35 | ** 36 | ****************************************************************************/ 37 | 38 | #ifndef QPDFNAMESPACE_H 39 | #define QPDFNAMESPACE_H 40 | 41 | #include 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | namespace QPdf { 46 | Q_NAMESPACE 47 | 48 | enum Rotation { 49 | Rotate0, 50 | Rotate90, 51 | Rotate180, 52 | Rotate270 53 | }; 54 | Q_ENUM_NS(Rotation) 55 | 56 | enum RenderFlag { 57 | NoRenderFlags = 0x000, 58 | RenderAnnotations = 0x001, 59 | RenderOptimizedForLcd = 0x002, 60 | RenderGrayscale = 0x004, 61 | RenderForceHalftone = 0x008, 62 | RenderTextAliased = 0x010, 63 | RenderImageAliased = 0x020, 64 | RenderPathAliased = 0x040 65 | }; 66 | Q_FLAG_NS(RenderFlag) 67 | Q_DECLARE_FLAGS(RenderFlags, RenderFlag) 68 | } 69 | 70 | Q_DECLARE_OPERATORS_FOR_FLAGS(QPdf::RenderFlags) 71 | 72 | QT_END_NAMESPACE 73 | #endif 74 | -------------------------------------------------------------------------------- /qpdfpagenavigation.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #include "qpdfpagenavigation.h" 38 | 39 | #include "qpdfdocument.h" 40 | 41 | #include 42 | 43 | #include 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | class QPdfPageNavigationPrivate : public QObjectPrivate 48 | { 49 | public: 50 | QPdfPageNavigationPrivate() 51 | : QObjectPrivate() 52 | { 53 | } 54 | 55 | void update() 56 | { 57 | Q_Q(QPdfPageNavigation); 58 | 59 | const bool documentAvailable = m_document && m_document->status() == QPdfDocument::Ready; 60 | 61 | if (documentAvailable) { 62 | const int newPageCount = m_document->pageCount(); 63 | if (m_pageCount != newPageCount) { 64 | m_pageCount = newPageCount; 65 | emit q->pageCountChanged(m_pageCount); 66 | } 67 | } else { 68 | if (m_pageCount != 0) { 69 | m_pageCount = 0; 70 | emit q->pageCountChanged(m_pageCount); 71 | } 72 | } 73 | 74 | if (m_currentPage != 0) { 75 | m_currentPage = 0; 76 | emit q->currentPageChanged(m_currentPage); 77 | } 78 | 79 | updatePrevNext(); 80 | } 81 | 82 | void updatePrevNext() 83 | { 84 | Q_Q(QPdfPageNavigation); 85 | 86 | const bool hasPreviousPage = m_currentPage > 0; 87 | const bool hasNextPage = m_currentPage < (m_pageCount - 1); 88 | 89 | if (m_canGoToPreviousPage != hasPreviousPage) { 90 | m_canGoToPreviousPage = hasPreviousPage; 91 | emit q->canGoToPreviousPageChanged(m_canGoToPreviousPage); 92 | } 93 | 94 | if (m_canGoToNextPage != hasNextPage) { 95 | m_canGoToNextPage = hasNextPage; 96 | emit q->canGoToNextPageChanged(m_canGoToNextPage); 97 | } 98 | } 99 | 100 | void documentStatusChanged() 101 | { 102 | update(); 103 | } 104 | 105 | Q_DECLARE_PUBLIC(QPdfPageNavigation) 106 | 107 | QPointer m_document = nullptr; 108 | int m_currentPage = 0; 109 | int m_pageCount = 0; 110 | bool m_canGoToPreviousPage = false; 111 | bool m_canGoToNextPage = false; 112 | 113 | QMetaObject::Connection m_documentStatusChangedConnection; 114 | }; 115 | 116 | /*! 117 | \class QPdfPageNavigation 118 | \since 5.10 119 | \inmodule QtPdf 120 | 121 | \brief The QPdfPageNavigation class handles the navigation through a PDF document. 122 | 123 | \sa QPdfDocument 124 | */ 125 | 126 | 127 | /*! 128 | Constructs a page navigation object with parent object \a parent. 129 | */ 130 | QPdfPageNavigation::QPdfPageNavigation(QObject *parent) 131 | : QObject(*new QPdfPageNavigationPrivate, parent) 132 | { 133 | } 134 | 135 | /*! 136 | Destroys the page navigation object. 137 | */ 138 | QPdfPageNavigation::~QPdfPageNavigation() 139 | { 140 | } 141 | 142 | /*! 143 | \property QPdfPageNavigation::document 144 | \brief The document instance on which this object navigates. 145 | 146 | By default, this property is \c nullptr. 147 | 148 | \sa document(), setDocument(), QPdfDocument 149 | */ 150 | 151 | /*! 152 | Returns the document on which this object navigates, or a \c nullptr 153 | if none has set before. 154 | 155 | \sa QPdfDocument 156 | */ 157 | QPdfDocument* QPdfPageNavigation::document() const 158 | { 159 | Q_D(const QPdfPageNavigation); 160 | 161 | return d->m_document; 162 | } 163 | 164 | /*! 165 | Sets the \a document this object navigates on. 166 | 167 | After a new document has been set, the currentPage will be \c 0. 168 | 169 | \sa QPdfDocument 170 | */ 171 | void QPdfPageNavigation::setDocument(QPdfDocument *document) 172 | { 173 | Q_D(QPdfPageNavigation); 174 | 175 | if (d->m_document == document) 176 | return; 177 | 178 | if (d->m_document) 179 | disconnect(d->m_documentStatusChangedConnection); 180 | 181 | d->m_document = document; 182 | emit documentChanged(d->m_document); 183 | 184 | if (d->m_document) 185 | d->m_documentStatusChangedConnection = connect(d->m_document.data(), &QPdfDocument::statusChanged, this, [d](){ d->documentStatusChanged(); }); 186 | 187 | d->update(); 188 | } 189 | 190 | /*! 191 | \property QPdfPageNavigation::currentPage 192 | \brief The current page number in the document. 193 | 194 | \sa currentPage(), setCurrentPage() 195 | */ 196 | 197 | /*! 198 | Returns the current page number or \c 0 if there is no document set. 199 | 200 | After a document has been loaded, the currentPage will always be \c 0. 201 | */ 202 | int QPdfPageNavigation::currentPage() const 203 | { 204 | Q_D(const QPdfPageNavigation); 205 | 206 | return d->m_currentPage; 207 | } 208 | 209 | /*! 210 | \fn void QPdfPageNavigation::setCurrentPage(int page) 211 | 212 | Sets the current \a page number. 213 | */ 214 | void QPdfPageNavigation::setCurrentPage(int newPage) 215 | { 216 | Q_D(QPdfPageNavigation); 217 | 218 | if (newPage < 0 || newPage >= d->m_pageCount) 219 | return; 220 | 221 | if (d->m_currentPage == newPage) 222 | return; 223 | 224 | d->m_currentPage = newPage; 225 | emit currentPageChanged(d->m_currentPage); 226 | 227 | d->updatePrevNext(); 228 | } 229 | 230 | /*! 231 | \property QPdfPageNavigation::pageCount 232 | \brief The number of pages in the document. 233 | 234 | \sa pageCount() 235 | */ 236 | 237 | /*! 238 | Returns the number of pages in the document or \c 0 if there 239 | is no document set. 240 | */ 241 | int QPdfPageNavigation::pageCount() const 242 | { 243 | Q_D(const QPdfPageNavigation); 244 | 245 | return d->m_pageCount; 246 | } 247 | 248 | /*! 249 | \property QPdfPageNavigation::canGoToPreviousPage 250 | \brief Indicates whether there is a page before the current page. 251 | 252 | \sa canGoToPreviousPage(), goToPreviousPage() 253 | */ 254 | 255 | /*! 256 | Returns whether there is a page before the current one. 257 | */ 258 | bool QPdfPageNavigation::canGoToPreviousPage() const 259 | { 260 | Q_D(const QPdfPageNavigation); 261 | 262 | return d->m_canGoToPreviousPage; 263 | } 264 | 265 | /*! 266 | \property QPdfPageNavigation::canGoToNextPage 267 | \brief Indicates whether there is a page after the current page. 268 | 269 | \sa canGoToNextPage(), goToNextPage() 270 | */ 271 | 272 | /*! 273 | Returns whether there is a page after the current one. 274 | */ 275 | bool QPdfPageNavigation::canGoToNextPage() const 276 | { 277 | Q_D(const QPdfPageNavigation); 278 | 279 | return d->m_canGoToNextPage; 280 | } 281 | 282 | /*! 283 | Changes the current page to the previous page. 284 | 285 | If there is no previous page in the document, nothing happens. 286 | 287 | \sa canGoToPreviousPage 288 | */ 289 | void QPdfPageNavigation::goToPreviousPage() 290 | { 291 | Q_D(QPdfPageNavigation); 292 | 293 | if (d->m_currentPage > 0) 294 | setCurrentPage(d->m_currentPage - 1); 295 | } 296 | 297 | /*! 298 | Changes the current page to the next page. 299 | 300 | If there is no next page in the document, nothing happens. 301 | 302 | \sa canGoToNextPage 303 | */ 304 | void QPdfPageNavigation::goToNextPage() 305 | { 306 | Q_D(QPdfPageNavigation); 307 | 308 | if (d->m_currentPage < d->m_pageCount - 1) 309 | setCurrentPage(d->m_currentPage + 1); 310 | } 311 | 312 | QT_END_NAMESPACE 313 | 314 | #include "moc_qpdfpagenavigation.cpp" 315 | -------------------------------------------------------------------------------- /qpdfpagenavigation.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König 4 | ** Copyright (C) 2020 The Qt Company Ltd. 5 | ** Contact: http://www.qt.io/licensing/ 6 | ** 7 | ** This file is part of the QtPDF module of the Qt Toolkit. 8 | ** 9 | ** $QT_BEGIN_LICENSE:LGPL3$ 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** GNU Lesser General Public License Usage 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser 20 | ** General Public License version 3 as published by the Free Software 21 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 22 | ** packaging of this file. Please review the following information to 23 | ** ensure the GNU Lesser General Public License version 3 requirements 24 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 25 | ** 26 | ** GNU General Public License Usage 27 | ** Alternatively, this file may be used under the terms of the GNU 28 | ** General Public License version 2.0 or later as published by the Free 29 | ** Software Foundation and appearing in the file LICENSE.GPL included in 30 | ** the packaging of this file. Please review the following information to 31 | ** ensure the GNU General Public License version 2.0 requirements will be 32 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 33 | ** 34 | ** $QT_END_LICENSE$ 35 | ** 36 | ****************************************************************************/ 37 | 38 | #ifndef QPDFPAGENAVIGATION_H 39 | #define QPDFPAGENAVIGATION_H 40 | 41 | #include "qtpdfglobal.h" 42 | #include 43 | 44 | QT_BEGIN_NAMESPACE 45 | 46 | class QPdfDocument; 47 | class QPdfPageNavigationPrivate; 48 | 49 | class QPdfPageNavigation : public QObject 50 | { 51 | Q_OBJECT 52 | 53 | Q_PROPERTY(QPdfDocument* document READ document WRITE setDocument NOTIFY documentChanged) 54 | 55 | Q_PROPERTY(int currentPage READ currentPage WRITE setCurrentPage NOTIFY currentPageChanged) 56 | Q_PROPERTY(int pageCount READ pageCount NOTIFY pageCountChanged) 57 | Q_PROPERTY(bool canGoToPreviousPage READ canGoToPreviousPage NOTIFY canGoToPreviousPageChanged) 58 | Q_PROPERTY(bool canGoToNextPage READ canGoToNextPage NOTIFY canGoToNextPageChanged) 59 | 60 | public: 61 | explicit QPdfPageNavigation(QObject *parent = nullptr); 62 | ~QPdfPageNavigation(); 63 | 64 | QPdfDocument* document() const; 65 | void setDocument(QPdfDocument *document); 66 | 67 | int currentPage() const; 68 | void setCurrentPage(int currentPage); 69 | 70 | int pageCount() const; 71 | 72 | bool canGoToPreviousPage() const; 73 | bool canGoToNextPage() const; 74 | 75 | public Q_SLOTS: 76 | void goToPreviousPage(); 77 | void goToNextPage(); 78 | 79 | Q_SIGNALS: 80 | void documentChanged(QPdfDocument *document); 81 | void currentPageChanged(int currentPage); 82 | void pageCountChanged(int pageCount); 83 | void canGoToPreviousPageChanged(bool canGo); 84 | void canGoToNextPageChanged(bool canGo); 85 | 86 | private: 87 | Q_DECLARE_PRIVATE(QPdfPageNavigation) 88 | }; 89 | 90 | QT_END_NAMESPACE 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /qpdfpagerenderer.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König 4 | ** Copyright (C) 2020 The Qt Company Ltd. 5 | ** Contact: http://www.qt.io/licensing/ 6 | ** 7 | ** This file is part of the QtPDF module of the Qt Toolkit. 8 | ** 9 | ** $QT_BEGIN_LICENSE:LGPL3$ 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** GNU Lesser General Public License Usage 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser 20 | ** General Public License version 3 as published by the Free Software 21 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 22 | ** packaging of this file. Please review the following information to 23 | ** ensure the GNU Lesser General Public License version 3 requirements 24 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 25 | ** 26 | ** GNU General Public License Usage 27 | ** Alternatively, this file may be used under the terms of the GNU 28 | ** General Public License version 2.0 or later as published by the Free 29 | ** Software Foundation and appearing in the file LICENSE.GPL included in 30 | ** the packaging of this file. Please review the following information to 31 | ** ensure the GNU General Public License version 2.0 requirements will be 32 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 33 | ** 34 | ** $QT_END_LICENSE$ 35 | ** 36 | ****************************************************************************/ 37 | 38 | #ifndef QPDFPAGERENDERER_H 39 | #define QPDFPAGERENDERER_H 40 | 41 | #include "qtpdfglobal.h" 42 | 43 | #include 44 | #include 45 | #include "qpdfdocumentrenderoptions.h" 46 | 47 | QT_BEGIN_NAMESPACE 48 | 49 | class QPdfDocument; 50 | class QPdfPageRendererPrivate; 51 | 52 | class QPdfPageRenderer : public QObject 53 | { 54 | Q_OBJECT 55 | 56 | Q_PROPERTY(QPdfDocument* document READ document WRITE setDocument NOTIFY documentChanged) 57 | Q_PROPERTY(RenderMode renderMode READ renderMode WRITE setRenderMode NOTIFY renderModeChanged) 58 | 59 | public: 60 | enum class RenderMode 61 | { 62 | MultiThreaded, 63 | SingleThreaded 64 | }; 65 | Q_ENUM(RenderMode) 66 | 67 | explicit QPdfPageRenderer(QObject *parent = nullptr); 68 | ~QPdfPageRenderer() override; 69 | 70 | RenderMode renderMode() const; 71 | void setRenderMode(RenderMode mode); 72 | 73 | QPdfDocument* document() const; 74 | void setDocument(QPdfDocument *document); 75 | 76 | quint64 requestPage(int pageNumber, QSize imageSize, 77 | QPdfDocumentRenderOptions options = QPdfDocumentRenderOptions()); 78 | 79 | Q_SIGNALS: 80 | void documentChanged(QPdfDocument *document); 81 | void renderModeChanged(RenderMode renderMode); 82 | 83 | void pageRendered(int pageNumber, QSize imageSize, const QImage &image, 84 | QPdfDocumentRenderOptions options, quint64 requestId); 85 | 86 | private: 87 | Q_DECLARE_PRIVATE(QPdfPageRenderer) 88 | }; 89 | 90 | QT_END_NAMESPACE 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /qpdfsearchmodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFSEARCHMODEL_H 38 | #define QPDFSEARCHMODEL_H 39 | 40 | #include "qtpdfglobal.h" 41 | 42 | #include 43 | #include "qpdfdocument.h" 44 | #include "qpdfsearchresult.h" 45 | 46 | QT_BEGIN_NAMESPACE 47 | 48 | class QPdfSearchModelPrivate; 49 | 50 | class QPdfSearchModel : public QAbstractListModel 51 | { 52 | Q_OBJECT 53 | Q_PROPERTY(QPdfDocument *document READ document WRITE setDocument NOTIFY documentChanged) 54 | Q_PROPERTY(QString searchString READ searchString WRITE setSearchString NOTIFY searchStringChanged) 55 | 56 | public: 57 | enum class Role : int { 58 | Page = Qt::UserRole, 59 | IndexOnPage, 60 | Location, 61 | ContextBefore, 62 | ContextAfter, 63 | _Count 64 | }; 65 | Q_ENUM(Role) 66 | explicit QPdfSearchModel(QObject *parent = nullptr); 67 | ~QPdfSearchModel(); 68 | 69 | QVector resultsOnPage(int page) const; 70 | QPdfSearchResult resultAtIndex(int index) const; 71 | 72 | QPdfDocument *document() const; 73 | QString searchString() const; 74 | 75 | QHash roleNames() const override; 76 | int rowCount(const QModelIndex &parent) const override; 77 | QVariant data(const QModelIndex &index, int role) const override; 78 | 79 | public Q_SLOTS: 80 | void setSearchString(QString searchString); 81 | void setDocument(QPdfDocument *document); 82 | 83 | Q_SIGNALS: 84 | void documentChanged(); 85 | void searchStringChanged(); 86 | 87 | protected: 88 | void updatePage(int page); 89 | void timerEvent(QTimerEvent *event) override; 90 | 91 | private: 92 | QHash m_roleNames; 93 | Q_DECLARE_PRIVATE(QPdfSearchModel) 94 | }; 95 | 96 | QT_END_NAMESPACE 97 | 98 | #endif // QPDFSEARCHMODEL_H 99 | -------------------------------------------------------------------------------- /qpdfsearchmodel_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFSEARCHMODEL_P_H 38 | #define QPDFSEARCHMODEL_P_H 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists purely as an 45 | // implementation detail. This header file may change from version to 46 | // version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | 51 | #include "qpdfsearchmodel.h" 52 | #include "qpdfsearchresult_p.h" 53 | #include 54 | 55 | #include "third_party/pdfium/public/fpdfview.h" 56 | 57 | QT_BEGIN_NAMESPACE 58 | 59 | class QPdfSearchModelPrivate : public QAbstractItemModelPrivate 60 | { 61 | Q_DECLARE_PUBLIC(QPdfSearchModel) 62 | 63 | public: 64 | QPdfSearchModelPrivate(); 65 | void clearResults(); 66 | bool doSearch(int page); 67 | 68 | struct PageAndIndex { 69 | int page; 70 | int index; 71 | }; 72 | PageAndIndex pageAndIndexForResult(int resultIndex); 73 | int rowsBeforePage(int page); 74 | 75 | QPdfDocument *document = nullptr; 76 | QString searchString; 77 | QVector pagesSearched; 78 | QVector> searchResults; 79 | int rowCountSoFar = 0; 80 | int updateTimerId = -1; 81 | int nextPageToUpdate = 0; 82 | }; 83 | 84 | QT_END_NAMESPACE 85 | 86 | #endif // QPDFSEARCHMODEL_P_H 87 | -------------------------------------------------------------------------------- /qpdfsearchresult.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #include "qpdfsearchresult.h" 38 | #include "qpdfsearchresult_p.h" 39 | 40 | QT_BEGIN_NAMESPACE 41 | 42 | QPdfSearchResult::QPdfSearchResult() : 43 | QPdfSearchResult(new QPdfSearchResultPrivate()) { } 44 | 45 | QPdfSearchResult::QPdfSearchResult(int page, QVector rects, QString contextBefore, QString contextAfter) : 46 | QPdfSearchResult(new QPdfSearchResultPrivate(page, rects, contextBefore, contextAfter)) { } 47 | 48 | QPdfSearchResult::QPdfSearchResult(QPdfSearchResultPrivate *d) : 49 | QPdfDestination(static_cast(d)) { } 50 | 51 | QString QPdfSearchResult::contextBefore() const 52 | { 53 | return static_cast(d.data())->contextBefore; 54 | } 55 | 56 | QString QPdfSearchResult::contextAfter() const 57 | { 58 | return static_cast(d.data())->contextAfter; 59 | } 60 | 61 | QVector QPdfSearchResult::rectangles() const 62 | { 63 | return static_cast(d.data())->rects; 64 | } 65 | 66 | QDebug operator<<(QDebug dbg, const QPdfSearchResult &searchResult) 67 | { 68 | QDebugStateSaver saver(dbg); 69 | dbg.nospace(); 70 | dbg << "QPdfSearchResult(page=" << searchResult.page() 71 | << " contextBefore=" << searchResult.contextBefore() 72 | << " contextAfter=" << searchResult.contextAfter() 73 | << " rects=" << searchResult.rectangles(); 74 | dbg << ')'; 75 | return dbg; 76 | } 77 | 78 | QT_END_NAMESPACE 79 | 80 | #include "moc_qpdfsearchresult.cpp" 81 | -------------------------------------------------------------------------------- /qpdfsearchresult.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFSEARCHRESULT_H 38 | #define QPDFSEARCHRESULT_H 39 | 40 | #include 41 | #include 42 | #include 43 | #include "qpdfdestination.h" 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | class QPdfSearchResultPrivate; 48 | 49 | class QPdfSearchResult : public QPdfDestination 50 | { 51 | Q_GADGET 52 | Q_PROPERTY(QString contextBefore READ contextBefore) 53 | Q_PROPERTY(QString contextAfter READ contextAfter) 54 | Q_PROPERTY(QVector rectangles READ rectangles) 55 | 56 | public: 57 | QPdfSearchResult(); 58 | ~QPdfSearchResult() {} 59 | 60 | QString contextBefore() const; 61 | QString contextAfter() const; 62 | QVector rectangles() const; 63 | 64 | private: 65 | QPdfSearchResult(int page, QVector rects, QString contextBefore, QString contextAfter); 66 | QPdfSearchResult(QPdfSearchResultPrivate *d); 67 | friend class QPdfDocument; 68 | friend class QPdfSearchModelPrivate; 69 | friend class QQuickPdfNavigationStack; 70 | }; 71 | 72 | QDebug operator<<(QDebug, const QPdfSearchResult &); 73 | 74 | QT_END_NAMESPACE 75 | 76 | #endif // QPDFSEARCHRESULT_H 77 | -------------------------------------------------------------------------------- /qpdfsearchresult_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFSEARCHRESULT_P_H 38 | #define QPDFSEARCHRESULT_P_H 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists purely as an 45 | // implementation detail. This header file may change from version to 46 | // version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | 51 | #include "qpdfdestination_p.h" 52 | 53 | QT_BEGIN_NAMESPACE 54 | 55 | class QPdfSearchResultPrivate : public QPdfDestinationPrivate 56 | { 57 | public: 58 | QPdfSearchResultPrivate() = default; 59 | QPdfSearchResultPrivate(int page, QVector rects, QString contextBefore, QString contextAfter) : 60 | QPdfDestinationPrivate(page, rects.first().topLeft(), 0), 61 | contextBefore(contextBefore), 62 | contextAfter(contextAfter), 63 | rects(rects) {} 64 | 65 | QString contextBefore; 66 | QString contextAfter; 67 | QVector rects; 68 | }; 69 | 70 | QT_END_NAMESPACE 71 | 72 | #endif // QPDFSEARCHRESULT_P_H 73 | -------------------------------------------------------------------------------- /qpdfselection.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #include "qpdfselection.h" 38 | #include "qpdfselection_p.h" 39 | #include 40 | 41 | QT_BEGIN_NAMESPACE 42 | 43 | /*! 44 | \class QPdfSelection 45 | \since 5.15 46 | \inmodule QtPdf 47 | 48 | \brief The QPdfSelection class defines a range of text that has been selected 49 | on one page in a PDF document, and its geometric boundaries. 50 | 51 | \sa QPdfDocument::getSelection() 52 | */ 53 | 54 | /*! 55 | Constructs an invalid selection. 56 | 57 | \sa valid 58 | */ 59 | QPdfSelection::QPdfSelection() 60 | : d(new QPdfSelectionPrivate()) 61 | { 62 | } 63 | 64 | /*! 65 | \internal 66 | Constructs a selection including the range of characters that make up the 67 | \a text string, and which take up space on the page within the polygon 68 | regions given in \a bounds. 69 | */ 70 | QPdfSelection::QPdfSelection(const QString &text, QVector bounds, QRectF boundingRect, int startIndex, int endIndex) 71 | : d(new QPdfSelectionPrivate(text, bounds, boundingRect, startIndex, endIndex)) 72 | { 73 | } 74 | 75 | QPdfSelection::QPdfSelection(QPdfSelectionPrivate *d) 76 | : d(d) 77 | { 78 | } 79 | 80 | QPdfSelection::QPdfSelection(const QPdfSelection &other) 81 | : d(other.d) 82 | { 83 | } 84 | 85 | QPdfSelection::QPdfSelection(QPdfSelection &&other) noexcept 86 | : d(std::move(other.d)) 87 | { 88 | } 89 | 90 | QPdfSelection::~QPdfSelection() 91 | { 92 | } 93 | 94 | QPdfSelection &QPdfSelection::operator=(const QPdfSelection &other) 95 | { 96 | d = other.d; 97 | return *this; 98 | } 99 | 100 | /*! 101 | \property QPdfSelection::valid 102 | 103 | This property holds whether the selection is valid. 104 | */ 105 | bool QPdfSelection::isValid() const 106 | { 107 | return !d->bounds.isEmpty(); 108 | } 109 | 110 | /*! 111 | \property QPdfSelection::bounds 112 | 113 | This property holds a set of regions that the selected text occupies on the 114 | page, represented as polygons. The coordinate system for the polygons has 115 | the origin at the upper-left corner of the page, and the units are 116 | \l {https://en.wikipedia.org/wiki/Point_(typography)}{points}. 117 | 118 | \note For now, the polygons returned from \l QPdfDocument::getSelection() 119 | are always rectangles; but in the future it may be possible to represent 120 | more complex regions. 121 | */ 122 | QVector QPdfSelection::bounds() const 123 | { 124 | return d->bounds; 125 | } 126 | 127 | /*! 128 | \property QPdfSelection::text 129 | 130 | This property holds the selected text. 131 | */ 132 | QString QPdfSelection::text() const 133 | { 134 | return d->text; 135 | } 136 | 137 | /*! 138 | \property rect QPdfSelection::boundingRectangle 139 | 140 | This property holds the overall bounding rectangle (convex hull) around \l bounds. 141 | */ 142 | QRectF QPdfSelection::boundingRectangle() const 143 | { 144 | return d->boundingRect; 145 | } 146 | 147 | /*! 148 | \property int QPdfSelection::startIndex 149 | 150 | This property holds the index at the beginning of \l text within the full text on the page. 151 | */ 152 | int QPdfSelection::startIndex() const 153 | { 154 | return d->startIndex; 155 | } 156 | 157 | /*! 158 | \property int QPdfSelection::endIndex 159 | 160 | This property holds the index at the end of \l text within the full text on the page. 161 | */ 162 | int QPdfSelection::endIndex() const 163 | { 164 | return d->endIndex; 165 | } 166 | 167 | #if QT_CONFIG(clipboard) 168 | /*! 169 | Copies \l text to the \l {QGuiApplication::clipboard()}{system clipboard}. 170 | */ 171 | void QPdfSelection::copyToClipboard(QClipboard::Mode mode) const 172 | { 173 | QGuiApplication::clipboard()->setText(d->text, mode); 174 | } 175 | #endif 176 | 177 | QT_END_NAMESPACE 178 | 179 | #include "moc_qpdfselection.cpp" 180 | -------------------------------------------------------------------------------- /qpdfselection.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFSELECTION_H 38 | #define QPDFSELECTION_H 39 | 40 | #include "qtpdfglobal.h" 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | QT_BEGIN_NAMESPACE 48 | 49 | class QPdfSelectionPrivate; 50 | 51 | class QPdfSelection 52 | { 53 | Q_GADGET 54 | Q_PROPERTY(bool valid READ isValid) 55 | Q_PROPERTY(QVector bounds READ bounds) 56 | Q_PROPERTY(QRectF boundingRectangle READ boundingRectangle) 57 | Q_PROPERTY(QString text READ text) 58 | Q_PROPERTY(int startIndex READ startIndex) 59 | Q_PROPERTY(int endIndex READ endIndex) 60 | 61 | public: 62 | ~QPdfSelection(); 63 | QPdfSelection(const QPdfSelection &other); 64 | QPdfSelection &operator=(const QPdfSelection &other); 65 | QPdfSelection(QPdfSelection &&other) noexcept; 66 | QPdfSelection &operator=(QPdfSelection &&other) noexcept { swap(other); return *this; } 67 | void swap(QPdfSelection &other) noexcept { d.swap(other.d); } 68 | bool isValid() const; 69 | QVector bounds() const; 70 | QString text() const; 71 | QRectF boundingRectangle() const; 72 | int startIndex() const; 73 | int endIndex() const; 74 | #if QT_CONFIG(clipboard) 75 | void copyToClipboard(QClipboard::Mode mode = QClipboard::Clipboard) const; 76 | #endif 77 | 78 | private: 79 | QPdfSelection(); 80 | QPdfSelection(const QString &text, QVector bounds, QRectF boundingRect, int startIndex, int endIndex); 81 | QPdfSelection(QPdfSelectionPrivate *d); 82 | friend class QPdfDocument; 83 | friend class QQuickPdfSelection; 84 | 85 | private: 86 | QExplicitlySharedDataPointer d; 87 | }; 88 | 89 | QT_END_NAMESPACE 90 | 91 | #endif // QPDFSELECTION_H 92 | -------------------------------------------------------------------------------- /qpdfselection_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QPDFSELECTION_P_H 38 | #define QPDFSELECTION_P_H 39 | 40 | #include 41 | #include 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | class QPdfSelectionPrivate : public QSharedData 46 | { 47 | public: 48 | QPdfSelectionPrivate() = default; 49 | QPdfSelectionPrivate(const QString &text, QVector bounds, QRectF boundingRect, int startIndex, int endIndex) 50 | : text(text), 51 | bounds(bounds), 52 | boundingRect(boundingRect), 53 | startIndex(startIndex), 54 | endIndex(endIndex) { } 55 | 56 | QString text; 57 | QVector bounds; 58 | QRectF boundingRect; 59 | int startIndex; 60 | int endIndex; 61 | }; 62 | 63 | QT_END_NAMESPACE 64 | 65 | #endif // QPDFSELECTION_P_H 66 | -------------------------------------------------------------------------------- /qtpdf-config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QPdfReader/CMakePdfDemo/81f5d9fa5c3609b43b821942cce65aef098154b6/qtpdf-config.h -------------------------------------------------------------------------------- /qtpdf-config_p.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QPdfReader/CMakePdfDemo/81f5d9fa5c3609b43b821942cce65aef098154b6/qtpdf-config_p.h -------------------------------------------------------------------------------- /qtpdfglobal.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2020 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtPDF module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or later as published by the Free 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in 29 | ** the packaging of this file. Please review the following information to 30 | ** ensure the GNU General Public License version 2.0 requirements will be 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 | ** 33 | ** $QT_END_LICENSE$ 34 | ** 35 | ****************************************************************************/ 36 | 37 | #ifndef QTPDFGLOBAL_H 38 | #define QTPDFGLOBAL_H 39 | 40 | #include 41 | 42 | QT_BEGIN_NAMESPACE 43 | 44 | #ifndef Q_PDF_EXPORT 45 | # ifndef QT_STATIC 46 | # if defined(QT_BUILD_PDF_LIB) 47 | # define Q_PDF_EXPORT Q_DECL_EXPORT 48 | # else 49 | # define Q_PDF_EXPORT Q_DECL_IMPORT 50 | # endif 51 | # else 52 | # define Q_PDF_EXPORT 53 | # endif 54 | #endif 55 | 56 | #define Q_PDF_PRIVATE_EXPORT Q_PDF_EXPORT 57 | 58 | QT_END_NAMESPACE 59 | 60 | #endif // QTPDFGLOBAL_H 61 | 62 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | -------------------------------------------------------------------------------- /third_party/pdfium/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 | --------------------------------------------------------------------------------