@reekon-tools/react-native-pdf-canvas 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +57 -0
- package/PdfCanvas.podspec +77 -40
- package/README.md +218 -1316
- package/android/build.gradle +67 -54
- package/android/consumer-rules.pro +7 -0
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasNativeTest.java +254 -0
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/TestPdfs.java +60 -468
- package/android/src/main/cpp/CMakeLists.txt +54 -0
- package/android/src/main/cpp/pdfcanvas-jni.cpp +262 -0
- package/android/src/main/java/tools/reekon/pdfcanvas/PdfCanvasNative.java +167 -0
- package/android/src/main/java/tools/reekon/pdfcanvas/PdfErrorCode.java +14 -4
- package/android/src/main/java/tools/reekon/pdfcanvas/PdfRasterException.java +10 -4
- package/android/src/reactnative/java/tools/reekon/pdfcanvas/rn/PdfCanvasModule.java +160 -376
- package/android/tools/compile-gate.sh +81 -101
- package/dist/controller.d.ts +14 -0
- package/dist/controller.js +4 -3
- package/dist/rasterizer/index.native.d.ts +8 -12
- package/dist/rasterizer/index.native.js +15 -21
- package/dist/rasterizer/native-bridge.d.ts +51 -75
- package/dist/rasterizer/native-bridge.js +49 -33
- package/dist/rasterizer/native.d.ts +45 -0
- package/dist/rasterizer/native.js +123 -0
- package/dist/react/usePdfDocument.d.ts +5 -5
- package/dist/react/usePdfLayer.d.ts +10 -1
- package/dist/react/usePdfLayer.js +10 -2
- package/dist/testing/scenes.d.ts +3 -3
- package/dist/testing/scenes.js +4 -4
- package/dist/types.d.ts +36 -42
- package/ios/Sources/PdfCanvasBridge/PdfCanvasModule.mm +234 -536
- package/native/.clangd +5 -0
- package/native/CMakeLists.txt +89 -0
- package/native/core/include/pdfcanvas/document.h +90 -0
- package/native/core/include/pdfcanvas/error.h +47 -0
- package/native/core/include/pdfcanvas/jsi.h +18 -0
- package/native/core/include/pdfcanvas/jsi_config.h +30 -0
- package/native/core/include/pdfcanvas/library.h +28 -0
- package/native/core/include/pdfcanvas/pixels.h +92 -0
- package/native/core/include/pdfcanvas/service.h +87 -0
- package/native/core/include/pdfcanvas/slots.h +113 -0
- package/native/core/include/pdfcanvas/types.h +110 -0
- package/native/core/pdfcanvas-core.cmake +22 -0
- package/native/core/src/document.cpp +516 -0
- package/native/core/src/error.cpp +29 -0
- package/native/core/src/jsi.cpp +66 -0
- package/native/core/src/library.cpp +52 -0
- package/native/core/src/pixels.cpp +45 -0
- package/native/core/src/service.cpp +156 -0
- package/native/core/src/slots.cpp +139 -0
- package/native/tests/fixtures.cpp +451 -0
- package/native/tests/fixtures.h +96 -0
- package/native/tests/harness.h +122 -0
- package/native/tests/main.cpp +64 -0
- package/native/tests/pixels_util.h +126 -0
- package/native/tests/test_document.cpp +485 -0
- package/native/tests/test_service.cpp +130 -0
- package/native/tests/test_slots.cpp +250 -0
- package/package.json +27 -7
- package/react-native.config.js +5 -2
- package/scripts/fetch-pdfium.mjs +559 -0
- package/scripts/pdfium-manifest.json +48 -0
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasCancellationTest.java +0 -226
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasConcurrencyTest.java +0 -239
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasDeviceTimingTest.java +0 -251
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasFailureTest.java +0 -221
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasJsiTransportTest.java +0 -783
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasPhaseTimingTest.java +0 -1388
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasPoisonGuardTest.java +0 -98
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasQuirksTest.java +0 -324
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PdfCanvasRasterizerTest.java +0 -775
- package/android/src/androidTest/java/tools/reekon/pdfcanvas/PoisonsTheProcess.java +0 -20
- package/android/src/jsi/cpp/CMakeLists.txt +0 -33
- package/android/src/jsi/cpp/pdfcanvas-jsi.cpp +0 -469
- package/android/src/jsi/java/tools/reekon/pdfcanvas/jsi/PdfCanvasPixelBridge.java +0 -140
- package/android/src/main/java/tools/reekon/pdfcanvas/PageGeometry.java +0 -45
- package/android/src/main/java/tools/reekon/pdfcanvas/PdfCanvasRasterizer.java +0 -564
- package/android/src/main/java/tools/reekon/pdfcanvas/PdfPlatformQuirks.java +0 -277
- package/android/src/main/java/tools/reekon/pdfcanvas/PdfPreflight.java +0 -214
- package/android/src/main/java/tools/reekon/pdfcanvas/PdfRendererPool.java +0 -234
- package/android/src/main/java/tools/reekon/pdfcanvas/RasterCancellation.java +0 -47
- package/android/src/main/java/tools/reekon/pdfcanvas/RasterPixels.java +0 -143
- package/android/src/main/java/tools/reekon/pdfcanvas/RasterRequest.java +0 -95
- package/dist/rasterizer/android.d.ts +0 -121
- package/dist/rasterizer/android.js +0 -126
- package/dist/rasterizer/ios.d.ts +0 -84
- package/dist/rasterizer/ios.js +0 -155
- package/ios/Package.swift +0 -58
- package/ios/Sources/PdfCanvasCore/PdfCanvasCancellation.m +0 -38
- package/ios/Sources/PdfCanvasCore/PdfCanvasDocumentPool.m +0 -389
- package/ios/Sources/PdfCanvasCore/PdfCanvasErrorCode.m +0 -57
- package/ios/Sources/PdfCanvasCore/PdfCanvasPageGeometry.m +0 -44
- package/ios/Sources/PdfCanvasCore/PdfCanvasPageTransform.m +0 -82
- package/ios/Sources/PdfCanvasCore/PdfCanvasPixelSink.m +0 -37
- package/ios/Sources/PdfCanvasCore/PdfCanvasPreflight.m +0 -158
- package/ios/Sources/PdfCanvasCore/PdfCanvasRasterPixels.m +0 -80
- package/ios/Sources/PdfCanvasCore/PdfCanvasRasterRequest.m +0 -65
- package/ios/Sources/PdfCanvasCore/PdfCanvasRasterizer.m +0 -548
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasCancellation.h +0 -48
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasCore.h +0 -26
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasDocumentPool.h +0 -122
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasErrorCode.h +0 -80
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasPageGeometry.h +0 -79
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasPageTransform.h +0 -129
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasPixelSink.h +0 -100
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasPreflight.h +0 -65
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasRasterPixels.h +0 -111
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasRasterRequest.h +0 -85
- package/ios/Sources/PdfCanvasCore/include/PdfCanvasRasterizer.h +0 -163
- package/ios/Sources/PdfCanvasSlots/PdfCanvasSlots.mm +0 -297
- package/ios/Sources/PdfCanvasSlots/include/PdfCanvasSlots.h +0 -140
- package/ios/Tests/PdfCanvasCoreTests/ConcurrencyTests.swift +0 -358
- package/ios/Tests/PdfCanvasCoreTests/FailureTests.swift +0 -262
- package/ios/Tests/PdfCanvasCoreTests/GeometryTests.swift +0 -173
- package/ios/Tests/PdfCanvasCoreTests/PreviewTests.swift +0 -114
- package/ios/Tests/PdfCanvasCoreTests/RasterAssertions.swift +0 -158
- package/ios/Tests/PdfCanvasCoreTests/RasterizerTests.swift +0 -544
- package/ios/Tests/PdfCanvasCoreTests/SinkTests.swift +0 -287
- package/ios/Tests/PdfCanvasCoreTests/SlotsTests.swift +0 -396
- package/ios/Tests/PdfCanvasCoreTests/TestPdfs.swift +0 -639
- package/ios/Tests/PdfCanvasCoreTests/TimingTests.swift +0 -179
- package/ios/Tests/PdfCanvasCoreTests/TransformTests.swift +0 -283
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 REEKON Tools
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@reekon-tools/react-native-pdf-canvas
|
|
2
|
+
Copyright 2026 REEKON Tools
|
|
3
|
+
|
|
4
|
+
This product includes software developed by REEKON Tools (https://reekon.tools).
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0. See the LICENSE file for terms.
|
|
7
|
+
|
|
8
|
+
--------------------------------------------------------------------------------
|
|
9
|
+
THIRD-PARTY COMPONENTS
|
|
10
|
+
--------------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
This package contains no third-party source code. It does, however, build
|
|
13
|
+
against PDFium, which it downloads at build time rather than vendoring — so an
|
|
14
|
+
application that ships this package also ships PDFium and inherits the
|
|
15
|
+
attribution obligations below. Reproduce them in your application's
|
|
16
|
+
third-party-notices screen.
|
|
17
|
+
|
|
18
|
+
PDFium
|
|
19
|
+
Copyright 2014 PDFium Authors. Copyright 2014 Google Inc.
|
|
20
|
+
Licensed under the 3-Clause BSD License.
|
|
21
|
+
https://pdfium.googlesource.com/pdfium/
|
|
22
|
+
|
|
23
|
+
PDFium bundles the following components, whose license texts are shipped in
|
|
24
|
+
the `licenses/` directory of every prebuilt PDFium archive this package
|
|
25
|
+
fetches (see `scripts/pdfium-manifest.json` for the pinned release):
|
|
26
|
+
|
|
27
|
+
Abseil Apache License 2.0
|
|
28
|
+
Anti-Grain Geometry 2.3 Permissive (AGG 2.3 license)
|
|
29
|
+
FreeType FreeType License (FTL) — requires credit in
|
|
30
|
+
documentation for any product using FreeType
|
|
31
|
+
ICU Unicode License
|
|
32
|
+
Little CMS (lcms2) MIT License
|
|
33
|
+
fast_float Apache License 2.0 / MIT / BSL-1.0
|
|
34
|
+
libjpeg-turbo IJG License / 3-Clause BSD
|
|
35
|
+
libpng PNG Reference Library License
|
|
36
|
+
llvm-libc Apache License 2.0 with LLVM Exception
|
|
37
|
+
OpenJPEG 2-Clause BSD License
|
|
38
|
+
simdutf Apache License 2.0 / MIT
|
|
39
|
+
zlib zlib License
|
|
40
|
+
|
|
41
|
+
pdfium-binaries (the prebuilt PDFium archives, and the build scripts that
|
|
42
|
+
produce them)
|
|
43
|
+
Copyright 2014-2025 Benoit Blanchon
|
|
44
|
+
Licensed under the MIT License.
|
|
45
|
+
https://github.com/bblanchon/pdfium-binaries
|
|
46
|
+
|
|
47
|
+
@embedpdf/pdfium (web backend only, an optional peer dependency — resolved only
|
|
48
|
+
by hosts that use the `./worker` subpath)
|
|
49
|
+
Copyright (c) 2024 CloudPDF, Ji Chang
|
|
50
|
+
Licensed under the MIT License.
|
|
51
|
+
https://github.com/embedpdf/embed-pdf-viewer
|
|
52
|
+
|
|
53
|
+
--------------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
@shopify/react-native-skia, react, react-native and react-native-reanimated are
|
|
56
|
+
peer dependencies. They are neither bundled nor redistributed by this package,
|
|
57
|
+
so their notices are your application's to carry on its own account.
|
package/PdfCanvas.podspec
CHANGED
|
@@ -1,77 +1,114 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
pdfium = JSON.parse(File.read(File.join(__dir__, "scripts", "pdfium-manifest.json")))
|
|
5
|
+
|
|
6
|
+
# FETCH PDFIUM WHILE THE PODSPEC IS EVALUATED.
|
|
7
|
+
#
|
|
8
|
+
# `prepare_command` looks like the hook for this and is not: CocoaPods skips it
|
|
9
|
+
# for a `:path` pod, which is exactly what React Native autolinking makes this
|
|
10
|
+
# one. The only code that runs on every `pod install` (and on every `pod ipc
|
|
11
|
+
# spec` autolinking performs to read the spec) is the spec file itself, so the
|
|
12
|
+
# fetch happens here. It is idempotent — a stamp file makes a repeat run a stat
|
|
13
|
+
# and a node start-up — and it verifies every download against the SHA-256 in
|
|
14
|
+
# scripts/pdfium-manifest.json before extracting a byte. Assembling the
|
|
15
|
+
# xcframework needs lipo / install_name_tool / xcodebuild, which exist wherever
|
|
16
|
+
# `pod install` does.
|
|
17
|
+
#
|
|
18
|
+
# Offline builds: point PDFCANVAS_PDFIUM_CACHE at a folder of the pre-downloaded
|
|
19
|
+
# .tgz files, or PDFCANVAS_PDFIUM_MIRROR at an internal copy of the release URL
|
|
20
|
+
# layout. See scripts/fetch-pdfium.mjs.
|
|
21
|
+
node = ENV["PDFCANVAS_NODE"] || "node"
|
|
22
|
+
fetched = system(node, File.join(__dir__, "scripts", "fetch-pdfium.mjs"), "ios")
|
|
23
|
+
unless fetched
|
|
24
|
+
raise "[PdfCanvas] Could not fetch the pinned PDFium build for iOS. " \
|
|
25
|
+
"Run `node scripts/fetch-pdfium.mjs ios` in #{__dir__} to see why."
|
|
26
|
+
end
|
|
4
27
|
|
|
5
28
|
# The pod is named `PdfCanvas`, matching the JS-side native module name, so
|
|
6
29
|
# `NativeModules.PdfCanvas`, `RCT_EXPORT_MODULE(PdfCanvas)`, the Android
|
|
7
30
|
# `PdfCanvasModule.NAME` and the line in `Podfile.lock` are all the same word. A
|
|
8
31
|
# `pod install` that does not print it means autolinking never saw this file — see
|
|
9
|
-
# `react-native.config.js`, which names it explicitly
|
|
10
|
-
# Android entry names its `packageImportPath`.
|
|
32
|
+
# `react-native.config.js`, which names it explicitly.
|
|
11
33
|
Pod::Spec.new do |s|
|
|
12
34
|
s.name = "PdfCanvas"
|
|
13
35
|
s.version = package["version"]
|
|
14
36
|
s.summary = package["description"]
|
|
15
37
|
s.description = <<-DESC
|
|
16
38
|
The iOS rasterizer for @reekon-tools/react-native-pdf-canvas: PDF pages as
|
|
17
|
-
RGBA bytes at exact doc-space rects,
|
|
18
|
-
|
|
39
|
+
RGBA bytes at exact doc-space rects, rendered by PDFium — the same engine and
|
|
40
|
+
the same pinned release as the Android and web backends.
|
|
19
41
|
DESC
|
|
20
42
|
s.homepage = "https://gitlab.com/reekon-tools/software/rock-pro/react-native-pdf-canvas"
|
|
21
|
-
|
|
43
|
+
# READ FROM package.json, never restated. A hardcoded type here silently
|
|
44
|
+
# outlived the relicense from MIT and told CocoaPods the wrong thing while
|
|
45
|
+
# `package.json` said Apache-2.0 — and this is the copy an iOS consumer's
|
|
46
|
+
# acknowledgements screen is generated from, so the two must not drift.
|
|
47
|
+
# `:file` is resolved against the pod root, which for the `:path` pod that
|
|
48
|
+
# autolinking creates is the installed package directory; LICENSE ships in
|
|
49
|
+
# `package.json#files` precisely so it is there.
|
|
50
|
+
s.license = { :type => package["license"], :file => "LICENSE" }
|
|
22
51
|
s.authors = { "REEKON Tools" => "hello@reekon.tools" }
|
|
23
52
|
s.source = { :git => "https://gitlab.com/reekon-tools/software/rock-pro/react-native-pdf-canvas.git", :tag => "#{s.version}" }
|
|
24
53
|
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
|
|
54
|
+
# THE FLOOR IS THE ENGINE'S, NOT OURS. Nothing this pod compiles needs anything
|
|
55
|
+
# newer than iOS 13, but the vendored PDFium dylib is built for whatever
|
|
56
|
+
# `ios_deployment_target` bblanchon used (17.0 since 2026-08-14), and that is
|
|
57
|
+
# what dyld enforces on the device and what App Store processing checks
|
|
58
|
+
# against the framework's Info.plist (ITMS-90208). The value is declared once
|
|
59
|
+
# in scripts/pdfium-manifest.json, verified against every slice's Mach-O by
|
|
60
|
+
# fetch-pdfium.mjs above, and written into the framework plist from the same
|
|
61
|
+
# field — so it is read here rather than restated. Declaring it as the pod's
|
|
62
|
+
# platform makes a host with a lower deployment target fail at `pod install`
|
|
63
|
+
# ("PdfCanvas does not support iOS 16.4") instead of at upload.
|
|
64
|
+
s.platforms = { :ios => pdfium["iosMinimumOSVersion"] }
|
|
31
65
|
s.requires_arc = true
|
|
32
66
|
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
|
|
67
|
+
# THE CORE IS C++ AND SHARED WITH ANDROID: `native/core` is compiled into this
|
|
68
|
+
# pod exactly as android/src/main/cpp/CMakeLists.txt compiles it into
|
|
69
|
+
# libpdfcanvas.so, and proven by `native/tests` on a laptop. `ios/Sources` is the
|
|
70
|
+
# React binding only — marshalling, a queue, a transport flag. CocoaPods does not
|
|
71
|
+
# read CMake, so the core's file list is restated here as globs; keep it in step
|
|
72
|
+
# with native/core/pdfcanvas-core.cmake.
|
|
73
|
+
s.source_files = [
|
|
74
|
+
"ios/Sources/**/*.{h,mm}",
|
|
75
|
+
"native/core/src/**/*.cpp",
|
|
76
|
+
"native/core/include/**/*.h",
|
|
77
|
+
]
|
|
78
|
+
s.public_header_files = "ios/Sources/PdfCanvasBridge/include/*.h"
|
|
79
|
+
s.private_header_files = "native/core/include/**/*.h"
|
|
38
80
|
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# build is the one where that header IS present, so the host
|
|
46
|
-
# function is compiled in.
|
|
47
|
-
# PdfCanvasBridge — the React binding. Only ever built here: it needs
|
|
48
|
-
# `<React/RCTBridgeModule.h>` and
|
|
49
|
-
# `<ReactCommon/RCTInteropTurboModule.h>`.
|
|
50
|
-
s.source_files = "ios/Sources/**/*.{h,m,mm}"
|
|
81
|
+
# The prebuilt engine: device arm64 + simulator arm64/x86_64, assembled by
|
|
82
|
+
# scripts/fetch-pdfium.mjs from bblanchon/pdfium-binaries' official tarballs.
|
|
83
|
+
# A dynamic framework — CocoaPods embeds and re-signs it whatever `linkage`
|
|
84
|
+
# the host chose for its own pods.
|
|
85
|
+
s.vendored_frameworks = "native/.pdfium/ios/PDFium.xcframework"
|
|
86
|
+
s.frameworks = "Foundation"
|
|
51
87
|
|
|
52
|
-
# Both `include` directories, so `#import <PdfCanvasRasterizer.h>` resolves from
|
|
53
|
-
# the bridge and `#import "PdfCanvasSlots.h"` resolves from itself. Angle-bracket
|
|
54
|
-
# imports of a pod's own headers are what survives `use_frameworks!`, which this
|
|
55
|
-
# package's first consumer uses (`ios.useFrameworks: static`).
|
|
56
88
|
s.pod_target_xcconfig = {
|
|
89
|
+
# The core includes PDFium as plain "fpdfview.h" (portable across Android,
|
|
90
|
+
# the host build and here), so the release's headers go on the search path
|
|
91
|
+
# rather than being reached through the framework module.
|
|
57
92
|
"HEADER_SEARCH_PATHS" => [
|
|
58
|
-
'"$(PODS_TARGET_SRCROOT)/
|
|
59
|
-
'"$(PODS_TARGET_SRCROOT)/ios/
|
|
93
|
+
'"$(PODS_TARGET_SRCROOT)/native/core/include"',
|
|
94
|
+
'"$(PODS_TARGET_SRCROOT)/native/.pdfium/ios/include"',
|
|
60
95
|
'"$(PODS_TARGET_SRCROOT)/ios/Sources/PdfCanvasBridge/include"',
|
|
61
96
|
].join(" "),
|
|
62
|
-
# C++17 is the floor `<jsi/jsi.h>`
|
|
63
|
-
# same install compile at 20, and
|
|
64
|
-
# this to match when it is available.
|
|
97
|
+
# C++17 is the floor `<jsi/jsi.h>` and the core need; the React Native
|
|
98
|
+
# podspecs in the same install compile at 20, and
|
|
99
|
+
# `install_modules_dependencies` raises this to match when it is available.
|
|
65
100
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
101
|
+
# Turns the JSI half of the core on: the slot buffer becomes a
|
|
102
|
+
# `jsi::MutableBuffer` and `installTakePixels` installs the host function.
|
|
103
|
+
# React-jsi's headers arrive through install_modules_dependencies below.
|
|
104
|
+
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) PDFCANVAS_WITH_JSI=1",
|
|
66
105
|
"DEFINES_MODULE" => "YES",
|
|
67
106
|
}
|
|
68
107
|
|
|
69
108
|
# `install_modules_dependencies` is React Native's own helper (react_native_pods.rb).
|
|
70
109
|
# It adds React-Core, React-jsi, ReactCommon/turbomodule and the rest, and sets
|
|
71
110
|
# the new-architecture compiler flags — so the pod tracks whatever the host's RN
|
|
72
|
-
# version wants rather than restating a dependency list that would go stale.
|
|
73
|
-
# `defined?` guard is what every RN library ships: it lets `pod lib lint` and any
|
|
74
|
-
# non-RN install still evaluate the podspec.
|
|
111
|
+
# version wants rather than restating a dependency list that would go stale.
|
|
75
112
|
if defined?(install_modules_dependencies) != nil
|
|
76
113
|
install_modules_dependencies(s)
|
|
77
114
|
else
|