Showing
20 changed files
with
3626 additions
and
16 deletions
Too many changes to show.
To preserve performance only 20 of 20+ files are displayed.
| @@ -13,8 +13,8 @@ | @@ -13,8 +13,8 @@ | ||
| 13 | # limitations under the License. | 13 | # limitations under the License. |
| 14 | 14 | ||
| 15 | DART_SRC=$(shell find . -name '*.dart') | 15 | DART_SRC=$(shell find . -name '*.dart') |
| 16 | - CLNG_SRC=$(shell find printing/ios -name '*.java' -o -name '*.m' -o -name '*.h') $(shell find printing/android -name '*.java' -o -name '*.m' -o -name '*.h') | ||
| 17 | - SWFT_SRC=$(shell find . -name '*.swift') | 16 | + CLNG_SRC=$(shell find printing/ios printing/macos printing/windows printing/android -name '*.cpp' -o -name '*.m' -o -name '*.h' -o -name '*.java') |
| 17 | + SWFT_SRC=$(shell find printing/ios printing/macos -name '*.swift') | ||
| 18 | FONTS=pdf/open-sans.ttf pdf/open-sans-bold.ttf pdf/roboto.ttf pdf/noto-sans.ttf pdf/genyomintw.ttf demo/assets/roboto1.ttf demo/assets/roboto2.ttf demo/assets/roboto3.ttf demo/assets/open-sans.ttf demo/assets/open-sans-bold.ttf pdf/hacen-tunisia.ttf | 18 | FONTS=pdf/open-sans.ttf pdf/open-sans-bold.ttf pdf/roboto.ttf pdf/noto-sans.ttf pdf/genyomintw.ttf demo/assets/roboto1.ttf demo/assets/roboto2.ttf demo/assets/roboto3.ttf demo/assets/open-sans.ttf demo/assets/open-sans-bold.ttf pdf/hacen-tunisia.ttf |
| 19 | COV_PORT=9292 | 19 | COV_PORT=9292 |
| 20 | 20 | ||
| @@ -63,13 +63,13 @@ pdf/hacen-tunisia.ttf: | @@ -63,13 +63,13 @@ pdf/hacen-tunisia.ttf: | ||
| 63 | format: format-dart format-clang format-swift | 63 | format: format-dart format-clang format-swift |
| 64 | 64 | ||
| 65 | format-dart: $(DART_SRC) | 65 | format-dart: $(DART_SRC) |
| 66 | - dartfmt -w --fix $^ | 66 | + dart format --fix $^ |
| 67 | 67 | ||
| 68 | format-clang: $(CLNG_SRC) | 68 | format-clang: $(CLNG_SRC) |
| 69 | clang-format -style=Chromium -i $^ | 69 | clang-format -style=Chromium -i $^ |
| 70 | 70 | ||
| 71 | format-swift: $(SWFT_SRC) | 71 | format-swift: $(SWFT_SRC) |
| 72 | - swiftformat --swiftversion 4.2 $^ | 72 | + which swiftformat && swiftformat --swiftversion 4.2 $^ || true |
| 73 | 73 | ||
| 74 | .coverage: | 74 | .coverage: |
| 75 | which coverage || pub global activate coverage | 75 | which coverage || pub global activate coverage |
| @@ -83,7 +83,7 @@ printing/example/.metadata: | @@ -83,7 +83,7 @@ printing/example/.metadata: | ||
| 83 | rm -rf printing/example/test | 83 | rm -rf printing/example/test |
| 84 | 84 | ||
| 85 | pdf/pubspec.lock: pdf/pubspec.yaml | 85 | pdf/pubspec.lock: pdf/pubspec.yaml |
| 86 | - cd pdf; pub get | 86 | + cd pdf; dart pub get |
| 87 | 87 | ||
| 88 | printing/pubspec.lock: printing/pubspec.yaml | 88 | printing/pubspec.lock: printing/pubspec.yaml |
| 89 | cd printing; flutter packages get | 89 | cd printing; flutter packages get |
| @@ -122,50 +122,50 @@ clean: | @@ -122,50 +122,50 @@ clean: | ||
| 122 | publish-pdf: format clean | 122 | publish-pdf: format clean |
| 123 | test -z "$(shell git status --porcelain)" | 123 | test -z "$(shell git status --porcelain)" |
| 124 | find pdf -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' | 124 | find pdf -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' |
| 125 | - cd pdf; pub publish -f | 125 | + cd pdf; dart pub publish -f |
| 126 | find pdf -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' | 126 | find pdf -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' |
| 127 | git tag $(shell grep version pdf/pubspec.yaml | sed 's/version\s*:\s*/pdf-/g') | 127 | git tag $(shell grep version pdf/pubspec.yaml | sed 's/version\s*:\s*/pdf-/g') |
| 128 | 128 | ||
| 129 | publish-printing: format clean | 129 | publish-printing: format clean |
| 130 | test -z "$(shell git status --porcelain)" | 130 | test -z "$(shell git status --porcelain)" |
| 131 | find printing -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' | 131 | find printing -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' |
| 132 | - cd printing; pub publish -f | 132 | + cd printing; dart pub publish -f |
| 133 | find printing -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' | 133 | find printing -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' |
| 134 | git tag $(shell grep version printing/pubspec.yaml | sed 's/version\s*:\s*/printing-/g') | 134 | git tag $(shell grep version printing/pubspec.yaml | sed 's/version\s*:\s*/printing-/g') |
| 135 | 135 | ||
| 136 | .pana: | 136 | .pana: |
| 137 | - which pana || pub global activate pana | 137 | + which pana || dart pub global activate pana |
| 138 | touch $@ | 138 | touch $@ |
| 139 | 139 | ||
| 140 | analyze-pdf: .pana | 140 | analyze-pdf: .pana |
| 141 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' | 141 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' |
| 142 | - @pub global run pana --no-warning --source path pdf 2> /dev/null | python test/pana_report.py | 142 | + @dart pub global run pana --no-warning --source path pdf 2> /dev/null | python test/pana_report.py |
| 143 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' | 143 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' |
| 144 | 144 | ||
| 145 | analyze-printing: .pana | 145 | analyze-printing: .pana |
| 146 | @find printing -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' | 146 | @find printing -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' |
| 147 | - @pub global run pana --no-warning --source path printing 2> /dev/null | python test/pana_report.py | 147 | + @dart pub global run pana --no-warning --source path printing 2> /dev/null | python test/pana_report.py |
| 148 | @find printing -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' | 148 | @find printing -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' |
| 149 | 149 | ||
| 150 | analyze: analyze-pdf analyze-printing | 150 | analyze: analyze-pdf analyze-printing |
| 151 | 151 | ||
| 152 | analyze-ci-pdf: .pana | 152 | analyze-ci-pdf: .pana |
| 153 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' | 153 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' |
| 154 | - @pub global run pana --no-warning --source path pdf | 154 | + @dart pub global run pana --no-warning --source path pdf |
| 155 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' | 155 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' |
| 156 | 156 | ||
| 157 | analyze-ci-printing: .pana | 157 | analyze-ci-printing: .pana |
| 158 | @find printing -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' | 158 | @find printing -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' |
| 159 | - @pub global run pana --no-warning --source path printing | 159 | + @dart pub global run pana --no-warning --source path printing |
| 160 | @find printing -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' | 160 | @find printing -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' |
| 161 | 161 | ||
| 162 | .dartfix: | 162 | .dartfix: |
| 163 | - which dartfix || pub global activate dartfix | 163 | + which dartfix || dart pub global activate dartfix |
| 164 | touch $@ | 164 | touch $@ |
| 165 | 165 | ||
| 166 | fix: get .dartfix | 166 | fix: get .dartfix |
| 167 | - cd pdf; pub global run dartfix:fix --overwrite . | ||
| 168 | - cd printing; pub global run dartfix:fix --overwrite . | 167 | + cd pdf; dart pub global run dartfix:fix --overwrite . |
| 168 | + cd printing; dart pub global run dartfix:fix --overwrite . | ||
| 169 | 169 | ||
| 170 | ref: | 170 | ref: |
| 171 | mkdir -p ref | 171 | mkdir -p ref |
| @@ -4,7 +4,7 @@ description: Plugin that allows Flutter apps to generate and print documents to | @@ -4,7 +4,7 @@ description: Plugin that allows Flutter apps to generate and print documents to | ||
| 4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing | 4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing |
| 5 | repository: https://github.com/DavBfr/dart_pdf | 5 | repository: https://github.com/DavBfr/dart_pdf |
| 6 | issue_tracker: https://github.com/DavBfr/dart_pdf/issues | 6 | issue_tracker: https://github.com/DavBfr/dart_pdf/issues |
| 7 | -version: 3.6.4 | 7 | +version: 3.7.0 |
| 8 | 8 | ||
| 9 | environment: | 9 | environment: |
| 10 | sdk: ">=2.3.0 <3.0.0" | 10 | sdk: ">=2.3.0 <3.0.0" |
| @@ -43,3 +43,5 @@ flutter: | @@ -43,3 +43,5 @@ flutter: | ||
| 43 | web: | 43 | web: |
| 44 | fileName: src/printing_web.dart | 44 | fileName: src/printing_web.dart |
| 45 | pluginClass: PrintingPlugin | 45 | pluginClass: PrintingPlugin |
| 46 | + windows: | ||
| 47 | + pluginClass: PrintingPlugin |
printing/windows/.gitignore
0 → 100644
| 1 | +flutter/ | ||
| 2 | + | ||
| 3 | +# Visual Studio user-specific files. | ||
| 4 | +*.suo | ||
| 5 | +*.user | ||
| 6 | +*.userosscache | ||
| 7 | +*.sln.docstates | ||
| 8 | + | ||
| 9 | +# Visual Studio build-related files. | ||
| 10 | +x64/ | ||
| 11 | +x86/ | ||
| 12 | + | ||
| 13 | +# Visual Studio cache files | ||
| 14 | +# files ending in .cache can be ignored | ||
| 15 | +*.[Cc]ache | ||
| 16 | +# but keep track of directories ending in .cache | ||
| 17 | +!*.[Cc]ache/ | ||
| 18 | + | ||
| 19 | +!pdfium/x64 | ||
| 20 | +!pdfium/x86 |
printing/windows/CMakeLists.txt
0 → 100755
| 1 | +# Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com> | ||
| 2 | +# | ||
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| 4 | +# use this file except in compliance with the License. You may obtain a copy of | ||
| 5 | +# the License at | ||
| 6 | +# | ||
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | +# | ||
| 9 | +# Unless required by applicable law or agreed to in writing, software | ||
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| 11 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| 12 | +# License for the specific language governing permissions and limitations under | ||
| 13 | +# the License. | ||
| 14 | + | ||
| 15 | +cmake_minimum_required(VERSION 3.15) | ||
| 16 | +set(PROJECT_NAME "printing") | ||
| 17 | +project(${PROJECT_NAME} LANGUAGES CXX) | ||
| 18 | + | ||
| 19 | +# This value is used when generating builds using this plugin, so it must not be | ||
| 20 | +# changed | ||
| 21 | +set(PLUGIN_NAME "printing_plugin") | ||
| 22 | + | ||
| 23 | +include(pdfium/PDFiumConfig.cmake) | ||
| 24 | + | ||
| 25 | +add_library(${PLUGIN_NAME} SHARED | ||
| 26 | + "printing.cpp" | ||
| 27 | + "printing.h" | ||
| 28 | + "printing_plugin.cpp" | ||
| 29 | + "include/printing/printing_plugin.h" | ||
| 30 | + "print_job.cpp" | ||
| 31 | + "print_job.h") | ||
| 32 | + | ||
| 33 | +apply_standard_settings(${PLUGIN_NAME}) | ||
| 34 | +set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) | ||
| 35 | +target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) | ||
| 36 | +target_include_directories(${PLUGIN_NAME} | ||
| 37 | + INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
| 38 | +target_link_libraries(${PLUGIN_NAME} PRIVATE pdfium flutter flutter_wrapper_plugin) | ||
| 39 | + | ||
| 40 | +# List of absolute paths to libraries that should be bundled with the plugin | ||
| 41 | +set(printing_bundled_libraries "${CMAKE_CURRENT_SOURCE_DIR}/pdfium/x64/bin/pdfium.dll" PARENT_SCOPE) |
| 1 | +/* | ||
| 2 | + * Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com> | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +#ifndef FLUTTER_PLUGIN_PRINTING_PLUGIN_H_ | ||
| 18 | +#define FLUTTER_PLUGIN_PRINTING_PLUGIN_H_ | ||
| 19 | + | ||
| 20 | +#include <flutter_plugin_registrar.h> | ||
| 21 | + | ||
| 22 | +#ifdef FLUTTER_PLUGIN_IMPL | ||
| 23 | +#define FLUTTER_PLUGIN_EXPORT __declspec(dllexport) | ||
| 24 | +#else | ||
| 25 | +#define FLUTTER_PLUGIN_EXPORT __declspec(dllimport) | ||
| 26 | +#endif | ||
| 27 | + | ||
| 28 | +#if defined(__cplusplus) | ||
| 29 | +extern "C" { | ||
| 30 | +#endif | ||
| 31 | + | ||
| 32 | +FLUTTER_PLUGIN_EXPORT void PrintingPluginRegisterWithRegistrar( | ||
| 33 | + FlutterDesktopPluginRegistrarRef registrar); | ||
| 34 | + | ||
| 35 | +#if defined(__cplusplus) | ||
| 36 | +} // extern "C" | ||
| 37 | +#endif | ||
| 38 | + | ||
| 39 | +#endif // FLUTTER_PLUGIN_PRINTING_PLUGIN_H_ |
printing/windows/pdfium/LICENSE
0 → 100644
| 1 | +// Copyright 2014 PDFium Authors. All rights reserved. | ||
| 2 | +// | ||
| 3 | +// Redistribution and use in source and binary forms, with or without | ||
| 4 | +// modification, are permitted provided that the following conditions are | ||
| 5 | +// met: | ||
| 6 | +// | ||
| 7 | +// * Redistributions of source code must retain the above copyright | ||
| 8 | +// notice, this list of conditions and the following disclaimer. | ||
| 9 | +// * Redistributions in binary form must reproduce the above | ||
| 10 | +// copyright notice, this list of conditions and the following disclaimer | ||
| 11 | +// in the documentation and/or other materials provided with the | ||
| 12 | +// distribution. | ||
| 13 | +// * Neither the name of Google Inc. nor the names of its | ||
| 14 | +// contributors may be used to endorse or promote products derived from | ||
| 15 | +// this software without specific prior written permission. | ||
| 16 | +// | ||
| 17 | +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 18 | +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 19 | +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 20 | +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 21 | +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 22 | +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 23 | +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 24 | +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 25 | +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 26 | +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 27 | +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + Apache License | ||
| 31 | + Version 2.0, January 2004 | ||
| 32 | + https://www.apache.org/licenses/ | ||
| 33 | + | ||
| 34 | + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
| 35 | + | ||
| 36 | + 1. Definitions. | ||
| 37 | + | ||
| 38 | + "License" shall mean the terms and conditions for use, reproduction, | ||
| 39 | + and distribution as defined by Sections 1 through 9 of this document. | ||
| 40 | + | ||
| 41 | + "Licensor" shall mean the copyright owner or entity authorized by | ||
| 42 | + the copyright owner that is granting the License. | ||
| 43 | + | ||
| 44 | + "Legal Entity" shall mean the union of the acting entity and all | ||
| 45 | + other entities that control, are controlled by, or are under common | ||
| 46 | + control with that entity. For the purposes of this definition, | ||
| 47 | + "control" means (i) the power, direct or indirect, to cause the | ||
| 48 | + direction or management of such entity, whether by contract or | ||
| 49 | + otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
| 50 | + outstanding shares, or (iii) beneficial ownership of such entity. | ||
| 51 | + | ||
| 52 | + "You" (or "Your") shall mean an individual or Legal Entity | ||
| 53 | + exercising permissions granted by this License. | ||
| 54 | + | ||
| 55 | + "Source" form shall mean the preferred form for making modifications, | ||
| 56 | + including but not limited to software source code, documentation | ||
| 57 | + source, and configuration files. | ||
| 58 | + | ||
| 59 | + "Object" form shall mean any form resulting from mechanical | ||
| 60 | + transformation or translation of a Source form, including but | ||
| 61 | + not limited to compiled object code, generated documentation, | ||
| 62 | + and conversions to other media types. | ||
| 63 | + | ||
| 64 | + "Work" shall mean the work of authorship, whether in Source or | ||
| 65 | + Object form, made available under the License, as indicated by a | ||
| 66 | + copyright notice that is included in or attached to the work | ||
| 67 | + (an example is provided in the Appendix below). | ||
| 68 | + | ||
| 69 | + "Derivative Works" shall mean any work, whether in Source or Object | ||
| 70 | + form, that is based on (or derived from) the Work and for which the | ||
| 71 | + editorial revisions, annotations, elaborations, or other modifications | ||
| 72 | + represent, as a whole, an original work of authorship. For the purposes | ||
| 73 | + of this License, Derivative Works shall not include works that remain | ||
| 74 | + separable from, or merely link (or bind by name) to the interfaces of, | ||
| 75 | + the Work and Derivative Works thereof. | ||
| 76 | + | ||
| 77 | + "Contribution" shall mean any work of authorship, including | ||
| 78 | + the original version of the Work and any modifications or additions | ||
| 79 | + to that Work or Derivative Works thereof, that is intentionally | ||
| 80 | + submitted to Licensor for inclusion in the Work by the copyright owner | ||
| 81 | + or by an individual or Legal Entity authorized to submit on behalf of | ||
| 82 | + the copyright owner. For the purposes of this definition, "submitted" | ||
| 83 | + means any form of electronic, verbal, or written communication sent | ||
| 84 | + to the Licensor or its representatives, including but not limited to | ||
| 85 | + communication on electronic mailing lists, source code control systems, | ||
| 86 | + and issue tracking systems that are managed by, or on behalf of, the | ||
| 87 | + Licensor for the purpose of discussing and improving the Work, but | ||
| 88 | + excluding communication that is conspicuously marked or otherwise | ||
| 89 | + designated in writing by the copyright owner as "Not a Contribution." | ||
| 90 | + | ||
| 91 | + "Contributor" shall mean Licensor and any individual or Legal Entity | ||
| 92 | + on behalf of whom a Contribution has been received by Licensor and | ||
| 93 | + subsequently incorporated within the Work. | ||
| 94 | + | ||
| 95 | + 2. Grant of Copyright License. Subject to the terms and conditions of | ||
| 96 | + this License, each Contributor hereby grants to You a perpetual, | ||
| 97 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
| 98 | + copyright license to reproduce, prepare Derivative Works of, | ||
| 99 | + publicly display, publicly perform, sublicense, and distribute the | ||
| 100 | + Work and such Derivative Works in Source or Object form. | ||
| 101 | + | ||
| 102 | + 3. Grant of Patent License. Subject to the terms and conditions of | ||
| 103 | + this License, each Contributor hereby grants to You a perpetual, | ||
| 104 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
| 105 | + (except as stated in this section) patent license to make, have made, | ||
| 106 | + use, offer to sell, sell, import, and otherwise transfer the Work, | ||
| 107 | + where such license applies only to those patent claims licensable | ||
| 108 | + by such Contributor that are necessarily infringed by their | ||
| 109 | + Contribution(s) alone or by combination of their Contribution(s) | ||
| 110 | + with the Work to which such Contribution(s) was submitted. If You | ||
| 111 | + institute patent litigation against any entity (including a | ||
| 112 | + cross-claim or counterclaim in a lawsuit) alleging that the Work | ||
| 113 | + or a Contribution incorporated within the Work constitutes direct | ||
| 114 | + or contributory patent infringement, then any patent licenses | ||
| 115 | + granted to You under this License for that Work shall terminate | ||
| 116 | + as of the date such litigation is filed. | ||
| 117 | + | ||
| 118 | + 4. Redistribution. You may reproduce and distribute copies of the | ||
| 119 | + Work or Derivative Works thereof in any medium, with or without | ||
| 120 | + modifications, and in Source or Object form, provided that You | ||
| 121 | + meet the following conditions: | ||
| 122 | + | ||
| 123 | + (a) You must give any other recipients of the Work or | ||
| 124 | + Derivative Works a copy of this License; and | ||
| 125 | + | ||
| 126 | + (b) You must cause any modified files to carry prominent notices | ||
| 127 | + stating that You changed the files; and | ||
| 128 | + | ||
| 129 | + (c) You must retain, in the Source form of any Derivative Works | ||
| 130 | + that You distribute, all copyright, patent, trademark, and | ||
| 131 | + attribution notices from the Source form of the Work, | ||
| 132 | + excluding those notices that do not pertain to any part of | ||
| 133 | + the Derivative Works; and | ||
| 134 | + | ||
| 135 | + (d) If the Work includes a "NOTICE" text file as part of its | ||
| 136 | + distribution, then any Derivative Works that You distribute must | ||
| 137 | + include a readable copy of the attribution notices contained | ||
| 138 | + within such NOTICE file, excluding those notices that do not | ||
| 139 | + pertain to any part of the Derivative Works, in at least one | ||
| 140 | + of the following places: within a NOTICE text file distributed | ||
| 141 | + as part of the Derivative Works; within the Source form or | ||
| 142 | + documentation, if provided along with the Derivative Works; or, | ||
| 143 | + within a display generated by the Derivative Works, if and | ||
| 144 | + wherever such third-party notices normally appear. The contents | ||
| 145 | + of the NOTICE file are for informational purposes only and | ||
| 146 | + do not modify the License. You may add Your own attribution | ||
| 147 | + notices within Derivative Works that You distribute, alongside | ||
| 148 | + or as an addendum to the NOTICE text from the Work, provided | ||
| 149 | + that such additional attribution notices cannot be construed | ||
| 150 | + as modifying the License. | ||
| 151 | + | ||
| 152 | + You may add Your own copyright statement to Your modifications and | ||
| 153 | + may provide additional or different license terms and conditions | ||
| 154 | + for use, reproduction, or distribution of Your modifications, or | ||
| 155 | + for any such Derivative Works as a whole, provided Your use, | ||
| 156 | + reproduction, and distribution of the Work otherwise complies with | ||
| 157 | + the conditions stated in this License. | ||
| 158 | + | ||
| 159 | + 5. Submission of Contributions. Unless You explicitly state otherwise, | ||
| 160 | + any Contribution intentionally submitted for inclusion in the Work | ||
| 161 | + by You to the Licensor shall be under the terms and conditions of | ||
| 162 | + this License, without any additional terms or conditions. | ||
| 163 | + Notwithstanding the above, nothing herein shall supersede or modify | ||
| 164 | + the terms of any separate license agreement you may have executed | ||
| 165 | + with Licensor regarding such Contributions. | ||
| 166 | + | ||
| 167 | + 6. Trademarks. This License does not grant permission to use the trade | ||
| 168 | + names, trademarks, service marks, or product names of the Licensor, | ||
| 169 | + except as required for reasonable and customary use in describing the | ||
| 170 | + origin of the Work and reproducing the content of the NOTICE file. | ||
| 171 | + | ||
| 172 | + 7. Disclaimer of Warranty. Unless required by applicable law or | ||
| 173 | + agreed to in writing, Licensor provides the Work (and each | ||
| 174 | + Contributor provides its Contributions) on an "AS IS" BASIS, | ||
| 175 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
| 176 | + implied, including, without limitation, any warranties or conditions | ||
| 177 | + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||
| 178 | + PARTICULAR PURPOSE. You are solely responsible for determining the | ||
| 179 | + appropriateness of using or redistributing the Work and assume any | ||
| 180 | + risks associated with Your exercise of permissions under this License. | ||
| 181 | + | ||
| 182 | + 8. Limitation of Liability. In no event and under no legal theory, | ||
| 183 | + whether in tort (including negligence), contract, or otherwise, | ||
| 184 | + unless required by applicable law (such as deliberate and grossly | ||
| 185 | + negligent acts) or agreed to in writing, shall any Contributor be | ||
| 186 | + liable to You for damages, including any direct, indirect, special, | ||
| 187 | + incidental, or consequential damages of any character arising as a | ||
| 188 | + result of this License or out of the use or inability to use the | ||
| 189 | + Work (including but not limited to damages for loss of goodwill, | ||
| 190 | + work stoppage, computer failure or malfunction, or any and all | ||
| 191 | + other commercial damages or losses), even if such Contributor | ||
| 192 | + has been advised of the possibility of such damages. | ||
| 193 | + | ||
| 194 | + 9. Accepting Warranty or Additional Liability. While redistributing | ||
| 195 | + the Work or Derivative Works thereof, You may choose to offer, | ||
| 196 | + and charge a fee for, acceptance of support, warranty, indemnity, | ||
| 197 | + or other liability obligations and/or rights consistent with this | ||
| 198 | + License. However, in accepting such obligations, You may act only | ||
| 199 | + on Your own behalf and on Your sole responsibility, not on behalf | ||
| 200 | + of any other Contributor, and only if You agree to indemnify, | ||
| 201 | + defend, and hold each Contributor harmless for any liability | ||
| 202 | + incurred by, or claims asserted against, such Contributor by reason | ||
| 203 | + of your accepting any such warranty or additional liability. | ||
| 204 | + | ||
| 205 | + END OF TERMS AND CONDITIONS | ||
| 206 | + | ||
| 207 | + APPENDIX: How to apply the Apache License to your work. | ||
| 208 | + | ||
| 209 | + To apply the Apache License to your work, attach the following | ||
| 210 | + boilerplate notice, with the fields enclosed by brackets "[]" | ||
| 211 | + replaced with your own identifying information. (Don't include | ||
| 212 | + the brackets!) The text should be enclosed in the appropriate | ||
| 213 | + comment syntax for the file format. We also recommend that a | ||
| 214 | + file or class name and description of purpose be included on the | ||
| 215 | + same "printed page" as the copyright notice for easier | ||
| 216 | + identification within third-party archives. | ||
| 217 | + | ||
| 218 | + Copyright [yyyy] [name of copyright owner] | ||
| 219 | + | ||
| 220 | + Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 221 | + you may not use this file except in compliance with the License. | ||
| 222 | + You may obtain a copy of the License at | ||
| 223 | + | ||
| 224 | + https://www.apache.org/licenses/LICENSE-2.0 | ||
| 225 | + | ||
| 226 | + Unless required by applicable law or agreed to in writing, software | ||
| 227 | + distributed under the License is distributed on an "AS IS" BASIS, | ||
| 228 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 229 | + See the License for the specific language governing permissions and | ||
| 230 | + limitations under the License. |
printing/windows/pdfium/PDFiumConfig.cmake
0 → 100644
| 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() |
| 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_ |
| 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 <memory> | ||
| 9 | +#include <type_traits> | ||
| 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<std::remove_pointer<FPDF_ANNOTATION>::type, | ||
| 17 | + FPDFAnnotationDeleter>; | ||
| 18 | + | ||
| 19 | +using ScopedFPDFAvail = | ||
| 20 | + std::unique_ptr<std::remove_pointer<FPDF_AVAIL>::type, FPDFAvailDeleter>; | ||
| 21 | + | ||
| 22 | +using ScopedFPDFBitmap = | ||
| 23 | + std::unique_ptr<std::remove_pointer<FPDF_BITMAP>::type, FPDFBitmapDeleter>; | ||
| 24 | + | ||
| 25 | +using ScopedFPDFClipPath = | ||
| 26 | + std::unique_ptr<std::remove_pointer<FPDF_CLIPPATH>::type, | ||
| 27 | + FPDFClipPathDeleter>; | ||
| 28 | + | ||
| 29 | +using ScopedFPDFDocument = | ||
| 30 | + std::unique_ptr<std::remove_pointer<FPDF_DOCUMENT>::type, | ||
| 31 | + FPDFDocumentDeleter>; | ||
| 32 | + | ||
| 33 | +using ScopedFPDFFont = | ||
| 34 | + std::unique_ptr<std::remove_pointer<FPDF_FONT>::type, FPDFFontDeleter>; | ||
| 35 | + | ||
| 36 | +using ScopedFPDFFormHandle = | ||
| 37 | + std::unique_ptr<std::remove_pointer<FPDF_FORMHANDLE>::type, | ||
| 38 | + FPDFFormHandleDeleter>; | ||
| 39 | + | ||
| 40 | +using ScopedFPDFJavaScriptAction = | ||
| 41 | + std::unique_ptr<std::remove_pointer<FPDF_JAVASCRIPT_ACTION>::type, | ||
| 42 | + FPDFJavaScriptActionDeleter>; | ||
| 43 | + | ||
| 44 | +using ScopedFPDFPage = | ||
| 45 | + std::unique_ptr<std::remove_pointer<FPDF_PAGE>::type, FPDFPageDeleter>; | ||
| 46 | + | ||
| 47 | +using ScopedFPDFPageLink = | ||
| 48 | + std::unique_ptr<std::remove_pointer<FPDF_PAGELINK>::type, | ||
| 49 | + FPDFPageLinkDeleter>; | ||
| 50 | + | ||
| 51 | +using ScopedFPDFPageObject = | ||
| 52 | + std::unique_ptr<std::remove_pointer<FPDF_PAGEOBJECT>::type, | ||
| 53 | + FPDFPageObjectDeleter>; | ||
| 54 | + | ||
| 55 | +using ScopedFPDFStructTree = | ||
| 56 | + std::unique_ptr<std::remove_pointer<FPDF_STRUCTTREE>::type, | ||
| 57 | + FPDFStructTreeDeleter>; | ||
| 58 | + | ||
| 59 | +using ScopedFPDFTextFind = | ||
| 60 | + std::unique_ptr<std::remove_pointer<FPDF_SCHHANDLE>::type, | ||
| 61 | + FPDFTextFindDeleter>; | ||
| 62 | + | ||
| 63 | +using ScopedFPDFTextPage = | ||
| 64 | + std::unique_ptr<std::remove_pointer<FPDF_TEXTPAGE>::type, | ||
| 65 | + FPDFTextPageDeleter>; | ||
| 66 | + | ||
| 67 | +#endif // PUBLIC_CPP_FPDF_SCOPERS_H_ |
printing/windows/pdfium/include/fpdf_annot.h
0 → 100644
| 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_ANNOT_H_ | ||
| 6 | +#define PUBLIC_FPDF_ANNOT_H_ | ||
| 7 | + | ||
| 8 | +#include <stddef.h> | ||
| 9 | + | ||
| 10 | +// NOLINTNEXTLINE(build/include) | ||
| 11 | +#include "fpdfview.h" | ||
| 12 | + | ||
| 13 | +// NOLINTNEXTLINE(build/include) | ||
| 14 | +#include "fpdf_doc.h" | ||
| 15 | +// NOLINTNEXTLINE(build/include) | ||
| 16 | +#include "fpdf_formfill.h" | ||
| 17 | + | ||
| 18 | +#ifdef __cplusplus | ||
| 19 | +extern "C" { | ||
| 20 | +#endif // __cplusplus | ||
| 21 | + | ||
| 22 | +#define FPDF_ANNOT_UNKNOWN 0 | ||
| 23 | +#define FPDF_ANNOT_TEXT 1 | ||
| 24 | +#define FPDF_ANNOT_LINK 2 | ||
| 25 | +#define FPDF_ANNOT_FREETEXT 3 | ||
| 26 | +#define FPDF_ANNOT_LINE 4 | ||
| 27 | +#define FPDF_ANNOT_SQUARE 5 | ||
| 28 | +#define FPDF_ANNOT_CIRCLE 6 | ||
| 29 | +#define FPDF_ANNOT_POLYGON 7 | ||
| 30 | +#define FPDF_ANNOT_POLYLINE 8 | ||
| 31 | +#define FPDF_ANNOT_HIGHLIGHT 9 | ||
| 32 | +#define FPDF_ANNOT_UNDERLINE 10 | ||
| 33 | +#define FPDF_ANNOT_SQUIGGLY 11 | ||
| 34 | +#define FPDF_ANNOT_STRIKEOUT 12 | ||
| 35 | +#define FPDF_ANNOT_STAMP 13 | ||
| 36 | +#define FPDF_ANNOT_CARET 14 | ||
| 37 | +#define FPDF_ANNOT_INK 15 | ||
| 38 | +#define FPDF_ANNOT_POPUP 16 | ||
| 39 | +#define FPDF_ANNOT_FILEATTACHMENT 17 | ||
| 40 | +#define FPDF_ANNOT_SOUND 18 | ||
| 41 | +#define FPDF_ANNOT_MOVIE 19 | ||
| 42 | +#define FPDF_ANNOT_WIDGET 20 | ||
| 43 | +#define FPDF_ANNOT_SCREEN 21 | ||
| 44 | +#define FPDF_ANNOT_PRINTERMARK 22 | ||
| 45 | +#define FPDF_ANNOT_TRAPNET 23 | ||
| 46 | +#define FPDF_ANNOT_WATERMARK 24 | ||
| 47 | +#define FPDF_ANNOT_THREED 25 | ||
| 48 | +#define FPDF_ANNOT_RICHMEDIA 26 | ||
| 49 | +#define FPDF_ANNOT_XFAWIDGET 27 | ||
| 50 | + | ||
| 51 | +// Refer to PDF Reference (6th edition) table 8.16 for all annotation flags. | ||
| 52 | +#define FPDF_ANNOT_FLAG_NONE 0 | ||
| 53 | +#define FPDF_ANNOT_FLAG_INVISIBLE (1 << 0) | ||
| 54 | +#define FPDF_ANNOT_FLAG_HIDDEN (1 << 1) | ||
| 55 | +#define FPDF_ANNOT_FLAG_PRINT (1 << 2) | ||
| 56 | +#define FPDF_ANNOT_FLAG_NOZOOM (1 << 3) | ||
| 57 | +#define FPDF_ANNOT_FLAG_NOROTATE (1 << 4) | ||
| 58 | +#define FPDF_ANNOT_FLAG_NOVIEW (1 << 5) | ||
| 59 | +#define FPDF_ANNOT_FLAG_READONLY (1 << 6) | ||
| 60 | +#define FPDF_ANNOT_FLAG_LOCKED (1 << 7) | ||
| 61 | +#define FPDF_ANNOT_FLAG_TOGGLENOVIEW (1 << 8) | ||
| 62 | + | ||
| 63 | +#define FPDF_ANNOT_APPEARANCEMODE_NORMAL 0 | ||
| 64 | +#define FPDF_ANNOT_APPEARANCEMODE_ROLLOVER 1 | ||
| 65 | +#define FPDF_ANNOT_APPEARANCEMODE_DOWN 2 | ||
| 66 | +#define FPDF_ANNOT_APPEARANCEMODE_COUNT 3 | ||
| 67 | + | ||
| 68 | +// Refer to PDF Reference version 1.7 table 8.70 for field flags common to all | ||
| 69 | +// interactive form field types. | ||
| 70 | +#define FPDF_FORMFLAG_NONE 0 | ||
| 71 | +#define FPDF_FORMFLAG_READONLY (1 << 0) | ||
| 72 | +#define FPDF_FORMFLAG_REQUIRED (1 << 1) | ||
| 73 | +#define FPDF_FORMFLAG_NOEXPORT (1 << 2) | ||
| 74 | + | ||
| 75 | +// Refer to PDF Reference version 1.7 table 8.77 for field flags specific to | ||
| 76 | +// interactive form text fields. | ||
| 77 | +#define FPDF_FORMFLAG_TEXT_MULTILINE (1 << 12) | ||
| 78 | +#define FPDF_FORMFLAG_TEXT_PASSWORD (1 << 13) | ||
| 79 | + | ||
| 80 | +// Refer to PDF Reference version 1.7 table 8.79 for field flags specific to | ||
| 81 | +// interactive form choice fields. | ||
| 82 | +#define FPDF_FORMFLAG_CHOICE_COMBO (1 << 17) | ||
| 83 | +#define FPDF_FORMFLAG_CHOICE_EDIT (1 << 18) | ||
| 84 | +#define FPDF_FORMFLAG_CHOICE_MULTI_SELECT (1 << 21) | ||
| 85 | + | ||
| 86 | +typedef enum FPDFANNOT_COLORTYPE { | ||
| 87 | + FPDFANNOT_COLORTYPE_Color = 0, | ||
| 88 | + FPDFANNOT_COLORTYPE_InteriorColor | ||
| 89 | +} FPDFANNOT_COLORTYPE; | ||
| 90 | + | ||
| 91 | +// Experimental API. | ||
| 92 | +// Check if an annotation subtype is currently supported for creation. | ||
| 93 | +// Currently supported subtypes: circle, highlight, ink, popup, square, | ||
| 94 | +// squiggly, stamp, strikeout, text, and underline. | ||
| 95 | +// | ||
| 96 | +// subtype - the subtype to be checked. | ||
| 97 | +// | ||
| 98 | +// Returns true if this subtype supported. | ||
| 99 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 100 | +FPDFAnnot_IsSupportedSubtype(FPDF_ANNOTATION_SUBTYPE subtype); | ||
| 101 | + | ||
| 102 | +// Experimental API. | ||
| 103 | +// Create an annotation in |page| of the subtype |subtype|. If the specified | ||
| 104 | +// subtype is illegal or unsupported, then a new annotation will not be created. | ||
| 105 | +// Must call FPDFPage_CloseAnnot() when the annotation returned by this | ||
| 106 | +// function is no longer needed. | ||
| 107 | +// | ||
| 108 | +// page - handle to a page. | ||
| 109 | +// subtype - the subtype of the new annotation. | ||
| 110 | +// | ||
| 111 | +// Returns a handle to the new annotation object, or NULL on failure. | ||
| 112 | +FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV | ||
| 113 | +FPDFPage_CreateAnnot(FPDF_PAGE page, FPDF_ANNOTATION_SUBTYPE subtype); | ||
| 114 | + | ||
| 115 | +// Experimental API. | ||
| 116 | +// Get the number of annotations in |page|. | ||
| 117 | +// | ||
| 118 | +// page - handle to a page. | ||
| 119 | +// | ||
| 120 | +// Returns the number of annotations in |page|. | ||
| 121 | +FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotCount(FPDF_PAGE page); | ||
| 122 | + | ||
| 123 | +// Experimental API. | ||
| 124 | +// Get annotation in |page| at |index|. Must call FPDFPage_CloseAnnot() when the | ||
| 125 | +// annotation returned by this function is no longer needed. | ||
| 126 | +// | ||
| 127 | +// page - handle to a page. | ||
| 128 | +// index - the index of the annotation. | ||
| 129 | +// | ||
| 130 | +// Returns a handle to the annotation object, or NULL on failure. | ||
| 131 | +FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV FPDFPage_GetAnnot(FPDF_PAGE page, | ||
| 132 | + int index); | ||
| 133 | + | ||
| 134 | +// Experimental API. | ||
| 135 | +// Get the index of |annot| in |page|. This is the opposite of | ||
| 136 | +// FPDFPage_GetAnnot(). | ||
| 137 | +// | ||
| 138 | +// page - handle to the page that the annotation is on. | ||
| 139 | +// annot - handle to an annotation. | ||
| 140 | +// | ||
| 141 | +// Returns the index of |annot|, or -1 on failure. | ||
| 142 | +FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotIndex(FPDF_PAGE page, | ||
| 143 | + FPDF_ANNOTATION annot); | ||
| 144 | + | ||
| 145 | +// Experimental API. | ||
| 146 | +// Close an annotation. Must be called when the annotation returned by | ||
| 147 | +// FPDFPage_CreateAnnot() or FPDFPage_GetAnnot() is no longer needed. This | ||
| 148 | +// function does not remove the annotation from the document. | ||
| 149 | +// | ||
| 150 | +// annot - handle to an annotation. | ||
| 151 | +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_CloseAnnot(FPDF_ANNOTATION annot); | ||
| 152 | + | ||
| 153 | +// Experimental API. | ||
| 154 | +// Remove the annotation in |page| at |index|. | ||
| 155 | +// | ||
| 156 | +// page - handle to a page. | ||
| 157 | +// index - the index of the annotation. | ||
| 158 | +// | ||
| 159 | +// Returns true if successful. | ||
| 160 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_RemoveAnnot(FPDF_PAGE page, | ||
| 161 | + int index); | ||
| 162 | + | ||
| 163 | +// Experimental API. | ||
| 164 | +// Get the subtype of an annotation. | ||
| 165 | +// | ||
| 166 | +// annot - handle to an annotation. | ||
| 167 | +// | ||
| 168 | +// Returns the annotation subtype. | ||
| 169 | +FPDF_EXPORT FPDF_ANNOTATION_SUBTYPE FPDF_CALLCONV | ||
| 170 | +FPDFAnnot_GetSubtype(FPDF_ANNOTATION annot); | ||
| 171 | + | ||
| 172 | +// Experimental API. | ||
| 173 | +// Check if an annotation subtype is currently supported for object extraction, | ||
| 174 | +// update, and removal. | ||
| 175 | +// Currently supported subtypes: ink and stamp. | ||
| 176 | +// | ||
| 177 | +// subtype - the subtype to be checked. | ||
| 178 | +// | ||
| 179 | +// Returns true if this subtype supported. | ||
| 180 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 181 | +FPDFAnnot_IsObjectSupportedSubtype(FPDF_ANNOTATION_SUBTYPE subtype); | ||
| 182 | + | ||
| 183 | +// Experimental API. | ||
| 184 | +// Update |obj| in |annot|. |obj| must be in |annot| already and must have | ||
| 185 | +// been retrieved by FPDFAnnot_GetObject(). Currently, only ink and stamp | ||
| 186 | +// annotations are supported by this API. Also note that only path, image, and | ||
| 187 | +// text objects have APIs for modification; see FPDFPath_*(), FPDFText_*(), and | ||
| 188 | +// FPDFImageObj_*(). | ||
| 189 | +// | ||
| 190 | +// annot - handle to an annotation. | ||
| 191 | +// obj - handle to the object that |annot| needs to update. | ||
| 192 | +// | ||
| 193 | +// Return true if successful. | ||
| 194 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 195 | +FPDFAnnot_UpdateObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj); | ||
| 196 | + | ||
| 197 | +// Experimental API. | ||
| 198 | +// Add a new InkStroke, represented by an array of points, to the InkList of | ||
| 199 | +// |annot|. The API creates an InkList if one doesn't already exist in |annot|. | ||
| 200 | +// This API works only for ink annotations. Please refer section 12.5.6.13 in | ||
| 201 | +// PDF 32000-1:2008 Specification. | ||
| 202 | +// | ||
| 203 | +// annot - handle to an annotation. | ||
| 204 | +// points - pointer to a FS_POINTF array representing input points. | ||
| 205 | +// point_count - number of elements in |points| array. This should not exceed | ||
| 206 | +// the maximum value that can be represented by an int32_t). | ||
| 207 | +// | ||
| 208 | +// Returns the 0-based index at which the new InkStroke is added in the InkList | ||
| 209 | +// of the |annot|. Returns -1 on failure. | ||
| 210 | +FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_AddInkStroke(FPDF_ANNOTATION annot, | ||
| 211 | + const FS_POINTF* points, | ||
| 212 | + size_t point_count); | ||
| 213 | + | ||
| 214 | +// Experimental API. | ||
| 215 | +// Removes an InkList in |annot|. | ||
| 216 | +// This API works only for ink annotations. | ||
| 217 | +// | ||
| 218 | +// annot - handle to an annotation. | ||
| 219 | +// | ||
| 220 | +// Return true on successful removal of /InkList entry from context of the | ||
| 221 | +// non-null ink |annot|. Returns false on failure. | ||
| 222 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 223 | +FPDFAnnot_RemoveInkList(FPDF_ANNOTATION annot); | ||
| 224 | + | ||
| 225 | +// Experimental API. | ||
| 226 | +// Add |obj| to |annot|. |obj| must have been created by | ||
| 227 | +// FPDFPageObj_CreateNew{Path|Rect}() or FPDFPageObj_New{Text|Image}Obj(), and | ||
| 228 | +// will be owned by |annot|. Note that an |obj| cannot belong to more than one | ||
| 229 | +// |annot|. Currently, only ink and stamp annotations are supported by this API. | ||
| 230 | +// Also note that only path, image, and text objects have APIs for creation. | ||
| 231 | +// | ||
| 232 | +// annot - handle to an annotation. | ||
| 233 | +// obj - handle to the object that is to be added to |annot|. | ||
| 234 | +// | ||
| 235 | +// Return true if successful. | ||
| 236 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 237 | +FPDFAnnot_AppendObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj); | ||
| 238 | + | ||
| 239 | +// Experimental API. | ||
| 240 | +// Get the total number of objects in |annot|, including path objects, text | ||
| 241 | +// objects, external objects, image objects, and shading objects. | ||
| 242 | +// | ||
| 243 | +// annot - handle to an annotation. | ||
| 244 | +// | ||
| 245 | +// Returns the number of objects in |annot|. | ||
| 246 | +FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetObjectCount(FPDF_ANNOTATION annot); | ||
| 247 | + | ||
| 248 | +// Experimental API. | ||
| 249 | +// Get the object in |annot| at |index|. | ||
| 250 | +// | ||
| 251 | +// annot - handle to an annotation. | ||
| 252 | +// index - the index of the object. | ||
| 253 | +// | ||
| 254 | +// Return a handle to the object, or NULL on failure. | ||
| 255 | +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV | ||
| 256 | +FPDFAnnot_GetObject(FPDF_ANNOTATION annot, int index); | ||
| 257 | + | ||
| 258 | +// Experimental API. | ||
| 259 | +// Remove the object in |annot| at |index|. | ||
| 260 | +// | ||
| 261 | +// annot - handle to an annotation. | ||
| 262 | +// index - the index of the object to be removed. | ||
| 263 | +// | ||
| 264 | +// Return true if successful. | ||
| 265 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 266 | +FPDFAnnot_RemoveObject(FPDF_ANNOTATION annot, int index); | ||
| 267 | + | ||
| 268 | +// Experimental API. | ||
| 269 | +// Set the color of an annotation. Fails when called on annotations with | ||
| 270 | +// appearance streams already defined; instead use | ||
| 271 | +// FPDFPath_Set{Stroke|Fill}Color(). | ||
| 272 | +// | ||
| 273 | +// annot - handle to an annotation. | ||
| 274 | +// type - type of the color to be set. | ||
| 275 | +// R, G, B - buffer to hold the RGB value of the color. Ranges from 0 to 255. | ||
| 276 | +// A - buffer to hold the opacity. Ranges from 0 to 255. | ||
| 277 | +// | ||
| 278 | +// Returns true if successful. | ||
| 279 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetColor(FPDF_ANNOTATION annot, | ||
| 280 | + FPDFANNOT_COLORTYPE type, | ||
| 281 | + unsigned int R, | ||
| 282 | + unsigned int G, | ||
| 283 | + unsigned int B, | ||
| 284 | + unsigned int A); | ||
| 285 | + | ||
| 286 | +// Experimental API. | ||
| 287 | +// Get the color of an annotation. If no color is specified, default to yellow | ||
| 288 | +// for highlight annotation, black for all else. Fails when called on | ||
| 289 | +// annotations with appearance streams already defined; instead use | ||
| 290 | +// FPDFPath_Get{Stroke|Fill}Color(). | ||
| 291 | +// | ||
| 292 | +// annot - handle to an annotation. | ||
| 293 | +// type - type of the color requested. | ||
| 294 | +// R, G, B - buffer to hold the RGB value of the color. Ranges from 0 to 255. | ||
| 295 | +// A - buffer to hold the opacity. Ranges from 0 to 255. | ||
| 296 | +// | ||
| 297 | +// Returns true if successful. | ||
| 298 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetColor(FPDF_ANNOTATION annot, | ||
| 299 | + FPDFANNOT_COLORTYPE type, | ||
| 300 | + unsigned int* R, | ||
| 301 | + unsigned int* G, | ||
| 302 | + unsigned int* B, | ||
| 303 | + unsigned int* A); | ||
| 304 | + | ||
| 305 | +// Experimental API. | ||
| 306 | +// Check if the annotation is of a type that has attachment points | ||
| 307 | +// (i.e. quadpoints). Quadpoints are the vertices of the rectangle that | ||
| 308 | +// encompasses the texts affected by the annotation. They provide the | ||
| 309 | +// coordinates in the page where the annotation is attached. Only text markup | ||
| 310 | +// annotations (i.e. highlight, strikeout, squiggly, and underline) and link | ||
| 311 | +// annotations have quadpoints. | ||
| 312 | +// | ||
| 313 | +// annot - handle to an annotation. | ||
| 314 | +// | ||
| 315 | +// Returns true if the annotation is of a type that has quadpoints, false | ||
| 316 | +// otherwise. | ||
| 317 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 318 | +FPDFAnnot_HasAttachmentPoints(FPDF_ANNOTATION annot); | ||
| 319 | + | ||
| 320 | +// Experimental API. | ||
| 321 | +// Replace the attachment points (i.e. quadpoints) set of an annotation at | ||
| 322 | +// |quad_index|. This index needs to be within the result of | ||
| 323 | +// FPDFAnnot_CountAttachmentPoints(). | ||
| 324 | +// If the annotation's appearance stream is defined and this annotation is of a | ||
| 325 | +// type with quadpoints, then update the bounding box too if the new quadpoints | ||
| 326 | +// define a bigger one. | ||
| 327 | +// | ||
| 328 | +// annot - handle to an annotation. | ||
| 329 | +// quad_index - index of the set of quadpoints. | ||
| 330 | +// quad_points - the quadpoints to be set. | ||
| 331 | +// | ||
| 332 | +// Returns true if successful. | ||
| 333 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 334 | +FPDFAnnot_SetAttachmentPoints(FPDF_ANNOTATION annot, | ||
| 335 | + size_t quad_index, | ||
| 336 | + const FS_QUADPOINTSF* quad_points); | ||
| 337 | + | ||
| 338 | +// Experimental API. | ||
| 339 | +// Append to the list of attachment points (i.e. quadpoints) of an annotation. | ||
| 340 | +// If the annotation's appearance stream is defined and this annotation is of a | ||
| 341 | +// type with quadpoints, then update the bounding box too if the new quadpoints | ||
| 342 | +// define a bigger one. | ||
| 343 | +// | ||
| 344 | +// annot - handle to an annotation. | ||
| 345 | +// quad_points - the quadpoints to be set. | ||
| 346 | +// | ||
| 347 | +// Returns true if successful. | ||
| 348 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 349 | +FPDFAnnot_AppendAttachmentPoints(FPDF_ANNOTATION annot, | ||
| 350 | + const FS_QUADPOINTSF* quad_points); | ||
| 351 | + | ||
| 352 | +// Experimental API. | ||
| 353 | +// Get the number of sets of quadpoints of an annotation. | ||
| 354 | +// | ||
| 355 | +// annot - handle to an annotation. | ||
| 356 | +// | ||
| 357 | +// Returns the number of sets of quadpoints, or 0 on failure. | ||
| 358 | +FPDF_EXPORT size_t FPDF_CALLCONV | ||
| 359 | +FPDFAnnot_CountAttachmentPoints(FPDF_ANNOTATION annot); | ||
| 360 | + | ||
| 361 | +// Experimental API. | ||
| 362 | +// Get the attachment points (i.e. quadpoints) of an annotation. | ||
| 363 | +// | ||
| 364 | +// annot - handle to an annotation. | ||
| 365 | +// quad_index - index of the set of quadpoints. | ||
| 366 | +// quad_points - receives the quadpoints; must not be NULL. | ||
| 367 | +// | ||
| 368 | +// Returns true if successful. | ||
| 369 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 370 | +FPDFAnnot_GetAttachmentPoints(FPDF_ANNOTATION annot, | ||
| 371 | + size_t quad_index, | ||
| 372 | + FS_QUADPOINTSF* quad_points); | ||
| 373 | + | ||
| 374 | +// Experimental API. | ||
| 375 | +// Set the annotation rectangle defining the location of the annotation. If the | ||
| 376 | +// annotation's appearance stream is defined and this annotation is of a type | ||
| 377 | +// without quadpoints, then update the bounding box too if the new rectangle | ||
| 378 | +// defines a bigger one. | ||
| 379 | +// | ||
| 380 | +// annot - handle to an annotation. | ||
| 381 | +// rect - the annotation rectangle to be set. | ||
| 382 | +// | ||
| 383 | +// Returns true if successful. | ||
| 384 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetRect(FPDF_ANNOTATION annot, | ||
| 385 | + const FS_RECTF* rect); | ||
| 386 | + | ||
| 387 | +// Experimental API. | ||
| 388 | +// Get the annotation rectangle defining the location of the annotation. | ||
| 389 | +// | ||
| 390 | +// annot - handle to an annotation. | ||
| 391 | +// rect - receives the rectangle; must not be NULL. | ||
| 392 | +// | ||
| 393 | +// Returns true if successful. | ||
| 394 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetRect(FPDF_ANNOTATION annot, | ||
| 395 | + FS_RECTF* rect); | ||
| 396 | + | ||
| 397 | +// Experimental API. | ||
| 398 | +// Check if |annot|'s dictionary has |key| as a key. | ||
| 399 | +// | ||
| 400 | +// annot - handle to an annotation. | ||
| 401 | +// key - the key to look for, encoded in UTF-8. | ||
| 402 | +// | ||
| 403 | +// Returns true if |key| exists. | ||
| 404 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_HasKey(FPDF_ANNOTATION annot, | ||
| 405 | + FPDF_BYTESTRING key); | ||
| 406 | + | ||
| 407 | +// Experimental API. | ||
| 408 | +// Get the type of the value corresponding to |key| in |annot|'s dictionary. | ||
| 409 | +// | ||
| 410 | +// annot - handle to an annotation. | ||
| 411 | +// key - the key to look for, encoded in UTF-8. | ||
| 412 | +// | ||
| 413 | +// Returns the type of the dictionary value. | ||
| 414 | +FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV | ||
| 415 | +FPDFAnnot_GetValueType(FPDF_ANNOTATION annot, FPDF_BYTESTRING key); | ||
| 416 | + | ||
| 417 | +// Experimental API. | ||
| 418 | +// Set the string value corresponding to |key| in |annot|'s dictionary, | ||
| 419 | +// overwriting the existing value if any. The value type would be | ||
| 420 | +// FPDF_OBJECT_STRING after this function call succeeds. | ||
| 421 | +// | ||
| 422 | +// annot - handle to an annotation. | ||
| 423 | +// key - the key to the dictionary entry to be set, encoded in UTF-8. | ||
| 424 | +// value - the string value to be set, encoded in UTF-16LE. | ||
| 425 | +// | ||
| 426 | +// Returns true if successful. | ||
| 427 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 428 | +FPDFAnnot_SetStringValue(FPDF_ANNOTATION annot, | ||
| 429 | + FPDF_BYTESTRING key, | ||
| 430 | + FPDF_WIDESTRING value); | ||
| 431 | + | ||
| 432 | +// Experimental API. | ||
| 433 | +// Get the string value corresponding to |key| in |annot|'s dictionary. |buffer| | ||
| 434 | +// is only modified if |buflen| is longer than the length of contents. Note that | ||
| 435 | +// if |key| does not exist in the dictionary or if |key|'s corresponding value | ||
| 436 | +// in the dictionary is not a string (i.e. the value is not of type | ||
| 437 | +// FPDF_OBJECT_STRING or FPDF_OBJECT_NAME), then an empty string would be copied | ||
| 438 | +// to |buffer| and the return value would be 2. On other errors, nothing would | ||
| 439 | +// be added to |buffer| and the return value would be 0. | ||
| 440 | +// | ||
| 441 | +// annot - handle to an annotation. | ||
| 442 | +// key - the key to the requested dictionary entry, encoded in UTF-8. | ||
| 443 | +// buffer - buffer for holding the value string, encoded in UTF-16LE. | ||
| 444 | +// buflen - length of the buffer in bytes. | ||
| 445 | +// | ||
| 446 | +// Returns the length of the string value in bytes. | ||
| 447 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 448 | +FPDFAnnot_GetStringValue(FPDF_ANNOTATION annot, | ||
| 449 | + FPDF_BYTESTRING key, | ||
| 450 | + FPDF_WCHAR* buffer, | ||
| 451 | + unsigned long buflen); | ||
| 452 | + | ||
| 453 | +// Experimental API. | ||
| 454 | +// Get the float value corresponding to |key| in |annot|'s dictionary. Writes | ||
| 455 | +// value to |value| and returns True if |key| exists in the dictionary and | ||
| 456 | +// |key|'s corresponding value is a number (FPDF_OBJECT_NUMBER), False | ||
| 457 | +// otherwise. | ||
| 458 | +// | ||
| 459 | +// annot - handle to an annotation. | ||
| 460 | +// key - the key to the requested dictionary entry, encoded in UTF-8. | ||
| 461 | +// value - receives the value, must not be NULL. | ||
| 462 | +// | ||
| 463 | +// Returns True if value found, False otherwise. | ||
| 464 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 465 | +FPDFAnnot_GetNumberValue(FPDF_ANNOTATION annot, | ||
| 466 | + FPDF_BYTESTRING key, | ||
| 467 | + float* value); | ||
| 468 | + | ||
| 469 | +// Experimental API. | ||
| 470 | +// Set the AP (appearance string) in |annot|'s dictionary for a given | ||
| 471 | +// |appearanceMode|. | ||
| 472 | +// | ||
| 473 | +// annot - handle to an annotation. | ||
| 474 | +// appearanceMode - the appearance mode (normal, rollover or down) for which | ||
| 475 | +// to get the AP. | ||
| 476 | +// value - the string value to be set, encoded in UTF-16LE. If | ||
| 477 | +// nullptr is passed, the AP is cleared for that mode. If the | ||
| 478 | +// mode is Normal, APs for all modes are cleared. | ||
| 479 | +// | ||
| 480 | +// Returns true if successful. | ||
| 481 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 482 | +FPDFAnnot_SetAP(FPDF_ANNOTATION annot, | ||
| 483 | + FPDF_ANNOT_APPEARANCEMODE appearanceMode, | ||
| 484 | + FPDF_WIDESTRING value); | ||
| 485 | + | ||
| 486 | +// Experimental API. | ||
| 487 | +// Get the AP (appearance string) from |annot|'s dictionary for a given | ||
| 488 | +// |appearanceMode|. | ||
| 489 | +// |buffer| is only modified if |buflen| is large enough to hold the whole AP | ||
| 490 | +// string. If |buflen| is smaller, the total size of the AP is still returned, | ||
| 491 | +// but nothing is copied. | ||
| 492 | +// If there is no appearance stream for |annot| in |appearanceMode|, an empty | ||
| 493 | +// string is written to |buf| and 2 is returned. | ||
| 494 | +// On other errors, nothing is written to |buffer| and 0 is returned. | ||
| 495 | +// | ||
| 496 | +// annot - handle to an annotation. | ||
| 497 | +// appearanceMode - the appearance mode (normal, rollover or down) for which | ||
| 498 | +// to get the AP. | ||
| 499 | +// buffer - buffer for holding the value string, encoded in UTF-16LE. | ||
| 500 | +// buflen - length of the buffer in bytes. | ||
| 501 | +// | ||
| 502 | +// Returns the length of the string value in bytes. | ||
| 503 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 504 | +FPDFAnnot_GetAP(FPDF_ANNOTATION annot, | ||
| 505 | + FPDF_ANNOT_APPEARANCEMODE appearanceMode, | ||
| 506 | + FPDF_WCHAR* buffer, | ||
| 507 | + unsigned long buflen); | ||
| 508 | + | ||
| 509 | +// Experimental API. | ||
| 510 | +// Get the annotation corresponding to |key| in |annot|'s dictionary. Common | ||
| 511 | +// keys for linking annotations include "IRT" and "Popup". Must call | ||
| 512 | +// FPDFPage_CloseAnnot() when the annotation returned by this function is no | ||
| 513 | +// longer needed. | ||
| 514 | +// | ||
| 515 | +// annot - handle to an annotation. | ||
| 516 | +// key - the key to the requested dictionary entry, encoded in UTF-8. | ||
| 517 | +// | ||
| 518 | +// Returns a handle to the linked annotation object, or NULL on failure. | ||
| 519 | +FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV | ||
| 520 | +FPDFAnnot_GetLinkedAnnot(FPDF_ANNOTATION annot, FPDF_BYTESTRING key); | ||
| 521 | + | ||
| 522 | +// Experimental API. | ||
| 523 | +// Get the annotation flags of |annot|. | ||
| 524 | +// | ||
| 525 | +// annot - handle to an annotation. | ||
| 526 | +// | ||
| 527 | +// Returns the annotation flags. | ||
| 528 | +FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetFlags(FPDF_ANNOTATION annot); | ||
| 529 | + | ||
| 530 | +// Experimental API. | ||
| 531 | +// Set the |annot|'s flags to be of the value |flags|. | ||
| 532 | +// | ||
| 533 | +// annot - handle to an annotation. | ||
| 534 | +// flags - the flag values to be set. | ||
| 535 | +// | ||
| 536 | +// Returns true if successful. | ||
| 537 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetFlags(FPDF_ANNOTATION annot, | ||
| 538 | + int flags); | ||
| 539 | + | ||
| 540 | +// Experimental API. | ||
| 541 | +// Get the annotation flags of |annot|. | ||
| 542 | +// | ||
| 543 | +// hHandle - handle to the form fill module, returned by | ||
| 544 | +// FPDFDOC_InitFormFillEnvironment(). | ||
| 545 | +// annot - handle to an interactive form annotation. | ||
| 546 | +// | ||
| 547 | +// Returns the annotation flags specific to interactive forms. | ||
| 548 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 549 | +FPDFAnnot_GetFormFieldFlags(FPDF_FORMHANDLE handle, FPDF_ANNOTATION annot); | ||
| 550 | + | ||
| 551 | +// Experimental API. | ||
| 552 | +// Retrieves an interactive form annotation whose rectangle contains a given | ||
| 553 | +// point on a page. Must call FPDFPage_CloseAnnot() when the annotation returned | ||
| 554 | +// is no longer needed. | ||
| 555 | +// | ||
| 556 | +// | ||
| 557 | +// hHandle - handle to the form fill module, returned by | ||
| 558 | +// FPDFDOC_InitFormFillEnvironment(). | ||
| 559 | +// page - handle to the page, returned by FPDF_LoadPage function. | ||
| 560 | +// point - position in PDF "user space". | ||
| 561 | +// | ||
| 562 | +// Returns the interactive form annotation whose rectangle contains the given | ||
| 563 | +// coordinates on the page. If there is no such annotation, return NULL. | ||
| 564 | +FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV | ||
| 565 | +FPDFAnnot_GetFormFieldAtPoint(FPDF_FORMHANDLE hHandle, | ||
| 566 | + FPDF_PAGE page, | ||
| 567 | + const FS_POINTF* point); | ||
| 568 | + | ||
| 569 | +// Experimental API. | ||
| 570 | +// Gets the name of |annot|, which is an interactive form annotation. | ||
| 571 | +// |buffer| is only modified if |buflen| is longer than the length of contents. | ||
| 572 | +// In case of error, nothing will be added to |buffer| and the return value will | ||
| 573 | +// be 0. Note that return value of empty string is 2 for "\0\0". | ||
| 574 | +// | ||
| 575 | +// hHandle - handle to the form fill module, returned by | ||
| 576 | +// FPDFDOC_InitFormFillEnvironment(). | ||
| 577 | +// annot - handle to an interactive form annotation. | ||
| 578 | +// buffer - buffer for holding the name string, encoded in UTF-16LE. | ||
| 579 | +// buflen - length of the buffer in bytes. | ||
| 580 | +// | ||
| 581 | +// Returns the length of the string value in bytes. | ||
| 582 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 583 | +FPDFAnnot_GetFormFieldName(FPDF_FORMHANDLE hHandle, | ||
| 584 | + FPDF_ANNOTATION annot, | ||
| 585 | + FPDF_WCHAR* buffer, | ||
| 586 | + unsigned long buflen); | ||
| 587 | + | ||
| 588 | +// Experimental API. | ||
| 589 | +// Gets the form field type of |annot|, which is an interactive form annotation. | ||
| 590 | +// | ||
| 591 | +// hHandle - handle to the form fill module, returned by | ||
| 592 | +// FPDFDOC_InitFormFillEnvironment(). | ||
| 593 | +// annot - handle to an interactive form annotation. | ||
| 594 | +// | ||
| 595 | +// Returns the type of the form field (one of the FPDF_FORMFIELD_* values) on | ||
| 596 | +// success. Returns -1 on error. | ||
| 597 | +// See field types in fpdf_formfill.h. | ||
| 598 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 599 | +FPDFAnnot_GetFormFieldType(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot); | ||
| 600 | + | ||
| 601 | +// Experimental API. | ||
| 602 | +// Gets the value of |annot|, which is an interactive form annotation. | ||
| 603 | +// |buffer| is only modified if |buflen| is longer than the length of contents. | ||
| 604 | +// In case of error, nothing will be added to |buffer| and the return value will | ||
| 605 | +// be 0. Note that return value of empty string is 2 for "\0\0". | ||
| 606 | +// | ||
| 607 | +// hHandle - handle to the form fill module, returned by | ||
| 608 | +// FPDFDOC_InitFormFillEnvironment(). | ||
| 609 | +// annot - handle to an interactive form annotation. | ||
| 610 | +// buffer - buffer for holding the value string, encoded in UTF-16LE. | ||
| 611 | +// buflen - length of the buffer in bytes. | ||
| 612 | +// | ||
| 613 | +// Returns the length of the string value in bytes. | ||
| 614 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 615 | +FPDFAnnot_GetFormFieldValue(FPDF_FORMHANDLE hHandle, | ||
| 616 | + FPDF_ANNOTATION annot, | ||
| 617 | + FPDF_WCHAR* buffer, | ||
| 618 | + unsigned long buflen); | ||
| 619 | + | ||
| 620 | +// Experimental API. | ||
| 621 | +// Get the number of options in the |annot|'s "Opt" dictionary. Intended for | ||
| 622 | +// use with listbox and combobox widget annotations. | ||
| 623 | +// | ||
| 624 | +// hHandle - handle to the form fill module, returned by | ||
| 625 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 626 | +// annot - handle to an annotation. | ||
| 627 | +// | ||
| 628 | +// Returns the number of options in "Opt" dictionary on success. Return value | ||
| 629 | +// will be -1 if annotation does not have an "Opt" dictionary or other error. | ||
| 630 | +FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetOptionCount(FPDF_FORMHANDLE hHandle, | ||
| 631 | + FPDF_ANNOTATION annot); | ||
| 632 | + | ||
| 633 | +// Experimental API. | ||
| 634 | +// Get the string value for the label of the option at |index| in |annot|'s | ||
| 635 | +// "Opt" dictionary. Intended for use with listbox and combobox widget | ||
| 636 | +// annotations. |buffer| is only modified if |buflen| is longer than the length | ||
| 637 | +// of contents. If index is out of range or in case of other error, nothing | ||
| 638 | +// will be added to |buffer| and the return value will be 0. Note that | ||
| 639 | +// return value of empty string is 2 for "\0\0". | ||
| 640 | +// | ||
| 641 | +// hHandle - handle to the form fill module, returned by | ||
| 642 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 643 | +// annot - handle to an annotation. | ||
| 644 | +// index - numeric index of the option in the "Opt" array | ||
| 645 | +// buffer - buffer for holding the value string, encoded in UTF-16LE. | ||
| 646 | +// buflen - length of the buffer in bytes. | ||
| 647 | +// | ||
| 648 | +// Returns the length of the string value in bytes. | ||
| 649 | +// If |annot| does not have an "Opt" array, |index| is out of range or if any | ||
| 650 | +// other error occurs, returns 0. | ||
| 651 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 652 | +FPDFAnnot_GetOptionLabel(FPDF_FORMHANDLE hHandle, | ||
| 653 | + FPDF_ANNOTATION annot, | ||
| 654 | + int index, | ||
| 655 | + FPDF_WCHAR* buffer, | ||
| 656 | + unsigned long buflen); | ||
| 657 | + | ||
| 658 | +// Experimental API. | ||
| 659 | +// Determine whether or not the option at |index| in |annot|'s "Opt" dictionary | ||
| 660 | +// is selected. Intended for use with listbox and combobox widget annotations. | ||
| 661 | +// | ||
| 662 | +// handle - handle to the form fill module, returned by | ||
| 663 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 664 | +// annot - handle to an annotation. | ||
| 665 | +// index - numeric index of the option in the "Opt" array. | ||
| 666 | +// | ||
| 667 | +// Returns true if the option at |index| in |annot|'s "Opt" dictionary is | ||
| 668 | +// selected, false otherwise. | ||
| 669 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 670 | +FPDFAnnot_IsOptionSelected(FPDF_FORMHANDLE handle, | ||
| 671 | + FPDF_ANNOTATION annot, | ||
| 672 | + int index); | ||
| 673 | + | ||
| 674 | +// Experimental API. | ||
| 675 | +// Get the float value of the font size for an |annot| with variable text. | ||
| 676 | +// If 0, the font is to be auto-sized: its size is computed as a function of | ||
| 677 | +// the height of the annotation rectangle. | ||
| 678 | +// | ||
| 679 | +// hHandle - handle to the form fill module, returned by | ||
| 680 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 681 | +// annot - handle to an annotation. | ||
| 682 | +// value - Required. Float which will be set to font size on success. | ||
| 683 | +// | ||
| 684 | +// Returns true if the font size was set in |value|, false on error or if | ||
| 685 | +// |value| not provided. | ||
| 686 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 687 | +FPDFAnnot_GetFontSize(FPDF_FORMHANDLE hHandle, | ||
| 688 | + FPDF_ANNOTATION annot, | ||
| 689 | + float* value); | ||
| 690 | + | ||
| 691 | +// Experimental API. | ||
| 692 | +// Determine if |annot| is a form widget that is checked. Intended for use with | ||
| 693 | +// checkbox and radio button widgets. | ||
| 694 | +// | ||
| 695 | +// hHandle - handle to the form fill module, returned by | ||
| 696 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 697 | +// annot - handle to an annotation. | ||
| 698 | +// | ||
| 699 | +// Returns true if |annot| is a form widget and is checked, false otherwise. | ||
| 700 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_IsChecked(FPDF_FORMHANDLE hHandle, | ||
| 701 | + FPDF_ANNOTATION annot); | ||
| 702 | + | ||
| 703 | +// Experimental API. | ||
| 704 | +// Set the list of focusable annotation subtypes. Annotations of subtype | ||
| 705 | +// FPDF_ANNOT_WIDGET are by default focusable. New subtypes set using this API | ||
| 706 | +// will override the existing subtypes. | ||
| 707 | +// | ||
| 708 | +// hHandle - handle to the form fill module, returned by | ||
| 709 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 710 | +// subtypes - list of annotation subtype which can be tabbed over. | ||
| 711 | +// count - total number of annotation subtype in list. | ||
| 712 | +// Returns true if list of annotation subtype is set successfully, false | ||
| 713 | +// otherwise. | ||
| 714 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 715 | +FPDFAnnot_SetFocusableSubtypes(FPDF_FORMHANDLE hHandle, | ||
| 716 | + const FPDF_ANNOTATION_SUBTYPE* subtypes, | ||
| 717 | + size_t count); | ||
| 718 | + | ||
| 719 | +// Experimental API. | ||
| 720 | +// Get the count of focusable annotation subtypes as set by host | ||
| 721 | +// for a |hHandle|. | ||
| 722 | +// | ||
| 723 | +// hHandle - handle to the form fill module, returned by | ||
| 724 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 725 | +// Returns the count of focusable annotation subtypes or -1 on error. | ||
| 726 | +// Note : Annotations of type FPDF_ANNOT_WIDGET are by default focusable. | ||
| 727 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 728 | +FPDFAnnot_GetFocusableSubtypesCount(FPDF_FORMHANDLE hHandle); | ||
| 729 | + | ||
| 730 | +// Experimental API. | ||
| 731 | +// Get the list of focusable annotation subtype as set by host. | ||
| 732 | +// | ||
| 733 | +// hHandle - handle to the form fill module, returned by | ||
| 734 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 735 | +// subtypes - receives the list of annotation subtype which can be tabbed | ||
| 736 | +// over. Caller must have allocated |subtypes| more than or | ||
| 737 | +// equal to the count obtained from | ||
| 738 | +// FPDFAnnot_GetFocusableSubtypesCount() API. | ||
| 739 | +// count - size of |subtypes|. | ||
| 740 | +// Returns true on success and set list of annotation subtype to |subtypes|, | ||
| 741 | +// false otherwise. | ||
| 742 | +// Note : Annotations of type FPDF_ANNOT_WIDGET are by default focusable. | ||
| 743 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 744 | +FPDFAnnot_GetFocusableSubtypes(FPDF_FORMHANDLE hHandle, | ||
| 745 | + FPDF_ANNOTATION_SUBTYPE* subtypes, | ||
| 746 | + size_t count); | ||
| 747 | + | ||
| 748 | +// Experimental API. | ||
| 749 | +// Gets FPDF_LINK object for |annot|. Intended to use for link annotations. | ||
| 750 | +// | ||
| 751 | +// annot - handle to an annotation. | ||
| 752 | +// | ||
| 753 | +// Returns FPDF_LINK from the FPDF_ANNOTATION and NULL on failure, | ||
| 754 | +// if the input annot is NULL or input annot's subtype is not link. | ||
| 755 | +FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFAnnot_GetLink(FPDF_ANNOTATION annot); | ||
| 756 | + | ||
| 757 | +// Experimental API. | ||
| 758 | +// Gets the count of annotations in the |annot|'s control group. | ||
| 759 | +// A group of interactive form annotations is collectively called a form | ||
| 760 | +// control group. Here, |annot|, an interactive form annotation, should be | ||
| 761 | +// either a radio button or a checkbox. | ||
| 762 | +// | ||
| 763 | +// hHandle - handle to the form fill module, returned by | ||
| 764 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 765 | +// annot - handle to an annotation. | ||
| 766 | +// | ||
| 767 | +// Returns number of controls in its control group or -1 on error. | ||
| 768 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 769 | +FPDFAnnot_GetFormControlCount(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot); | ||
| 770 | + | ||
| 771 | +// Experimental API. | ||
| 772 | +// Gets the index of |annot| in |annot|'s control group. | ||
| 773 | +// A group of interactive form annotations is collectively called a form | ||
| 774 | +// control group. Here, |annot|, an interactive form annotation, should be | ||
| 775 | +// either a radio button or a checkbox. | ||
| 776 | +// | ||
| 777 | +// hHandle - handle to the form fill module, returned by | ||
| 778 | +// FPDFDOC_InitFormFillEnvironment. | ||
| 779 | +// annot - handle to an annotation. | ||
| 780 | +// | ||
| 781 | +// Returns index of a given |annot| in its control group or -1 on error. | ||
| 782 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 783 | +FPDFAnnot_GetFormControlIndex(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot); | ||
| 784 | + | ||
| 785 | +// Experimental API. | ||
| 786 | +// Gets the export value of |annot| which is an interactive form annotation. | ||
| 787 | +// Intended for use with radio button and checkbox widget annotations. | ||
| 788 | +// |buffer| is only modified if |buflen| is longer than the length of contents. | ||
| 789 | +// In case of error, nothing will be added to |buffer| and the return value | ||
| 790 | +// will be 0. Note that return value of empty string is 2 for "\0\0". | ||
| 791 | +// | ||
| 792 | +// hHandle - handle to the form fill module, returned by | ||
| 793 | +// FPDFDOC_InitFormFillEnvironment(). | ||
| 794 | +// annot - handle to an interactive form annotation. | ||
| 795 | +// buffer - buffer for holding the value string, encoded in UTF-16LE. | ||
| 796 | +// buflen - length of the buffer in bytes. | ||
| 797 | +// | ||
| 798 | +// Returns the length of the string value in bytes. | ||
| 799 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 800 | +FPDFAnnot_GetFormFieldExportValue(FPDF_FORMHANDLE hHandle, | ||
| 801 | + FPDF_ANNOTATION annot, | ||
| 802 | + FPDF_WCHAR* buffer, | ||
| 803 | + unsigned long buflen); | ||
| 804 | + | ||
| 805 | +#ifdef __cplusplus | ||
| 806 | +} // extern "C" | ||
| 807 | +#endif // __cplusplus | ||
| 808 | + | ||
| 809 | +#endif // PUBLIC_FPDF_ANNOT_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_ |
| 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_ |
| 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 <stddef.h> | ||
| 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) | ||
| 50 | + (struct _FX_FILEAVAIL* pThis, size_t offset, size_t size); | ||
| 51 | +} FX_FILEAVAIL; | ||
| 52 | +typedef void* FPDF_AVAIL; | ||
| 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_ |
printing/windows/pdfium/include/fpdf_doc.h
0 → 100644
| 1 | +// Copyright 2014 PDFium Authors. All rights reserved. | ||
| 2 | +// Use of this source code is governed by a BSD-style license that can be | ||
| 3 | +// found in the LICENSE file. | ||
| 4 | + | ||
| 5 | +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | ||
| 6 | + | ||
| 7 | +#ifndef PUBLIC_FPDF_DOC_H_ | ||
| 8 | +#define PUBLIC_FPDF_DOC_H_ | ||
| 9 | + | ||
| 10 | +// NOLINTNEXTLINE(build/include) | ||
| 11 | +#include "fpdfview.h" | ||
| 12 | + | ||
| 13 | +#ifdef __cplusplus | ||
| 14 | +extern "C" { | ||
| 15 | +#endif // __cplusplus | ||
| 16 | + | ||
| 17 | +// Unsupported action type. | ||
| 18 | +#define PDFACTION_UNSUPPORTED 0 | ||
| 19 | +// Go to a destination within current document. | ||
| 20 | +#define PDFACTION_GOTO 1 | ||
| 21 | +// Go to a destination within another document. | ||
| 22 | +#define PDFACTION_REMOTEGOTO 2 | ||
| 23 | +// URI, including web pages and other Internet resources. | ||
| 24 | +#define PDFACTION_URI 3 | ||
| 25 | +// Launch an application or open a file. | ||
| 26 | +#define PDFACTION_LAUNCH 4 | ||
| 27 | +// Go to a destination in an embedded file. | ||
| 28 | +#define PDFACTION_EMBEDDEDGOTO 5 | ||
| 29 | + | ||
| 30 | +// View destination fit types. See pdfmark reference v9, page 48. | ||
| 31 | +#define PDFDEST_VIEW_UNKNOWN_MODE 0 | ||
| 32 | +#define PDFDEST_VIEW_XYZ 1 | ||
| 33 | +#define PDFDEST_VIEW_FIT 2 | ||
| 34 | +#define PDFDEST_VIEW_FITH 3 | ||
| 35 | +#define PDFDEST_VIEW_FITV 4 | ||
| 36 | +#define PDFDEST_VIEW_FITR 5 | ||
| 37 | +#define PDFDEST_VIEW_FITB 6 | ||
| 38 | +#define PDFDEST_VIEW_FITBH 7 | ||
| 39 | +#define PDFDEST_VIEW_FITBV 8 | ||
| 40 | + | ||
| 41 | +// The file identifier entry type. See section 14.4 "File Identifiers" of the | ||
| 42 | +// ISO 32000-1 standard. | ||
| 43 | +typedef enum { | ||
| 44 | + FILEIDTYPE_PERMANENT = 0, | ||
| 45 | + FILEIDTYPE_CHANGING = 1 | ||
| 46 | +} FPDF_FILEIDTYPE; | ||
| 47 | + | ||
| 48 | +typedef struct _FS_QUADPOINTSF { | ||
| 49 | + FS_FLOAT x1; | ||
| 50 | + FS_FLOAT y1; | ||
| 51 | + FS_FLOAT x2; | ||
| 52 | + FS_FLOAT y2; | ||
| 53 | + FS_FLOAT x3; | ||
| 54 | + FS_FLOAT y3; | ||
| 55 | + FS_FLOAT x4; | ||
| 56 | + FS_FLOAT y4; | ||
| 57 | +} FS_QUADPOINTSF; | ||
| 58 | + | ||
| 59 | +// Get the first child of |bookmark|, or the first top-level bookmark item. | ||
| 60 | +// | ||
| 61 | +// document - handle to the document. | ||
| 62 | +// bookmark - handle to the current bookmark. Pass NULL for the first top | ||
| 63 | +// level item. | ||
| 64 | +// | ||
| 65 | +// Returns a handle to the first child of |bookmark| or the first top-level | ||
| 66 | +// bookmark item. NULL if no child or top-level bookmark found. | ||
| 67 | +FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV | ||
| 68 | +FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); | ||
| 69 | + | ||
| 70 | +// Get the next sibling of |bookmark|. | ||
| 71 | +// | ||
| 72 | +// document - handle to the document. | ||
| 73 | +// bookmark - handle to the current bookmark. | ||
| 74 | +// | ||
| 75 | +// Returns a handle to the next sibling of |bookmark|, or NULL if this is the | ||
| 76 | +// last bookmark at this level. | ||
| 77 | +FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV | ||
| 78 | +FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); | ||
| 79 | + | ||
| 80 | +// Get the title of |bookmark|. | ||
| 81 | +// | ||
| 82 | +// bookmark - handle to the bookmark. | ||
| 83 | +// buffer - buffer for the title. May be NULL. | ||
| 84 | +// buflen - the length of the buffer in bytes. May be 0. | ||
| 85 | +// | ||
| 86 | +// Returns the number of bytes in the title, including the terminating NUL | ||
| 87 | +// character. The number of bytes is returned regardless of the |buffer| and | ||
| 88 | +// |buflen| parameters. | ||
| 89 | +// | ||
| 90 | +// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The | ||
| 91 | +// string is terminated by a UTF16 NUL character. If |buflen| is less than the | ||
| 92 | +// required length, or |buffer| is NULL, |buffer| will not be modified. | ||
| 93 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 94 | +FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, | ||
| 95 | + void* buffer, | ||
| 96 | + unsigned long buflen); | ||
| 97 | + | ||
| 98 | +// Find the bookmark with |title| in |document|. | ||
| 99 | +// | ||
| 100 | +// document - handle to the document. | ||
| 101 | +// title - the UTF-16LE encoded Unicode title for which to search. | ||
| 102 | +// | ||
| 103 | +// Returns the handle to the bookmark, or NULL if |title| can't be found. | ||
| 104 | +// | ||
| 105 | +// FPDFBookmark_Find() will always return the first bookmark found even if | ||
| 106 | +// multiple bookmarks have the same |title|. | ||
| 107 | +FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV | ||
| 108 | +FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title); | ||
| 109 | + | ||
| 110 | +// Get the destination associated with |bookmark|. | ||
| 111 | +// | ||
| 112 | +// document - handle to the document. | ||
| 113 | +// bookmark - handle to the bookmark. | ||
| 114 | +// | ||
| 115 | +// Returns the handle to the destination data, NULL if no destination is | ||
| 116 | +// associated with |bookmark|. | ||
| 117 | +FPDF_EXPORT FPDF_DEST FPDF_CALLCONV | ||
| 118 | +FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); | ||
| 119 | + | ||
| 120 | +// Get the action associated with |bookmark|. | ||
| 121 | +// | ||
| 122 | +// bookmark - handle to the bookmark. | ||
| 123 | +// | ||
| 124 | +// Returns the handle to the action data, or NULL if no action is associated | ||
| 125 | +// with |bookmark|. When NULL is returned, FPDFBookmark_GetDest() should be | ||
| 126 | +// called to get the |bookmark| destination data. | ||
| 127 | +FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV | ||
| 128 | +FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark); | ||
| 129 | + | ||
| 130 | +// Get the type of |action|. | ||
| 131 | +// | ||
| 132 | +// action - handle to the action. | ||
| 133 | +// | ||
| 134 | +// Returns one of: | ||
| 135 | +// PDFACTION_UNSUPPORTED | ||
| 136 | +// PDFACTION_GOTO | ||
| 137 | +// PDFACTION_REMOTEGOTO | ||
| 138 | +// PDFACTION_URI | ||
| 139 | +// PDFACTION_LAUNCH | ||
| 140 | +FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION action); | ||
| 141 | + | ||
| 142 | +// Get the destination of |action|. | ||
| 143 | +// | ||
| 144 | +// document - handle to the document. | ||
| 145 | +// action - handle to the action. |action| must be a |PDFACTION_GOTO| or | ||
| 146 | +// |PDFACTION_REMOTEGOTO|. | ||
| 147 | +// | ||
| 148 | +// Returns a handle to the destination data, or NULL on error, typically | ||
| 149 | +// because the arguments were bad or the action was of the wrong type. | ||
| 150 | +// | ||
| 151 | +// In the case of |PDFACTION_REMOTEGOTO|, you must first call | ||
| 152 | +// FPDFAction_GetFilePath(), then load the document at that path, then pass | ||
| 153 | +// the document handle from that document as |document| to FPDFAction_GetDest(). | ||
| 154 | +FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document, | ||
| 155 | + FPDF_ACTION action); | ||
| 156 | + | ||
| 157 | +// Get the file path of |action|. | ||
| 158 | +// | ||
| 159 | +// action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or | ||
| 160 | +// |PDFACTION_REMOTEGOTO|. | ||
| 161 | +// buffer - a buffer for output the path string. May be NULL. | ||
| 162 | +// buflen - the length of the buffer, in bytes. May be 0. | ||
| 163 | +// | ||
| 164 | +// Returns the number of bytes in the file path, including the trailing NUL | ||
| 165 | +// character, or 0 on error, typically because the arguments were bad or the | ||
| 166 | +// action was of the wrong type. | ||
| 167 | +// | ||
| 168 | +// Regardless of the platform, the |buffer| is always in UTF-8 encoding. | ||
| 169 | +// If |buflen| is less than the returned length, or |buffer| is NULL, |buffer| | ||
| 170 | +// will not be modified. | ||
| 171 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 172 | +FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen); | ||
| 173 | + | ||
| 174 | +// Get the URI path of |action|. | ||
| 175 | +// | ||
| 176 | +// document - handle to the document. | ||
| 177 | +// action - handle to the action. Must be a |PDFACTION_URI|. | ||
| 178 | +// buffer - a buffer for the path string. May be NULL. | ||
| 179 | +// buflen - the length of the buffer, in bytes. May be 0. | ||
| 180 | +// | ||
| 181 | +// Returns the number of bytes in the URI path, including the trailing NUL | ||
| 182 | +// character, or 0 on error, typically because the arguments were bad or the | ||
| 183 | +// action was of the wrong type. | ||
| 184 | +// | ||
| 185 | +// The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less than the | ||
| 186 | +// returned length, or |buffer| is NULL, |buffer| will not be modified. | ||
| 187 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 188 | +FPDFAction_GetURIPath(FPDF_DOCUMENT document, | ||
| 189 | + FPDF_ACTION action, | ||
| 190 | + void* buffer, | ||
| 191 | + unsigned long buflen); | ||
| 192 | + | ||
| 193 | +// Get the page index of |dest|. | ||
| 194 | +// | ||
| 195 | +// document - handle to the document. | ||
| 196 | +// dest - handle to the destination. | ||
| 197 | +// | ||
| 198 | +// Returns the 0-based page index containing |dest|. Returns -1 on error. | ||
| 199 | +FPDF_EXPORT int FPDF_CALLCONV FPDFDest_GetDestPageIndex(FPDF_DOCUMENT document, | ||
| 200 | + FPDF_DEST dest); | ||
| 201 | + | ||
| 202 | +// Experimental API. | ||
| 203 | +// Get the view (fit type) specified by |dest|. | ||
| 204 | +// | ||
| 205 | +// dest - handle to the destination. | ||
| 206 | +// pNumParams - receives the number of view parameters, which is at most 4. | ||
| 207 | +// pParams - buffer to write the view parameters. Must be at least 4 | ||
| 208 | +// FS_FLOATs long. | ||
| 209 | +// Returns one of the PDFDEST_VIEW_* constants, PDFDEST_VIEW_UNKNOWN_MODE if | ||
| 210 | +// |dest| does not specify a view. | ||
| 211 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 212 | +FPDFDest_GetView(FPDF_DEST dest, unsigned long* pNumParams, FS_FLOAT* pParams); | ||
| 213 | + | ||
| 214 | +// Get the (x, y, zoom) location of |dest| in the destination page, if the | ||
| 215 | +// destination is in [page /XYZ x y zoom] syntax. | ||
| 216 | +// | ||
| 217 | +// dest - handle to the destination. | ||
| 218 | +// hasXVal - out parameter; true if the x value is not null | ||
| 219 | +// hasYVal - out parameter; true if the y value is not null | ||
| 220 | +// hasZoomVal - out parameter; true if the zoom value is not null | ||
| 221 | +// x - out parameter; the x coordinate, in page coordinates. | ||
| 222 | +// y - out parameter; the y coordinate, in page coordinates. | ||
| 223 | +// zoom - out parameter; the zoom value. | ||
| 224 | +// Returns TRUE on successfully reading the /XYZ value. | ||
| 225 | +// | ||
| 226 | +// Note the [x, y, zoom] values are only set if the corresponding hasXVal, | ||
| 227 | +// hasYVal or hasZoomVal flags are true. | ||
| 228 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 229 | +FPDFDest_GetLocationInPage(FPDF_DEST dest, | ||
| 230 | + FPDF_BOOL* hasXVal, | ||
| 231 | + FPDF_BOOL* hasYVal, | ||
| 232 | + FPDF_BOOL* hasZoomVal, | ||
| 233 | + FS_FLOAT* x, | ||
| 234 | + FS_FLOAT* y, | ||
| 235 | + FS_FLOAT* zoom); | ||
| 236 | + | ||
| 237 | +// Find a link at point (|x|,|y|) on |page|. | ||
| 238 | +// | ||
| 239 | +// page - handle to the document page. | ||
| 240 | +// x - the x coordinate, in the page coordinate system. | ||
| 241 | +// y - the y coordinate, in the page coordinate system. | ||
| 242 | +// | ||
| 243 | +// Returns a handle to the link, or NULL if no link found at the given point. | ||
| 244 | +// | ||
| 245 | +// You can convert coordinates from screen coordinates to page coordinates using | ||
| 246 | +// FPDF_DeviceToPage(). | ||
| 247 | +FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFLink_GetLinkAtPoint(FPDF_PAGE page, | ||
| 248 | + double x, | ||
| 249 | + double y); | ||
| 250 | + | ||
| 251 | +// Find the Z-order of link at point (|x|,|y|) on |page|. | ||
| 252 | +// | ||
| 253 | +// page - handle to the document page. | ||
| 254 | +// x - the x coordinate, in the page coordinate system. | ||
| 255 | +// y - the y coordinate, in the page coordinate system. | ||
| 256 | +// | ||
| 257 | +// Returns the Z-order of the link, or -1 if no link found at the given point. | ||
| 258 | +// Larger Z-order numbers are closer to the front. | ||
| 259 | +// | ||
| 260 | +// You can convert coordinates from screen coordinates to page coordinates using | ||
| 261 | +// FPDF_DeviceToPage(). | ||
| 262 | +FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, | ||
| 263 | + double x, | ||
| 264 | + double y); | ||
| 265 | + | ||
| 266 | +// Get destination info for |link|. | ||
| 267 | +// | ||
| 268 | +// document - handle to the document. | ||
| 269 | +// link - handle to the link. | ||
| 270 | +// | ||
| 271 | +// Returns a handle to the destination, or NULL if there is no destination | ||
| 272 | +// associated with the link. In this case, you should call FPDFLink_GetAction() | ||
| 273 | +// to retrieve the action associated with |link|. | ||
| 274 | +FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document, | ||
| 275 | + FPDF_LINK link); | ||
| 276 | + | ||
| 277 | +// Get action info for |link|. | ||
| 278 | +// | ||
| 279 | +// link - handle to the link. | ||
| 280 | +// | ||
| 281 | +// Returns a handle to the action associated to |link|, or NULL if no action. | ||
| 282 | +FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK link); | ||
| 283 | + | ||
| 284 | +// Enumerates all the link annotations in |page|. | ||
| 285 | +// | ||
| 286 | +// page - handle to the page. | ||
| 287 | +// start_pos - the start position, should initially be 0 and is updated with | ||
| 288 | +// the next start position on return. | ||
| 289 | +// link_annot - the link handle for |startPos|. | ||
| 290 | +// | ||
| 291 | +// Returns TRUE on success. | ||
| 292 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page, | ||
| 293 | + int* start_pos, | ||
| 294 | + FPDF_LINK* link_annot); | ||
| 295 | + | ||
| 296 | +// Experimental API. | ||
| 297 | +// Gets FPDF_ANNOTATION object for |link_annot|. | ||
| 298 | +// | ||
| 299 | +// page - handle to the page in which FPDF_LINK object is present. | ||
| 300 | +// link_annot - handle to link annotation. | ||
| 301 | +// | ||
| 302 | +// Returns FPDF_ANNOTATION from the FPDF_LINK and NULL on failure, | ||
| 303 | +// if the input link annot or page is NULL. | ||
| 304 | +FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV | ||
| 305 | +FPDFLink_GetAnnot(FPDF_PAGE page, FPDF_LINK link_annot); | ||
| 306 | + | ||
| 307 | +// Get the rectangle for |link_annot|. | ||
| 308 | +// | ||
| 309 | +// link_annot - handle to the link annotation. | ||
| 310 | +// rect - the annotation rectangle. | ||
| 311 | +// | ||
| 312 | +// Returns true on success. | ||
| 313 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetAnnotRect(FPDF_LINK link_annot, | ||
| 314 | + FS_RECTF* rect); | ||
| 315 | + | ||
| 316 | +// Get the count of quadrilateral points to the |link_annot|. | ||
| 317 | +// | ||
| 318 | +// link_annot - handle to the link annotation. | ||
| 319 | +// | ||
| 320 | +// Returns the count of quadrilateral points. | ||
| 321 | +FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountQuadPoints(FPDF_LINK link_annot); | ||
| 322 | + | ||
| 323 | +// Get the quadrilateral points for the specified |quad_index| in |link_annot|. | ||
| 324 | +// | ||
| 325 | +// link_annot - handle to the link annotation. | ||
| 326 | +// quad_index - the specified quad point index. | ||
| 327 | +// quad_points - receives the quadrilateral points. | ||
| 328 | +// | ||
| 329 | +// Returns true on success. | ||
| 330 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 331 | +FPDFLink_GetQuadPoints(FPDF_LINK link_annot, | ||
| 332 | + int quad_index, | ||
| 333 | + FS_QUADPOINTSF* quad_points); | ||
| 334 | + | ||
| 335 | +// Experimental API | ||
| 336 | +// Gets an additional-action from |page|. | ||
| 337 | +// | ||
| 338 | +// page - handle to the page, as returned by FPDF_LoadPage(). | ||
| 339 | +// aa_type - the type of the page object's addtional-action, defined | ||
| 340 | +// in public/fpdf_formfill.h | ||
| 341 | +// | ||
| 342 | +// Returns the handle to the action data, or NULL if there is no | ||
| 343 | +// additional-action of type |aa_type|. | ||
| 344 | +FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDF_GetPageAAction(FPDF_PAGE page, | ||
| 345 | + int aa_type); | ||
| 346 | + | ||
| 347 | +// Experimental API. | ||
| 348 | +// Get the file identifer defined in the trailer of |document|. | ||
| 349 | +// | ||
| 350 | +// document - handle to the document. | ||
| 351 | +// id_type - the file identifier type to retrieve. | ||
| 352 | +// buffer - a buffer for the file identifier. May be NULL. | ||
| 353 | +// buflen - the length of the buffer, in bytes. May be 0. | ||
| 354 | +// | ||
| 355 | +// Returns the number of bytes in the file identifier, including the NUL | ||
| 356 | +// terminator. | ||
| 357 | +// | ||
| 358 | +// The |buffer| is always a byte string. The |buffer| is followed by a NUL | ||
| 359 | +// terminator. If |buflen| is less than the returned length, or |buffer| is | ||
| 360 | +// NULL, |buffer| will not be modified. | ||
| 361 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 362 | +FPDF_GetFileIdentifier(FPDF_DOCUMENT document, | ||
| 363 | + FPDF_FILEIDTYPE id_type, | ||
| 364 | + void* buffer, | ||
| 365 | + unsigned long buflen); | ||
| 366 | + | ||
| 367 | +// Get meta-data |tag| content from |document|. | ||
| 368 | +// | ||
| 369 | +// document - handle to the document. | ||
| 370 | +// tag - the tag to retrieve. The tag can be one of: | ||
| 371 | +// Title, Author, Subject, Keywords, Creator, Producer, | ||
| 372 | +// CreationDate, or ModDate. | ||
| 373 | +// For detailed explanations of these tags and their respective | ||
| 374 | +// values, please refer to PDF Reference 1.6, section 10.2.1, | ||
| 375 | +// 'Document Information Dictionary'. | ||
| 376 | +// buffer - a buffer for the tag. May be NULL. | ||
| 377 | +// buflen - the length of the buffer, in bytes. May be 0. | ||
| 378 | +// | ||
| 379 | +// Returns the number of bytes in the tag, including trailing zeros. | ||
| 380 | +// | ||
| 381 | +// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two | ||
| 382 | +// bytes of zeros indicating the end of the string. If |buflen| is less than | ||
| 383 | +// the returned length, or |buffer| is NULL, |buffer| will not be modified. | ||
| 384 | +// | ||
| 385 | +// For linearized files, FPDFAvail_IsFormAvail must be called before this, and | ||
| 386 | +// it must have returned PDF_FORM_AVAIL or PDF_FORM_NOTEXIST. Before that, there | ||
| 387 | +// is no guarantee the metadata has been loaded. | ||
| 388 | +FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document, | ||
| 389 | + FPDF_BYTESTRING tag, | ||
| 390 | + void* buffer, | ||
| 391 | + unsigned long buflen); | ||
| 392 | + | ||
| 393 | +// Get the page label for |page_index| from |document|. | ||
| 394 | +// | ||
| 395 | +// document - handle to the document. | ||
| 396 | +// page_index - the 0-based index of the page. | ||
| 397 | +// buffer - a buffer for the page label. May be NULL. | ||
| 398 | +// buflen - the length of the buffer, in bytes. May be 0. | ||
| 399 | +// | ||
| 400 | +// Returns the number of bytes in the page label, including trailing zeros. | ||
| 401 | +// | ||
| 402 | +// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two | ||
| 403 | +// bytes of zeros indicating the end of the string. If |buflen| is less than | ||
| 404 | +// the returned length, or |buffer| is NULL, |buffer| will not be modified. | ||
| 405 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 406 | +FPDF_GetPageLabel(FPDF_DOCUMENT document, | ||
| 407 | + int page_index, | ||
| 408 | + void* buffer, | ||
| 409 | + unsigned long buflen); | ||
| 410 | + | ||
| 411 | +#ifdef __cplusplus | ||
| 412 | +} // extern "C" | ||
| 413 | +#endif // __cplusplus | ||
| 414 | + | ||
| 415 | +#endif // PUBLIC_FPDF_DOC_H_ |
printing/windows/pdfium/include/fpdf_edit.h
0 → 100644
| 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_EDIT_H_ | ||
| 8 | +#define PUBLIC_FPDF_EDIT_H_ | ||
| 9 | + | ||
| 10 | +#include <stdint.h> | ||
| 11 | + | ||
| 12 | +// NOLINTNEXTLINE(build/include) | ||
| 13 | +#include "fpdfview.h" | ||
| 14 | + | ||
| 15 | +#define FPDF_ARGB(a, r, g, b) \ | ||
| 16 | + ((uint32_t)(((uint32_t)(b)&0xff) | (((uint32_t)(g)&0xff) << 8) | \ | ||
| 17 | + (((uint32_t)(r)&0xff) << 16) | (((uint32_t)(a)&0xff) << 24))) | ||
| 18 | +#define FPDF_GetBValue(argb) ((uint8_t)(argb)) | ||
| 19 | +#define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8)) | ||
| 20 | +#define FPDF_GetRValue(argb) ((uint8_t)((argb) >> 16)) | ||
| 21 | +#define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24)) | ||
| 22 | + | ||
| 23 | +// Refer to PDF Reference version 1.7 table 4.12 for all color space families. | ||
| 24 | +#define FPDF_COLORSPACE_UNKNOWN 0 | ||
| 25 | +#define FPDF_COLORSPACE_DEVICEGRAY 1 | ||
| 26 | +#define FPDF_COLORSPACE_DEVICERGB 2 | ||
| 27 | +#define FPDF_COLORSPACE_DEVICECMYK 3 | ||
| 28 | +#define FPDF_COLORSPACE_CALGRAY 4 | ||
| 29 | +#define FPDF_COLORSPACE_CALRGB 5 | ||
| 30 | +#define FPDF_COLORSPACE_LAB 6 | ||
| 31 | +#define FPDF_COLORSPACE_ICCBASED 7 | ||
| 32 | +#define FPDF_COLORSPACE_SEPARATION 8 | ||
| 33 | +#define FPDF_COLORSPACE_DEVICEN 9 | ||
| 34 | +#define FPDF_COLORSPACE_INDEXED 10 | ||
| 35 | +#define FPDF_COLORSPACE_PATTERN 11 | ||
| 36 | + | ||
| 37 | +// The page object constants. | ||
| 38 | +#define FPDF_PAGEOBJ_UNKNOWN 0 | ||
| 39 | +#define FPDF_PAGEOBJ_TEXT 1 | ||
| 40 | +#define FPDF_PAGEOBJ_PATH 2 | ||
| 41 | +#define FPDF_PAGEOBJ_IMAGE 3 | ||
| 42 | +#define FPDF_PAGEOBJ_SHADING 4 | ||
| 43 | +#define FPDF_PAGEOBJ_FORM 5 | ||
| 44 | + | ||
| 45 | +// The path segment constants. | ||
| 46 | +#define FPDF_SEGMENT_UNKNOWN -1 | ||
| 47 | +#define FPDF_SEGMENT_LINETO 0 | ||
| 48 | +#define FPDF_SEGMENT_BEZIERTO 1 | ||
| 49 | +#define FPDF_SEGMENT_MOVETO 2 | ||
| 50 | + | ||
| 51 | +#define FPDF_FILLMODE_NONE 0 | ||
| 52 | +#define FPDF_FILLMODE_ALTERNATE 1 | ||
| 53 | +#define FPDF_FILLMODE_WINDING 2 | ||
| 54 | + | ||
| 55 | +#define FPDF_FONT_TYPE1 1 | ||
| 56 | +#define FPDF_FONT_TRUETYPE 2 | ||
| 57 | + | ||
| 58 | +#define FPDF_LINECAP_BUTT 0 | ||
| 59 | +#define FPDF_LINECAP_ROUND 1 | ||
| 60 | +#define FPDF_LINECAP_PROJECTING_SQUARE 2 | ||
| 61 | + | ||
| 62 | +#define FPDF_LINEJOIN_MITER 0 | ||
| 63 | +#define FPDF_LINEJOIN_ROUND 1 | ||
| 64 | +#define FPDF_LINEJOIN_BEVEL 2 | ||
| 65 | + | ||
| 66 | +// See FPDF_SetPrintMode() for descriptions. | ||
| 67 | +#define FPDF_PRINTMODE_EMF 0 | ||
| 68 | +#define FPDF_PRINTMODE_TEXTONLY 1 | ||
| 69 | +#define FPDF_PRINTMODE_POSTSCRIPT2 2 | ||
| 70 | +#define FPDF_PRINTMODE_POSTSCRIPT3 3 | ||
| 71 | +#define FPDF_PRINTMODE_POSTSCRIPT2_PASSTHROUGH 4 | ||
| 72 | +#define FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH 5 | ||
| 73 | +#define FPDF_PRINTMODE_EMF_IMAGE_MASKS 6 | ||
| 74 | + | ||
| 75 | +typedef struct FPDF_IMAGEOBJ_METADATA { | ||
| 76 | + // The image width in pixels. | ||
| 77 | + unsigned int width; | ||
| 78 | + // The image height in pixels. | ||
| 79 | + unsigned int height; | ||
| 80 | + // The image's horizontal pixel-per-inch. | ||
| 81 | + float horizontal_dpi; | ||
| 82 | + // The image's vertical pixel-per-inch. | ||
| 83 | + float vertical_dpi; | ||
| 84 | + // The number of bits used to represent each pixel. | ||
| 85 | + unsigned int bits_per_pixel; | ||
| 86 | + // The image's colorspace. See above for the list of FPDF_COLORSPACE_*. | ||
| 87 | + int colorspace; | ||
| 88 | + // The image's marked content ID. Useful for pairing with associated alt-text. | ||
| 89 | + // A value of -1 indicates no ID. | ||
| 90 | + int marked_content_id; | ||
| 91 | +} FPDF_IMAGEOBJ_METADATA; | ||
| 92 | + | ||
| 93 | +#ifdef __cplusplus | ||
| 94 | +extern "C" { | ||
| 95 | +#endif // __cplusplus | ||
| 96 | + | ||
| 97 | +// Create a new PDF document. | ||
| 98 | +// | ||
| 99 | +// Returns a handle to a new document, or NULL on failure. | ||
| 100 | +FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument(); | ||
| 101 | + | ||
| 102 | +// Create a new PDF page. | ||
| 103 | +// | ||
| 104 | +// document - handle to document. | ||
| 105 | +// page_index - suggested 0-based index of the page to create. If it is larger | ||
| 106 | +// than document's current last index(L), the created page index | ||
| 107 | +// is the next available index -- L+1. | ||
| 108 | +// width - the page width in points. | ||
| 109 | +// height - the page height in points. | ||
| 110 | +// | ||
| 111 | +// Returns the handle to the new page or NULL on failure. | ||
| 112 | +// | ||
| 113 | +// The page should be closed with FPDF_ClosePage() when finished as | ||
| 114 | +// with any other page in the document. | ||
| 115 | +FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document, | ||
| 116 | + int page_index, | ||
| 117 | + double width, | ||
| 118 | + double height); | ||
| 119 | + | ||
| 120 | +// Delete the page at |page_index|. | ||
| 121 | +// | ||
| 122 | +// document - handle to document. | ||
| 123 | +// page_index - the index of the page to delete. | ||
| 124 | +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_Delete(FPDF_DOCUMENT document, | ||
| 125 | + int page_index); | ||
| 126 | + | ||
| 127 | +// Get the rotation of |page|. | ||
| 128 | +// | ||
| 129 | +// page - handle to a page | ||
| 130 | +// | ||
| 131 | +// Returns one of the following indicating the page rotation: | ||
| 132 | +// 0 - No rotation. | ||
| 133 | +// 1 - Rotated 90 degrees clockwise. | ||
| 134 | +// 2 - Rotated 180 degrees clockwise. | ||
| 135 | +// 3 - Rotated 270 degrees clockwise. | ||
| 136 | +FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetRotation(FPDF_PAGE page); | ||
| 137 | + | ||
| 138 | +// Set rotation for |page|. | ||
| 139 | +// | ||
| 140 | +// page - handle to a page. | ||
| 141 | +// rotate - the rotation value, one of: | ||
| 142 | +// 0 - No rotation. | ||
| 143 | +// 1 - Rotated 90 degrees clockwise. | ||
| 144 | +// 2 - Rotated 180 degrees clockwise. | ||
| 145 | +// 3 - Rotated 270 degrees clockwise. | ||
| 146 | +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetRotation(FPDF_PAGE page, int rotate); | ||
| 147 | + | ||
| 148 | +// Insert |page_obj| into |page|. | ||
| 149 | +// | ||
| 150 | +// page - handle to a page | ||
| 151 | +// page_obj - handle to a page object. The |page_obj| will be automatically | ||
| 152 | +// freed. | ||
| 153 | +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertObject(FPDF_PAGE page, | ||
| 154 | + FPDF_PAGEOBJECT page_obj); | ||
| 155 | + | ||
| 156 | +// Experimental API. | ||
| 157 | +// Remove |page_obj| from |page|. | ||
| 158 | +// | ||
| 159 | +// page - handle to a page | ||
| 160 | +// page_obj - handle to a page object to be removed. | ||
| 161 | +// | ||
| 162 | +// Returns TRUE on success. | ||
| 163 | +// | ||
| 164 | +// Ownership is transferred to the caller. Call FPDFPageObj_Destroy() to free | ||
| 165 | +// it. | ||
| 166 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 167 | +FPDFPage_RemoveObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj); | ||
| 168 | + | ||
| 169 | +// Get number of page objects inside |page|. | ||
| 170 | +// | ||
| 171 | +// page - handle to a page. | ||
| 172 | +// | ||
| 173 | +// Returns the number of objects in |page|. | ||
| 174 | +FPDF_EXPORT int FPDF_CALLCONV FPDFPage_CountObjects(FPDF_PAGE page); | ||
| 175 | + | ||
| 176 | +// Get object in |page| at |index|. | ||
| 177 | +// | ||
| 178 | +// page - handle to a page. | ||
| 179 | +// index - the index of a page object. | ||
| 180 | +// | ||
| 181 | +// Returns the handle to the page object, or NULL on failed. | ||
| 182 | +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPage_GetObject(FPDF_PAGE page, | ||
| 183 | + int index); | ||
| 184 | + | ||
| 185 | +// Checks if |page| contains transparency. | ||
| 186 | +// | ||
| 187 | +// page - handle to a page. | ||
| 188 | +// | ||
| 189 | +// Returns TRUE if |page| contains transparency. | ||
| 190 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_HasTransparency(FPDF_PAGE page); | ||
| 191 | + | ||
| 192 | +// Generate the content of |page|. | ||
| 193 | +// | ||
| 194 | +// page - handle to a page. | ||
| 195 | +// | ||
| 196 | +// Returns TRUE on success. | ||
| 197 | +// | ||
| 198 | +// Before you save the page to a file, or reload the page, you must call | ||
| 199 | +// |FPDFPage_GenerateContent| or any changes to |page| will be lost. | ||
| 200 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GenerateContent(FPDF_PAGE page); | ||
| 201 | + | ||
| 202 | +// Destroy |page_obj| by releasing its resources. |page_obj| must have been | ||
| 203 | +// created by FPDFPageObj_CreateNew{Path|Rect}() or | ||
| 204 | +// FPDFPageObj_New{Text|Image}Obj(). This function must be called on | ||
| 205 | +// newly-created objects if they are not added to a page through | ||
| 206 | +// FPDFPage_InsertObject() or to an annotation through FPDFAnnot_AppendObject(). | ||
| 207 | +// | ||
| 208 | +// page_obj - handle to a page object. | ||
| 209 | +FPDF_EXPORT void FPDF_CALLCONV FPDFPageObj_Destroy(FPDF_PAGEOBJECT page_obj); | ||
| 210 | + | ||
| 211 | +// Checks if |page_object| contains transparency. | ||
| 212 | +// | ||
| 213 | +// page_object - handle to a page object. | ||
| 214 | +// | ||
| 215 | +// Returns TRUE if |page_object| contains transparency. | ||
| 216 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 217 | +FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT page_object); | ||
| 218 | + | ||
| 219 | +// Get type of |page_object|. | ||
| 220 | +// | ||
| 221 | +// page_object - handle to a page object. | ||
| 222 | +// | ||
| 223 | +// Returns one of the FPDF_PAGEOBJ_* values on success, FPDF_PAGEOBJ_UNKNOWN on | ||
| 224 | +// error. | ||
| 225 | +FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT page_object); | ||
| 226 | + | ||
| 227 | +// Transform |page_object| by the given matrix. | ||
| 228 | +// | ||
| 229 | +// page_object - handle to a page object. | ||
| 230 | +// a - matrix value. | ||
| 231 | +// b - matrix value. | ||
| 232 | +// c - matrix value. | ||
| 233 | +// d - matrix value. | ||
| 234 | +// e - matrix value. | ||
| 235 | +// f - matrix value. | ||
| 236 | +// | ||
| 237 | +// The matrix is composed as: | ||
| 238 | +// |a c e| | ||
| 239 | +// |b d f| | ||
| 240 | +// and can be used to scale, rotate, shear and translate the |page_object|. | ||
| 241 | +FPDF_EXPORT void FPDF_CALLCONV | ||
| 242 | +FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, | ||
| 243 | + double a, | ||
| 244 | + double b, | ||
| 245 | + double c, | ||
| 246 | + double d, | ||
| 247 | + double e, | ||
| 248 | + double f); | ||
| 249 | + | ||
| 250 | +// Transform all annotations in |page|. | ||
| 251 | +// | ||
| 252 | +// page - handle to a page. | ||
| 253 | +// a - matrix value. | ||
| 254 | +// b - matrix value. | ||
| 255 | +// c - matrix value. | ||
| 256 | +// d - matrix value. | ||
| 257 | +// e - matrix value. | ||
| 258 | +// f - matrix value. | ||
| 259 | +// | ||
| 260 | +// The matrix is composed as: | ||
| 261 | +// |a c e| | ||
| 262 | +// |b d f| | ||
| 263 | +// and can be used to scale, rotate, shear and translate the |page| annotations. | ||
| 264 | +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_TransformAnnots(FPDF_PAGE page, | ||
| 265 | + double a, | ||
| 266 | + double b, | ||
| 267 | + double c, | ||
| 268 | + double d, | ||
| 269 | + double e, | ||
| 270 | + double f); | ||
| 271 | + | ||
| 272 | +// Create a new image object. | ||
| 273 | +// | ||
| 274 | +// document - handle to a document. | ||
| 275 | +// | ||
| 276 | +// Returns a handle to a new image object. | ||
| 277 | +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV | ||
| 278 | +FPDFPageObj_NewImageObj(FPDF_DOCUMENT document); | ||
| 279 | + | ||
| 280 | +// Experimental API. | ||
| 281 | +// Get number of content marks in |page_object|. | ||
| 282 | +// | ||
| 283 | +// page_object - handle to a page object. | ||
| 284 | +// | ||
| 285 | +// Returns the number of content marks in |page_object|, or -1 in case of | ||
| 286 | +// failure. | ||
| 287 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 288 | +FPDFPageObj_CountMarks(FPDF_PAGEOBJECT page_object); | ||
| 289 | + | ||
| 290 | +// Experimental API. | ||
| 291 | +// Get content mark in |page_object| at |index|. | ||
| 292 | +// | ||
| 293 | +// page_object - handle to a page object. | ||
| 294 | +// index - the index of a page object. | ||
| 295 | +// | ||
| 296 | +// Returns the handle to the content mark, or NULL on failure. The handle is | ||
| 297 | +// still owned by the library, and it should not be freed directly. It becomes | ||
| 298 | +// invalid if the page object is destroyed, either directly or indirectly by | ||
| 299 | +// unloading the page. | ||
| 300 | +FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV | ||
| 301 | +FPDFPageObj_GetMark(FPDF_PAGEOBJECT page_object, unsigned long index); | ||
| 302 | + | ||
| 303 | +// Experimental API. | ||
| 304 | +// Add a new content mark to a |page_object|. | ||
| 305 | +// | ||
| 306 | +// page_object - handle to a page object. | ||
| 307 | +// name - the name (tag) of the mark. | ||
| 308 | +// | ||
| 309 | +// Returns the handle to the content mark, or NULL on failure. The handle is | ||
| 310 | +// still owned by the library, and it should not be freed directly. It becomes | ||
| 311 | +// invalid if the page object is destroyed, either directly or indirectly by | ||
| 312 | +// unloading the page. | ||
| 313 | +FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV | ||
| 314 | +FPDFPageObj_AddMark(FPDF_PAGEOBJECT page_object, FPDF_BYTESTRING name); | ||
| 315 | + | ||
| 316 | +// Experimental API. | ||
| 317 | +// Removes a content |mark| from a |page_object|. | ||
| 318 | +// The mark handle will be invalid after the removal. | ||
| 319 | +// | ||
| 320 | +// page_object - handle to a page object. | ||
| 321 | +// mark - handle to a content mark in that object to remove. | ||
| 322 | +// | ||
| 323 | +// Returns TRUE if the operation succeeded, FALSE if it failed. | ||
| 324 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 325 | +FPDFPageObj_RemoveMark(FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark); | ||
| 326 | + | ||
| 327 | +// Experimental API. | ||
| 328 | +// Get the name of a content mark. | ||
| 329 | +// | ||
| 330 | +// mark - handle to a content mark. | ||
| 331 | +// buffer - buffer for holding the returned name in UTF-16LE. This is only | ||
| 332 | +// modified if |buflen| is longer than the length of the name. | ||
| 333 | +// Optional, pass null to just retrieve the size of the buffer | ||
| 334 | +// needed. | ||
| 335 | +// buflen - length of the buffer. | ||
| 336 | +// out_buflen - pointer to variable that will receive the minimum buffer size | ||
| 337 | +// to contain the name. Not filled if FALSE is returned. | ||
| 338 | +// | ||
| 339 | +// Returns TRUE if the operation succeeded, FALSE if it failed. | ||
| 340 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 341 | +FPDFPageObjMark_GetName(FPDF_PAGEOBJECTMARK mark, | ||
| 342 | + void* buffer, | ||
| 343 | + unsigned long buflen, | ||
| 344 | + unsigned long* out_buflen); | ||
| 345 | + | ||
| 346 | +// Experimental API. | ||
| 347 | +// Get the number of key/value pair parameters in |mark|. | ||
| 348 | +// | ||
| 349 | +// mark - handle to a content mark. | ||
| 350 | +// | ||
| 351 | +// Returns the number of key/value pair parameters |mark|, or -1 in case of | ||
| 352 | +// failure. | ||
| 353 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 354 | +FPDFPageObjMark_CountParams(FPDF_PAGEOBJECTMARK mark); | ||
| 355 | + | ||
| 356 | +// Experimental API. | ||
| 357 | +// Get the key of a property in a content mark. | ||
| 358 | +// | ||
| 359 | +// mark - handle to a content mark. | ||
| 360 | +// index - index of the property. | ||
| 361 | +// buffer - buffer for holding the returned key in UTF-16LE. This is only | ||
| 362 | +// modified if |buflen| is longer than the length of the key. | ||
| 363 | +// Optional, pass null to just retrieve the size of the buffer | ||
| 364 | +// needed. | ||
| 365 | +// buflen - length of the buffer. | ||
| 366 | +// out_buflen - pointer to variable that will receive the minimum buffer size | ||
| 367 | +// to contain the key. Not filled if FALSE is returned. | ||
| 368 | +// | ||
| 369 | +// Returns TRUE if the operation was successful, FALSE otherwise. | ||
| 370 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 371 | +FPDFPageObjMark_GetParamKey(FPDF_PAGEOBJECTMARK mark, | ||
| 372 | + unsigned long index, | ||
| 373 | + void* buffer, | ||
| 374 | + unsigned long buflen, | ||
| 375 | + unsigned long* out_buflen); | ||
| 376 | + | ||
| 377 | +// Experimental API. | ||
| 378 | +// Get the type of the value of a property in a content mark by key. | ||
| 379 | +// | ||
| 380 | +// mark - handle to a content mark. | ||
| 381 | +// key - string key of the property. | ||
| 382 | +// | ||
| 383 | +// Returns the type of the value, or FPDF_OBJECT_UNKNOWN in case of failure. | ||
| 384 | +FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV | ||
| 385 | +FPDFPageObjMark_GetParamValueType(FPDF_PAGEOBJECTMARK mark, | ||
| 386 | + FPDF_BYTESTRING key); | ||
| 387 | + | ||
| 388 | +// Experimental API. | ||
| 389 | +// Get the value of a number property in a content mark by key as int. | ||
| 390 | +// FPDFPageObjMark_GetParamValueType() should have returned FPDF_OBJECT_NUMBER | ||
| 391 | +// for this property. | ||
| 392 | +// | ||
| 393 | +// mark - handle to a content mark. | ||
| 394 | +// key - string key of the property. | ||
| 395 | +// out_value - pointer to variable that will receive the value. Not filled if | ||
| 396 | +// false is returned. | ||
| 397 | +// | ||
| 398 | +// Returns TRUE if the key maps to a number value, FALSE otherwise. | ||
| 399 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 400 | +FPDFPageObjMark_GetParamIntValue(FPDF_PAGEOBJECTMARK mark, | ||
| 401 | + FPDF_BYTESTRING key, | ||
| 402 | + int* out_value); | ||
| 403 | + | ||
| 404 | +// Experimental API. | ||
| 405 | +// Get the value of a string property in a content mark by key. | ||
| 406 | +// | ||
| 407 | +// mark - handle to a content mark. | ||
| 408 | +// key - string key of the property. | ||
| 409 | +// buffer - buffer for holding the returned value in UTF-16LE. This is | ||
| 410 | +// only modified if |buflen| is longer than the length of the | ||
| 411 | +// value. | ||
| 412 | +// Optional, pass null to just retrieve the size of the buffer | ||
| 413 | +// needed. | ||
| 414 | +// buflen - length of the buffer. | ||
| 415 | +// out_buflen - pointer to variable that will receive the minimum buffer size | ||
| 416 | +// to contain the value. Not filled if FALSE is returned. | ||
| 417 | +// | ||
| 418 | +// Returns TRUE if the key maps to a string/blob value, FALSE otherwise. | ||
| 419 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 420 | +FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark, | ||
| 421 | + FPDF_BYTESTRING key, | ||
| 422 | + void* buffer, | ||
| 423 | + unsigned long buflen, | ||
| 424 | + unsigned long* out_buflen); | ||
| 425 | + | ||
| 426 | +// Experimental API. | ||
| 427 | +// Get the value of a blob property in a content mark by key. | ||
| 428 | +// | ||
| 429 | +// mark - handle to a content mark. | ||
| 430 | +// key - string key of the property. | ||
| 431 | +// buffer - buffer for holding the returned value. This is only modified | ||
| 432 | +// if |buflen| is at least as long as the length of the value. | ||
| 433 | +// Optional, pass null to just retrieve the size of the buffer | ||
| 434 | +// needed. | ||
| 435 | +// buflen - length of the buffer. | ||
| 436 | +// out_buflen - pointer to variable that will receive the minimum buffer size | ||
| 437 | +// to contain the value. Not filled if FALSE is returned. | ||
| 438 | +// | ||
| 439 | +// Returns TRUE if the key maps to a string/blob value, FALSE otherwise. | ||
| 440 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 441 | +FPDFPageObjMark_GetParamBlobValue(FPDF_PAGEOBJECTMARK mark, | ||
| 442 | + FPDF_BYTESTRING key, | ||
| 443 | + void* buffer, | ||
| 444 | + unsigned long buflen, | ||
| 445 | + unsigned long* out_buflen); | ||
| 446 | + | ||
| 447 | +// Experimental API. | ||
| 448 | +// Set the value of an int property in a content mark by key. If a parameter | ||
| 449 | +// with key |key| exists, its value is set to |value|. Otherwise, it is added as | ||
| 450 | +// a new parameter. | ||
| 451 | +// | ||
| 452 | +// document - handle to the document. | ||
| 453 | +// page_object - handle to the page object with the mark. | ||
| 454 | +// mark - handle to a content mark. | ||
| 455 | +// key - string key of the property. | ||
| 456 | +// value - int value to set. | ||
| 457 | +// | ||
| 458 | +// Returns TRUE if the operation succeeded, FALSE otherwise. | ||
| 459 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 460 | +FPDFPageObjMark_SetIntParam(FPDF_DOCUMENT document, | ||
| 461 | + FPDF_PAGEOBJECT page_object, | ||
| 462 | + FPDF_PAGEOBJECTMARK mark, | ||
| 463 | + FPDF_BYTESTRING key, | ||
| 464 | + int value); | ||
| 465 | + | ||
| 466 | +// Experimental API. | ||
| 467 | +// Set the value of a string property in a content mark by key. If a parameter | ||
| 468 | +// with key |key| exists, its value is set to |value|. Otherwise, it is added as | ||
| 469 | +// a new parameter. | ||
| 470 | +// | ||
| 471 | +// document - handle to the document. | ||
| 472 | +// page_object - handle to the page object with the mark. | ||
| 473 | +// mark - handle to a content mark. | ||
| 474 | +// key - string key of the property. | ||
| 475 | +// value - string value to set. | ||
| 476 | +// | ||
| 477 | +// Returns TRUE if the operation succeeded, FALSE otherwise. | ||
| 478 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 479 | +FPDFPageObjMark_SetStringParam(FPDF_DOCUMENT document, | ||
| 480 | + FPDF_PAGEOBJECT page_object, | ||
| 481 | + FPDF_PAGEOBJECTMARK mark, | ||
| 482 | + FPDF_BYTESTRING key, | ||
| 483 | + FPDF_BYTESTRING value); | ||
| 484 | + | ||
| 485 | +// Experimental API. | ||
| 486 | +// Set the value of a blob property in a content mark by key. If a parameter | ||
| 487 | +// with key |key| exists, its value is set to |value|. Otherwise, it is added as | ||
| 488 | +// a new parameter. | ||
| 489 | +// | ||
| 490 | +// document - handle to the document. | ||
| 491 | +// page_object - handle to the page object with the mark. | ||
| 492 | +// mark - handle to a content mark. | ||
| 493 | +// key - string key of the property. | ||
| 494 | +// value - pointer to blob value to set. | ||
| 495 | +// value_len - size in bytes of |value|. | ||
| 496 | +// | ||
| 497 | +// Returns TRUE if the operation succeeded, FALSE otherwise. | ||
| 498 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 499 | +FPDFPageObjMark_SetBlobParam(FPDF_DOCUMENT document, | ||
| 500 | + FPDF_PAGEOBJECT page_object, | ||
| 501 | + FPDF_PAGEOBJECTMARK mark, | ||
| 502 | + FPDF_BYTESTRING key, | ||
| 503 | + void* value, | ||
| 504 | + unsigned long value_len); | ||
| 505 | + | ||
| 506 | +// Experimental API. | ||
| 507 | +// Removes a property from a content mark by key. | ||
| 508 | +// | ||
| 509 | +// page_object - handle to the page object with the mark. | ||
| 510 | +// mark - handle to a content mark. | ||
| 511 | +// key - string key of the property. | ||
| 512 | +// | ||
| 513 | +// Returns TRUE if the operation succeeded, FALSE otherwise. | ||
| 514 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 515 | +FPDFPageObjMark_RemoveParam(FPDF_PAGEOBJECT page_object, | ||
| 516 | + FPDF_PAGEOBJECTMARK mark, | ||
| 517 | + FPDF_BYTESTRING key); | ||
| 518 | + | ||
| 519 | +// Load an image from a JPEG image file and then set it into |image_object|. | ||
| 520 | +// | ||
| 521 | +// pages - pointer to the start of all loaded pages, may be NULL. | ||
| 522 | +// count - number of |pages|, may be 0. | ||
| 523 | +// image_object - handle to an image object. | ||
| 524 | +// file_access - file access handler which specifies the JPEG image file. | ||
| 525 | +// | ||
| 526 | +// Returns TRUE on success. | ||
| 527 | +// | ||
| 528 | +// The image object might already have an associated image, which is shared and | ||
| 529 | +// cached by the loaded pages. In that case, we need to clear the cached image | ||
| 530 | +// for all the loaded pages. Pass |pages| and page count (|count|) to this API | ||
| 531 | +// to clear the image cache. If the image is not previously shared, or NULL is a | ||
| 532 | +// valid |pages| value. | ||
| 533 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 534 | +FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, | ||
| 535 | + int count, | ||
| 536 | + FPDF_PAGEOBJECT image_object, | ||
| 537 | + FPDF_FILEACCESS* file_access); | ||
| 538 | + | ||
| 539 | +// Load an image from a JPEG image file and then set it into |image_object|. | ||
| 540 | +// | ||
| 541 | +// pages - pointer to the start of all loaded pages, may be NULL. | ||
| 542 | +// count - number of |pages|, may be 0. | ||
| 543 | +// image_object - handle to an image object. | ||
| 544 | +// file_access - file access handler which specifies the JPEG image file. | ||
| 545 | +// | ||
| 546 | +// Returns TRUE on success. | ||
| 547 | +// | ||
| 548 | +// The image object might already have an associated image, which is shared and | ||
| 549 | +// cached by the loaded pages. In that case, we need to clear the cached image | ||
| 550 | +// for all the loaded pages. Pass |pages| and page count (|count|) to this API | ||
| 551 | +// to clear the image cache. If the image is not previously shared, or NULL is a | ||
| 552 | +// valid |pages| value. This function loads the JPEG image inline, so the image | ||
| 553 | +// content is copied to the file. This allows |file_access| and its associated | ||
| 554 | +// data to be deleted after this function returns. | ||
| 555 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 556 | +FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages, | ||
| 557 | + int count, | ||
| 558 | + FPDF_PAGEOBJECT image_object, | ||
| 559 | + FPDF_FILEACCESS* file_access); | ||
| 560 | + | ||
| 561 | +// Experimental API. | ||
| 562 | +// Get the transform matrix of an image object. | ||
| 563 | +// | ||
| 564 | +// image_object - handle to an image object. | ||
| 565 | +// a - matrix value. | ||
| 566 | +// b - matrix value. | ||
| 567 | +// c - matrix value. | ||
| 568 | +// d - matrix value. | ||
| 569 | +// e - matrix value. | ||
| 570 | +// f - matrix value. | ||
| 571 | +// | ||
| 572 | +// The matrix is composed as: | ||
| 573 | +// |a c e| | ||
| 574 | +// |b d f| | ||
| 575 | +// and used to scale, rotate, shear and translate the image. | ||
| 576 | +// | ||
| 577 | +// Returns TRUE on success. | ||
| 578 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 579 | +FPDFImageObj_GetMatrix(FPDF_PAGEOBJECT image_object, | ||
| 580 | + double* a, | ||
| 581 | + double* b, | ||
| 582 | + double* c, | ||
| 583 | + double* d, | ||
| 584 | + double* e, | ||
| 585 | + double* f); | ||
| 586 | + | ||
| 587 | +// Set the transform matrix of |image_object|. | ||
| 588 | +// | ||
| 589 | +// image_object - handle to an image object. | ||
| 590 | +// a - matrix value. | ||
| 591 | +// b - matrix value. | ||
| 592 | +// c - matrix value. | ||
| 593 | +// d - matrix value. | ||
| 594 | +// e - matrix value. | ||
| 595 | +// f - matrix value. | ||
| 596 | +// | ||
| 597 | +// The matrix is composed as: | ||
| 598 | +// |a c e| | ||
| 599 | +// |b d f| | ||
| 600 | +// and can be used to scale, rotate, shear and translate the |image_object|. | ||
| 601 | +// | ||
| 602 | +// Returns TRUE on success. | ||
| 603 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 604 | +FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, | ||
| 605 | + double a, | ||
| 606 | + double b, | ||
| 607 | + double c, | ||
| 608 | + double d, | ||
| 609 | + double e, | ||
| 610 | + double f); | ||
| 611 | + | ||
| 612 | +// Set |bitmap| to |image_object|. | ||
| 613 | +// | ||
| 614 | +// pages - pointer to the start of all loaded pages, may be NULL. | ||
| 615 | +// count - number of |pages|, may be 0. | ||
| 616 | +// image_object - handle to an image object. | ||
| 617 | +// bitmap - handle of the bitmap. | ||
| 618 | +// | ||
| 619 | +// Returns TRUE on success. | ||
| 620 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 621 | +FPDFImageObj_SetBitmap(FPDF_PAGE* pages, | ||
| 622 | + int count, | ||
| 623 | + FPDF_PAGEOBJECT image_object, | ||
| 624 | + FPDF_BITMAP bitmap); | ||
| 625 | + | ||
| 626 | +// Get a bitmap rasterization of |image_object|. FPDFImageObj_GetBitmap() only | ||
| 627 | +// operates on |image_object| and does not take the associated image mask into | ||
| 628 | +// account. It also ignores the matrix for |image_object|. | ||
| 629 | +// The returned bitmap will be owned by the caller, and FPDFBitmap_Destroy() | ||
| 630 | +// must be called on the returned bitmap when it is no longer needed. | ||
| 631 | +// | ||
| 632 | +// image_object - handle to an image object. | ||
| 633 | +// | ||
| 634 | +// Returns the bitmap. | ||
| 635 | +FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV | ||
| 636 | +FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object); | ||
| 637 | + | ||
| 638 | +// Experimental API. | ||
| 639 | +// Get a bitmap rasterization of |image_object| that takes the image mask and | ||
| 640 | +// image matrix into account. To render correctly, the caller must provide the | ||
| 641 | +// |document| associated with |image_object|. If there is a |page| associated | ||
| 642 | +// with |image_object| the caller should provide that as well. | ||
| 643 | +// The returned bitmap will be owned by the caller, and FPDFBitmap_Destroy() | ||
| 644 | +// must be called on the returned bitmap when it is no longer needed. | ||
| 645 | +// | ||
| 646 | +// document - handle to a document associated with |image_object|. | ||
| 647 | +// page - handle to an optional page associated with |image_object|. | ||
| 648 | +// image_object - handle to an image object. | ||
| 649 | +// | ||
| 650 | +// Returns the bitmap. | ||
| 651 | +FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV | ||
| 652 | +FPDFImageObj_GetRenderedBitmap(FPDF_DOCUMENT document, | ||
| 653 | + FPDF_PAGE page, | ||
| 654 | + FPDF_PAGEOBJECT image_object); | ||
| 655 | + | ||
| 656 | +// Get the decoded image data of |image_object|. The decoded data is the | ||
| 657 | +// uncompressed image data, i.e. the raw image data after having all filters | ||
| 658 | +// applied. |buffer| is only modified if |buflen| is longer than the length of | ||
| 659 | +// the decoded image data. | ||
| 660 | +// | ||
| 661 | +// image_object - handle to an image object. | ||
| 662 | +// buffer - buffer for holding the decoded image data. | ||
| 663 | +// buflen - length of the buffer in bytes. | ||
| 664 | +// | ||
| 665 | +// Returns the length of the decoded image data. | ||
| 666 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 667 | +FPDFImageObj_GetImageDataDecoded(FPDF_PAGEOBJECT image_object, | ||
| 668 | + void* buffer, | ||
| 669 | + unsigned long buflen); | ||
| 670 | + | ||
| 671 | +// Get the raw image data of |image_object|. The raw data is the image data as | ||
| 672 | +// stored in the PDF without applying any filters. |buffer| is only modified if | ||
| 673 | +// |buflen| is longer than the length of the raw image data. | ||
| 674 | +// | ||
| 675 | +// image_object - handle to an image object. | ||
| 676 | +// buffer - buffer for holding the raw image data. | ||
| 677 | +// buflen - length of the buffer in bytes. | ||
| 678 | +// | ||
| 679 | +// Returns the length of the raw image data. | ||
| 680 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 681 | +FPDFImageObj_GetImageDataRaw(FPDF_PAGEOBJECT image_object, | ||
| 682 | + void* buffer, | ||
| 683 | + unsigned long buflen); | ||
| 684 | + | ||
| 685 | +// Get the number of filters (i.e. decoders) of the image in |image_object|. | ||
| 686 | +// | ||
| 687 | +// image_object - handle to an image object. | ||
| 688 | +// | ||
| 689 | +// Returns the number of |image_object|'s filters. | ||
| 690 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 691 | +FPDFImageObj_GetImageFilterCount(FPDF_PAGEOBJECT image_object); | ||
| 692 | + | ||
| 693 | +// Get the filter at |index| of |image_object|'s list of filters. Note that the | ||
| 694 | +// filters need to be applied in order, i.e. the first filter should be applied | ||
| 695 | +// first, then the second, etc. |buffer| is only modified if |buflen| is longer | ||
| 696 | +// than the length of the filter string. | ||
| 697 | +// | ||
| 698 | +// image_object - handle to an image object. | ||
| 699 | +// index - the index of the filter requested. | ||
| 700 | +// buffer - buffer for holding filter string, encoded in UTF-8. | ||
| 701 | +// buflen - length of the buffer. | ||
| 702 | +// | ||
| 703 | +// Returns the length of the filter string. | ||
| 704 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 705 | +FPDFImageObj_GetImageFilter(FPDF_PAGEOBJECT image_object, | ||
| 706 | + int index, | ||
| 707 | + void* buffer, | ||
| 708 | + unsigned long buflen); | ||
| 709 | + | ||
| 710 | +// Get the image metadata of |image_object|, including dimension, DPI, bits per | ||
| 711 | +// pixel, and colorspace. If the |image_object| is not an image object or if it | ||
| 712 | +// does not have an image, then the return value will be false. Otherwise, | ||
| 713 | +// failure to retrieve any specific parameter would result in its value being 0. | ||
| 714 | +// | ||
| 715 | +// image_object - handle to an image object. | ||
| 716 | +// page - handle to the page that |image_object| is on. Required for | ||
| 717 | +// retrieving the image's bits per pixel and colorspace. | ||
| 718 | +// metadata - receives the image metadata; must not be NULL. | ||
| 719 | +// | ||
| 720 | +// Returns true if successful. | ||
| 721 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 722 | +FPDFImageObj_GetImageMetadata(FPDF_PAGEOBJECT image_object, | ||
| 723 | + FPDF_PAGE page, | ||
| 724 | + FPDF_IMAGEOBJ_METADATA* metadata); | ||
| 725 | + | ||
| 726 | +// Create a new path object at an initial position. | ||
| 727 | +// | ||
| 728 | +// x - initial horizontal position. | ||
| 729 | +// y - initial vertical position. | ||
| 730 | +// | ||
| 731 | +// Returns a handle to a new path object. | ||
| 732 | +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewPath(float x, | ||
| 733 | + float y); | ||
| 734 | + | ||
| 735 | +// Create a closed path consisting of a rectangle. | ||
| 736 | +// | ||
| 737 | +// x - horizontal position for the left boundary of the rectangle. | ||
| 738 | +// y - vertical position for the bottom boundary of the rectangle. | ||
| 739 | +// w - width of the rectangle. | ||
| 740 | +// h - height of the rectangle. | ||
| 741 | +// | ||
| 742 | +// Returns a handle to the new path object. | ||
| 743 | +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewRect(float x, | ||
| 744 | + float y, | ||
| 745 | + float w, | ||
| 746 | + float h); | ||
| 747 | + | ||
| 748 | +// Get the bounding box of |page_object|. | ||
| 749 | +// | ||
| 750 | +// page_object - handle to a page object. | ||
| 751 | +// left - pointer where the left coordinate will be stored | ||
| 752 | +// bottom - pointer where the bottom coordinate will be stored | ||
| 753 | +// right - pointer where the right coordinate will be stored | ||
| 754 | +// top - pointer where the top coordinate will be stored | ||
| 755 | +// | ||
| 756 | +// Returns TRUE on success. | ||
| 757 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 758 | +FPDFPageObj_GetBounds(FPDF_PAGEOBJECT page_object, | ||
| 759 | + float* left, | ||
| 760 | + float* bottom, | ||
| 761 | + float* right, | ||
| 762 | + float* top); | ||
| 763 | + | ||
| 764 | +// Set the blend mode of |page_object|. | ||
| 765 | +// | ||
| 766 | +// page_object - handle to a page object. | ||
| 767 | +// blend_mode - string containing the blend mode. | ||
| 768 | +// | ||
| 769 | +// Blend mode can be one of following: Color, ColorBurn, ColorDodge, Darken, | ||
| 770 | +// Difference, Exclusion, HardLight, Hue, Lighten, Luminosity, Multiply, Normal, | ||
| 771 | +// Overlay, Saturation, Screen, SoftLight | ||
| 772 | +FPDF_EXPORT void FPDF_CALLCONV | ||
| 773 | +FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object, | ||
| 774 | + FPDF_BYTESTRING blend_mode); | ||
| 775 | + | ||
| 776 | +// Set the stroke RGBA of a page object. Range of values: 0 - 255. | ||
| 777 | +// | ||
| 778 | +// page_object - the handle to the page object. | ||
| 779 | +// R - the red component for the object's stroke color. | ||
| 780 | +// G - the green component for the object's stroke color. | ||
| 781 | +// B - the blue component for the object's stroke color. | ||
| 782 | +// A - the stroke alpha for the object. | ||
| 783 | +// | ||
| 784 | +// Returns TRUE on success. | ||
| 785 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 786 | +FPDFPageObj_SetStrokeColor(FPDF_PAGEOBJECT page_object, | ||
| 787 | + unsigned int R, | ||
| 788 | + unsigned int G, | ||
| 789 | + unsigned int B, | ||
| 790 | + unsigned int A); | ||
| 791 | + | ||
| 792 | +// Get the stroke RGBA of a page object. Range of values: 0 - 255. | ||
| 793 | +// | ||
| 794 | +// page_object - the handle to the page object. | ||
| 795 | +// R - the red component of the path stroke color. | ||
| 796 | +// G - the green component of the object's stroke color. | ||
| 797 | +// B - the blue component of the object's stroke color. | ||
| 798 | +// A - the stroke alpha of the object. | ||
| 799 | +// | ||
| 800 | +// Returns TRUE on success. | ||
| 801 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 802 | +FPDFPageObj_GetStrokeColor(FPDF_PAGEOBJECT page_object, | ||
| 803 | + unsigned int* R, | ||
| 804 | + unsigned int* G, | ||
| 805 | + unsigned int* B, | ||
| 806 | + unsigned int* A); | ||
| 807 | + | ||
| 808 | +// Set the stroke width of a page object. | ||
| 809 | +// | ||
| 810 | +// path - the handle to the page object. | ||
| 811 | +// width - the width of the stroke. | ||
| 812 | +// | ||
| 813 | +// Returns TRUE on success | ||
| 814 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 815 | +FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width); | ||
| 816 | + | ||
| 817 | +// Experimental API. | ||
| 818 | +// Get the stroke width of a page object. | ||
| 819 | +// | ||
| 820 | +// path - the handle to the page object. | ||
| 821 | +// width - the width of the stroke. | ||
| 822 | +// | ||
| 823 | +// Returns TRUE on success | ||
| 824 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 825 | +FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width); | ||
| 826 | + | ||
| 827 | +// Get the line join of |page_object|. | ||
| 828 | +// | ||
| 829 | +// page_object - handle to a page object. | ||
| 830 | +// | ||
| 831 | +// Returns the line join, or -1 on failure. | ||
| 832 | +// Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND, | ||
| 833 | +// FPDF_LINEJOIN_BEVEL | ||
| 834 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 835 | +FPDFPageObj_GetLineJoin(FPDF_PAGEOBJECT page_object); | ||
| 836 | + | ||
| 837 | +// Set the line join of |page_object|. | ||
| 838 | +// | ||
| 839 | +// page_object - handle to a page object. | ||
| 840 | +// line_join - line join | ||
| 841 | +// | ||
| 842 | +// Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND, | ||
| 843 | +// FPDF_LINEJOIN_BEVEL | ||
| 844 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 845 | +FPDFPageObj_SetLineJoin(FPDF_PAGEOBJECT page_object, int line_join); | ||
| 846 | + | ||
| 847 | +// Get the line cap of |page_object|. | ||
| 848 | +// | ||
| 849 | +// page_object - handle to a page object. | ||
| 850 | +// | ||
| 851 | +// Returns the line cap, or -1 on failure. | ||
| 852 | +// Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND, | ||
| 853 | +// FPDF_LINECAP_PROJECTING_SQUARE | ||
| 854 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 855 | +FPDFPageObj_GetLineCap(FPDF_PAGEOBJECT page_object); | ||
| 856 | + | ||
| 857 | +// Set the line cap of |page_object|. | ||
| 858 | +// | ||
| 859 | +// page_object - handle to a page object. | ||
| 860 | +// line_cap - line cap | ||
| 861 | +// | ||
| 862 | +// Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND, | ||
| 863 | +// FPDF_LINECAP_PROJECTING_SQUARE | ||
| 864 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 865 | +FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap); | ||
| 866 | + | ||
| 867 | +// Set the fill RGBA of a page object. Range of values: 0 - 255. | ||
| 868 | +// | ||
| 869 | +// page_object - the handle to the page object. | ||
| 870 | +// R - the red component for the object's fill color. | ||
| 871 | +// G - the green component for the object's fill color. | ||
| 872 | +// B - the blue component for the object's fill color. | ||
| 873 | +// A - the fill alpha for the object. | ||
| 874 | +// | ||
| 875 | +// Returns TRUE on success. | ||
| 876 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 877 | +FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object, | ||
| 878 | + unsigned int R, | ||
| 879 | + unsigned int G, | ||
| 880 | + unsigned int B, | ||
| 881 | + unsigned int A); | ||
| 882 | + | ||
| 883 | +// Get the fill RGBA of a page object. Range of values: 0 - 255. | ||
| 884 | +// | ||
| 885 | +// page_object - the handle to the page object. | ||
| 886 | +// R - the red component of the object's fill color. | ||
| 887 | +// G - the green component of the object's fill color. | ||
| 888 | +// B - the blue component of the object's fill color. | ||
| 889 | +// A - the fill alpha of the object. | ||
| 890 | +// | ||
| 891 | +// Returns TRUE on success. | ||
| 892 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 893 | +FPDFPageObj_GetFillColor(FPDF_PAGEOBJECT page_object, | ||
| 894 | + unsigned int* R, | ||
| 895 | + unsigned int* G, | ||
| 896 | + unsigned int* B, | ||
| 897 | + unsigned int* A); | ||
| 898 | + | ||
| 899 | +// Experimental API. | ||
| 900 | +// Get number of segments inside |path|. | ||
| 901 | +// | ||
| 902 | +// path - handle to a path. | ||
| 903 | +// | ||
| 904 | +// A segment is a command, created by e.g. FPDFPath_MoveTo(), | ||
| 905 | +// FPDFPath_LineTo() or FPDFPath_BezierTo(). | ||
| 906 | +// | ||
| 907 | +// Returns the number of objects in |path| or -1 on failure. | ||
| 908 | +FPDF_EXPORT int FPDF_CALLCONV FPDFPath_CountSegments(FPDF_PAGEOBJECT path); | ||
| 909 | + | ||
| 910 | +// Experimental API. | ||
| 911 | +// Get segment in |path| at |index|. | ||
| 912 | +// | ||
| 913 | +// path - handle to a path. | ||
| 914 | +// index - the index of a segment. | ||
| 915 | +// | ||
| 916 | +// Returns the handle to the segment, or NULL on faiure. | ||
| 917 | +FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV | ||
| 918 | +FPDFPath_GetPathSegment(FPDF_PAGEOBJECT path, int index); | ||
| 919 | + | ||
| 920 | +// Experimental API. | ||
| 921 | +// Get coordinates of |segment|. | ||
| 922 | +// | ||
| 923 | +// segment - handle to a segment. | ||
| 924 | +// x - the horizontal position of the segment. | ||
| 925 | +// y - the vertical position of the segment. | ||
| 926 | +// | ||
| 927 | +// Returns TRUE on success, otherwise |x| and |y| is not set. | ||
| 928 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 929 | +FPDFPathSegment_GetPoint(FPDF_PATHSEGMENT segment, float* x, float* y); | ||
| 930 | + | ||
| 931 | +// Experimental API. | ||
| 932 | +// Get type of |segment|. | ||
| 933 | +// | ||
| 934 | +// segment - handle to a segment. | ||
| 935 | +// | ||
| 936 | +// Returns one of the FPDF_SEGMENT_* values on success, | ||
| 937 | +// FPDF_SEGMENT_UNKNOWN on error. | ||
| 938 | +FPDF_EXPORT int FPDF_CALLCONV FPDFPathSegment_GetType(FPDF_PATHSEGMENT segment); | ||
| 939 | + | ||
| 940 | +// Experimental API. | ||
| 941 | +// Gets if the |segment| closes the current subpath of a given path. | ||
| 942 | +// | ||
| 943 | +// segment - handle to a segment. | ||
| 944 | +// | ||
| 945 | +// Returns close flag for non-NULL segment, FALSE otherwise. | ||
| 946 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 947 | +FPDFPathSegment_GetClose(FPDF_PATHSEGMENT segment); | ||
| 948 | + | ||
| 949 | +// Move a path's current point. | ||
| 950 | +// | ||
| 951 | +// path - the handle to the path object. | ||
| 952 | +// x - the horizontal position of the new current point. | ||
| 953 | +// y - the vertical position of the new current point. | ||
| 954 | +// | ||
| 955 | +// Note that no line will be created between the previous current point and the | ||
| 956 | +// new one. | ||
| 957 | +// | ||
| 958 | +// Returns TRUE on success | ||
| 959 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_MoveTo(FPDF_PAGEOBJECT path, | ||
| 960 | + float x, | ||
| 961 | + float y); | ||
| 962 | + | ||
| 963 | +// Add a line between the current point and a new point in the path. | ||
| 964 | +// | ||
| 965 | +// path - the handle to the path object. | ||
| 966 | +// x - the horizontal position of the new point. | ||
| 967 | +// y - the vertical position of the new point. | ||
| 968 | +// | ||
| 969 | +// The path's current point is changed to (x, y). | ||
| 970 | +// | ||
| 971 | +// Returns TRUE on success | ||
| 972 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_LineTo(FPDF_PAGEOBJECT path, | ||
| 973 | + float x, | ||
| 974 | + float y); | ||
| 975 | + | ||
| 976 | +// Add a cubic Bezier curve to the given path, starting at the current point. | ||
| 977 | +// | ||
| 978 | +// path - the handle to the path object. | ||
| 979 | +// x1 - the horizontal position of the first Bezier control point. | ||
| 980 | +// y1 - the vertical position of the first Bezier control point. | ||
| 981 | +// x2 - the horizontal position of the second Bezier control point. | ||
| 982 | +// y2 - the vertical position of the second Bezier control point. | ||
| 983 | +// x3 - the horizontal position of the ending point of the Bezier curve. | ||
| 984 | +// y3 - the vertical position of the ending point of the Bezier curve. | ||
| 985 | +// | ||
| 986 | +// Returns TRUE on success | ||
| 987 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_BezierTo(FPDF_PAGEOBJECT path, | ||
| 988 | + float x1, | ||
| 989 | + float y1, | ||
| 990 | + float x2, | ||
| 991 | + float y2, | ||
| 992 | + float x3, | ||
| 993 | + float y3); | ||
| 994 | + | ||
| 995 | +// Close the current subpath of a given path. | ||
| 996 | +// | ||
| 997 | +// path - the handle to the path object. | ||
| 998 | +// | ||
| 999 | +// This will add a line between the current point and the initial point of the | ||
| 1000 | +// subpath, thus terminating the current subpath. | ||
| 1001 | +// | ||
| 1002 | +// Returns TRUE on success | ||
| 1003 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_Close(FPDF_PAGEOBJECT path); | ||
| 1004 | + | ||
| 1005 | +// Set the drawing mode of a path. | ||
| 1006 | +// | ||
| 1007 | +// path - the handle to the path object. | ||
| 1008 | +// fillmode - the filling mode to be set: one of the FPDF_FILLMODE_* flags. | ||
| 1009 | +// stroke - a boolean specifying if the path should be stroked or not. | ||
| 1010 | +// | ||
| 1011 | +// Returns TRUE on success | ||
| 1012 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path, | ||
| 1013 | + int fillmode, | ||
| 1014 | + FPDF_BOOL stroke); | ||
| 1015 | + | ||
| 1016 | +// Experimental API. | ||
| 1017 | +// Get the drawing mode of a path. | ||
| 1018 | +// | ||
| 1019 | +// path - the handle to the path object. | ||
| 1020 | +// fillmode - the filling mode of the path: one of the FPDF_FILLMODE_* flags. | ||
| 1021 | +// stroke - a boolean specifying if the path is stroked or not. | ||
| 1022 | +// | ||
| 1023 | +// Returns TRUE on success | ||
| 1024 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path, | ||
| 1025 | + int* fillmode, | ||
| 1026 | + FPDF_BOOL* stroke); | ||
| 1027 | + | ||
| 1028 | +// Experimental API. | ||
| 1029 | +// Get the transform matrix of a path. | ||
| 1030 | +// | ||
| 1031 | +// path - handle to a path. | ||
| 1032 | +// matrix - pointer to struct to receive the matrix value. | ||
| 1033 | +// | ||
| 1034 | +// The matrix is composed as: | ||
| 1035 | +// |a c e| | ||
| 1036 | +// |b d f| | ||
| 1037 | +// and used to scale, rotate, shear and translate the path. | ||
| 1038 | +// | ||
| 1039 | +// Returns TRUE on success. | ||
| 1040 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetMatrix(FPDF_PAGEOBJECT path, | ||
| 1041 | + FS_MATRIX* matrix); | ||
| 1042 | + | ||
| 1043 | +// Experimental API. | ||
| 1044 | +// Set the transform matrix of a path. | ||
| 1045 | +// | ||
| 1046 | +// path - handle to a path. | ||
| 1047 | +// matrix - pointer to struct with the matrix value. | ||
| 1048 | +// | ||
| 1049 | +// The matrix is composed as: | ||
| 1050 | +// |a c e| | ||
| 1051 | +// |b d f| | ||
| 1052 | +// and can be used to scale, rotate, shear and translate the path. | ||
| 1053 | +// | ||
| 1054 | +// Returns TRUE on success. | ||
| 1055 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetMatrix(FPDF_PAGEOBJECT path, | ||
| 1056 | + const FS_MATRIX* matrix); | ||
| 1057 | + | ||
| 1058 | +// Create a new text object using one of the standard PDF fonts. | ||
| 1059 | +// | ||
| 1060 | +// document - handle to the document. | ||
| 1061 | +// font - string containing the font name, without spaces. | ||
| 1062 | +// font_size - the font size for the new text object. | ||
| 1063 | +// | ||
| 1064 | +// Returns a handle to a new text object, or NULL on failure | ||
| 1065 | +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV | ||
| 1066 | +FPDFPageObj_NewTextObj(FPDF_DOCUMENT document, | ||
| 1067 | + FPDF_BYTESTRING font, | ||
| 1068 | + float font_size); | ||
| 1069 | + | ||
| 1070 | +// Set the text for a textobject. If it had text, it will be replaced. | ||
| 1071 | +// | ||
| 1072 | +// text_object - handle to the text object. | ||
| 1073 | +// text - the UTF-16LE encoded string containing the text to be added. | ||
| 1074 | +// | ||
| 1075 | +// Returns TRUE on success | ||
| 1076 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 1077 | +FPDFText_SetText(FPDF_PAGEOBJECT text_object, FPDF_WIDESTRING text); | ||
| 1078 | + | ||
| 1079 | +// Returns a font object loaded from a stream of data. The font is loaded | ||
| 1080 | +// into the document. | ||
| 1081 | +// | ||
| 1082 | +// document - handle to the document. | ||
| 1083 | +// data - the stream of data, which will be copied by the font object. | ||
| 1084 | +// size - size of the stream, in bytes. | ||
| 1085 | +// font_type - FPDF_FONT_TYPE1 or FPDF_FONT_TRUETYPE depending on the font | ||
| 1086 | +// type. | ||
| 1087 | +// cid - a boolean specifying if the font is a CID font or not. | ||
| 1088 | +// | ||
| 1089 | +// The loaded font can be closed using FPDFFont_Close. | ||
| 1090 | +// | ||
| 1091 | +// Returns NULL on failure | ||
| 1092 | +FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFText_LoadFont(FPDF_DOCUMENT document, | ||
| 1093 | + const uint8_t* data, | ||
| 1094 | + uint32_t size, | ||
| 1095 | + int font_type, | ||
| 1096 | + FPDF_BOOL cid); | ||
| 1097 | + | ||
| 1098 | +// Experimental API. | ||
| 1099 | +// Loads one of the standard 14 fonts per PDF spec 1.7 page 416. The preferred | ||
| 1100 | +// way of using font style is using a dash to separate the name from the style, | ||
| 1101 | +// for example 'Helvetica-BoldItalic'. | ||
| 1102 | +// | ||
| 1103 | +// document - handle to the document. | ||
| 1104 | +// font - string containing the font name, without spaces. | ||
| 1105 | +// | ||
| 1106 | +// The loaded font can be closed using FPDFFont_Close. | ||
| 1107 | +// | ||
| 1108 | +// Returns NULL on failure. | ||
| 1109 | +FPDF_EXPORT FPDF_FONT FPDF_CALLCONV | ||
| 1110 | +FPDFText_LoadStandardFont(FPDF_DOCUMENT document, FPDF_BYTESTRING font); | ||
| 1111 | + | ||
| 1112 | +// Experimental API. | ||
| 1113 | +// Get the transform matrix of a text object. | ||
| 1114 | +// | ||
| 1115 | +// text - handle to a text. | ||
| 1116 | +// matrix - pointer to struct with the matrix value. | ||
| 1117 | +// | ||
| 1118 | +// The matrix is composed as: | ||
| 1119 | +// |a c e| | ||
| 1120 | +// |b d f| | ||
| 1121 | +// and used to scale, rotate, shear and translate the text. | ||
| 1122 | +// | ||
| 1123 | +// Returns TRUE on success. | ||
| 1124 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text, | ||
| 1125 | + FS_MATRIX* matrix); | ||
| 1126 | + | ||
| 1127 | +// Experimental API. | ||
| 1128 | +// Get the font size of a text object. | ||
| 1129 | +// | ||
| 1130 | +// text - handle to a text. | ||
| 1131 | +// | ||
| 1132 | +// Returns the font size of the text object, measured in points (about 1/72 | ||
| 1133 | +// inch) on success; 0 on failure. | ||
| 1134 | +FPDF_EXPORT float FPDF_CALLCONV FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text); | ||
| 1135 | + | ||
| 1136 | +// Close a loaded PDF font. | ||
| 1137 | +// | ||
| 1138 | +// font - Handle to the loaded font. | ||
| 1139 | +FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font); | ||
| 1140 | + | ||
| 1141 | +// Create a new text object using a loaded font. | ||
| 1142 | +// | ||
| 1143 | +// document - handle to the document. | ||
| 1144 | +// font - handle to the font object. | ||
| 1145 | +// font_size - the font size for the new text object. | ||
| 1146 | +// | ||
| 1147 | +// Returns a handle to a new text object, or NULL on failure | ||
| 1148 | +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV | ||
| 1149 | +FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document, | ||
| 1150 | + FPDF_FONT font, | ||
| 1151 | + float font_size); | ||
| 1152 | + | ||
| 1153 | +// Experimental API. | ||
| 1154 | +// Get the text rendering mode of a text object. | ||
| 1155 | +// | ||
| 1156 | +// text - the handle to the text object. | ||
| 1157 | +// | ||
| 1158 | +// Returns one of the known FPDF_TEXT_RENDERMODE enum values on success, | ||
| 1159 | +// FPDF_TEXTRENDERMODE_UNKNOWN on error. | ||
| 1160 | +FPDF_EXPORT FPDF_TEXT_RENDERMODE FPDF_CALLCONV | ||
| 1161 | +FPDFTextObj_GetTextRenderMode(FPDF_PAGEOBJECT text); | ||
| 1162 | + | ||
| 1163 | +// Experimental API. | ||
| 1164 | +// Set the text rendering mode of a text object. | ||
| 1165 | +// | ||
| 1166 | +// text - the handle to the text object. | ||
| 1167 | +// render_mode - the FPDF_TEXT_RENDERMODE enum value to be set (cannot set to | ||
| 1168 | +// FPDF_TEXTRENDERMODE_UNKNOWN). | ||
| 1169 | +// | ||
| 1170 | +// Returns TRUE on success. | ||
| 1171 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 1172 | +FPDFTextObj_SetTextRenderMode(FPDF_PAGEOBJECT text, | ||
| 1173 | + FPDF_TEXT_RENDERMODE render_mode); | ||
| 1174 | + | ||
| 1175 | +// Experimental API. | ||
| 1176 | +// Get the font name of a text object. | ||
| 1177 | +// | ||
| 1178 | +// text - the handle to the text object. | ||
| 1179 | +// buffer - the address of a buffer that receives the font name. | ||
| 1180 | +// length - the size, in bytes, of |buffer|. | ||
| 1181 | +// | ||
| 1182 | +// Returns the number of bytes in the font name (including the trailing NUL | ||
| 1183 | +// character) on success, 0 on error. | ||
| 1184 | +// | ||
| 1185 | +// Regardless of the platform, the |buffer| is always in UTF-8 encoding. | ||
| 1186 | +// If |length| is less than the returned length, or |buffer| is NULL, |buffer| | ||
| 1187 | +// will not be modified. | ||
| 1188 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 1189 | +FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text, | ||
| 1190 | + void* buffer, | ||
| 1191 | + unsigned long length); | ||
| 1192 | + | ||
| 1193 | +// Experimental API. | ||
| 1194 | +// Get the text of a text object. | ||
| 1195 | +// | ||
| 1196 | +// text_object - the handle to the text object. | ||
| 1197 | +// text_page - the handle to the text page. | ||
| 1198 | +// buffer - the address of a buffer that receives the text. | ||
| 1199 | +// length - the size, in bytes, of |buffer|. | ||
| 1200 | +// | ||
| 1201 | +// Returns the number of bytes in the text (including the trailing NUL | ||
| 1202 | +// character) on success, 0 on error. | ||
| 1203 | +// | ||
| 1204 | +// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. | ||
| 1205 | +// If |length| is less than the returned length, or |buffer| is NULL, |buffer| | ||
| 1206 | +// will not be modified. | ||
| 1207 | +FPDF_EXPORT unsigned long FPDF_CALLCONV | ||
| 1208 | +FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object, | ||
| 1209 | + FPDF_TEXTPAGE text_page, | ||
| 1210 | + void* buffer, | ||
| 1211 | + unsigned long length); | ||
| 1212 | + | ||
| 1213 | +// Experimental API. | ||
| 1214 | +// Get number of page objects inside |form_object|. | ||
| 1215 | +// | ||
| 1216 | +// form_object - handle to a form object. | ||
| 1217 | +// | ||
| 1218 | +// Returns the number of objects in |form_object| on success, -1 on error. | ||
| 1219 | +FPDF_EXPORT int FPDF_CALLCONV | ||
| 1220 | +FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object); | ||
| 1221 | + | ||
| 1222 | +// Experimental API. | ||
| 1223 | +// Get page object in |form_object| at |index|. | ||
| 1224 | +// | ||
| 1225 | +// form_object - handle to a form object. | ||
| 1226 | +// index - the 0-based index of a page object. | ||
| 1227 | +// | ||
| 1228 | +// Returns the handle to the page object, or NULL on error. | ||
| 1229 | +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV | ||
| 1230 | +FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index); | ||
| 1231 | + | ||
| 1232 | +// Experimental API. | ||
| 1233 | +// Get the transform matrix of a form object. | ||
| 1234 | +// | ||
| 1235 | +// form_object - handle to a form. | ||
| 1236 | +// matrix - pointer to struct to receive the matrix value. | ||
| 1237 | +// | ||
| 1238 | +// The matrix is composed as: | ||
| 1239 | +// |a c e| | ||
| 1240 | +// |b d f| | ||
| 1241 | +// and used to scale, rotate, shear and translate the form object. | ||
| 1242 | +// | ||
| 1243 | +// Returns TRUE on success. | ||
| 1244 | +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV | ||
| 1245 | +FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object, FS_MATRIX* matrix); | ||
| 1246 | + | ||
| 1247 | +#ifdef __cplusplus | ||
| 1248 | +} // extern "C" | ||
| 1249 | +#endif // __cplusplus | ||
| 1250 | + | ||
| 1251 | +#endif // PUBLIC_FPDF_EDIT_H_ |
printing/windows/pdfium/include/fpdf_ext.h
0 → 100644
| 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 <time.h> | ||
| 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_ |
| 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_ |
-
Please register or login to post a comment