jubarte-pdf 0.0.0-stage → 0.1.0
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/LICENSES/Carlito-OFL.txt +95 -0
- package/LICENSES/Liberation-OFL.txt +102 -0
- package/NOTICE +19 -0
- package/README.md +166 -2
- package/dist/index.d.ts +55 -0
- package/dist/index.js +86 -0
- package/dist/serve.d.ts +1 -0
- package/dist/serve.js +51 -0
- package/dist/server-worker.d.ts +1 -0
- package/dist/server-worker.js +8 -0
- package/dist/server.d.ts +77 -0
- package/dist/server.js +223 -0
- package/package.json +78 -4
- package/pkg/jubarte_pdf_wasm.d.ts +55 -0
- package/pkg/jubarte_pdf_wasm.js +342 -0
- package/pkg/jubarte_pdf_wasm_bg.wasm +0 -0
- package/pkg/jubarte_pdf_wasm_bg.wasm.d.ts +13 -0
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 [yyyy] [name of copyright owner]
|
|
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.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic with Reserved Font Name "Carlito".
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License,
|
|
4
|
+
Version 1.1 as shown below.
|
|
5
|
+
|
|
6
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
7
|
+
|
|
8
|
+
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
|
|
9
|
+
worldwide development of collaborative font projects, to support the font
|
|
10
|
+
creation efforts of academic and linguistic communities, and to provide
|
|
11
|
+
a free and open framework in which fonts may be shared and improved in
|
|
12
|
+
partnership with others.
|
|
13
|
+
|
|
14
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
15
|
+
redistributed freely as long as they are not sold by themselves.
|
|
16
|
+
The fonts, including any derivative works, can be bundled, embedded,
|
|
17
|
+
redistributed and/or sold with any software provided that any reserved
|
|
18
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
19
|
+
however, cannot be released under any other type of license. The
|
|
20
|
+
requirement for fonts to remain under this license does not apply to
|
|
21
|
+
any document created using the fonts or their derivatives.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
DEFINITIONS
|
|
25
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
26
|
+
Holder(s) under this license and clearly marked as such.
|
|
27
|
+
This may include source files, build scripts and documentation.
|
|
28
|
+
|
|
29
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
30
|
+
copyright statement(s).
|
|
31
|
+
|
|
32
|
+
"Original Version" refers to the collection of Font Software components
|
|
33
|
+
as distributed by the Copyright Holder(s).
|
|
34
|
+
|
|
35
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
36
|
+
or substituting — in part or in whole —
|
|
37
|
+
any of the components of the Original Version, by changing formats or
|
|
38
|
+
by porting the Font Software to a new environment.
|
|
39
|
+
|
|
40
|
+
"Author" refers to any designer, engineer, programmer, technical writer
|
|
41
|
+
or other person who contributed to the Font Software.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
PERMISSION & CONDITIONS
|
|
45
|
+
|
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
47
|
+
copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
48
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
49
|
+
Software, subject to the following conditions:
|
|
50
|
+
|
|
51
|
+
1) Neither the Font Software nor any of its individual components,in
|
|
52
|
+
Original or Modified Versions, may be sold by itself.
|
|
53
|
+
|
|
54
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
55
|
+
redistributed and/or sold with any software, provided that each copy
|
|
56
|
+
contains the above copyright notice and this license. These can be
|
|
57
|
+
included either as stand-alone text files, human-readable headers or
|
|
58
|
+
in the appropriate machine-readable metadata fields within text or
|
|
59
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
60
|
+
|
|
61
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
62
|
+
Name(s) unless explicit written permission is granted by the
|
|
63
|
+
corresponding Copyright Holder. This restriction only applies to the
|
|
64
|
+
primary font name as presented to the users.
|
|
65
|
+
|
|
66
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
67
|
+
Software shall not be used to promote, endorse or advertise any
|
|
68
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
69
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
70
|
+
permission.
|
|
71
|
+
|
|
72
|
+
5) The Font Software, modified or unmodified, in part or in whole, must
|
|
73
|
+
be distributed entirely under this license, and must not be distributed
|
|
74
|
+
under any other license. The requirement for fonts to remain under
|
|
75
|
+
this license does not apply to any document created using the Font
|
|
76
|
+
Software.
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are not met.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
DISCLAIMER
|
|
86
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
87
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
88
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
89
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
90
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
91
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
92
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
93
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
|
|
94
|
+
DEALINGS IN THE FONT SOFTWARE.
|
|
95
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Digitized data copyright (c) 2010 Google Corporation
|
|
2
|
+
with Reserved Font Name Arimo, Tinos and Cousine.
|
|
3
|
+
Copyright (c) 2012 Red Hat, Inc.
|
|
4
|
+
with Reserved Font Name Liberation.
|
|
5
|
+
|
|
6
|
+
This Font Software is licensed under the SIL Open Font License,
|
|
7
|
+
Version 1.1.
|
|
8
|
+
|
|
9
|
+
This license is copied below, and is also available with a FAQ at:
|
|
10
|
+
http://scripts.sil.org/OFL
|
|
11
|
+
|
|
12
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
13
|
+
|
|
14
|
+
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
|
|
15
|
+
worldwide development of collaborative font projects, to support the font
|
|
16
|
+
creation efforts of academic and linguistic communities, and to provide
|
|
17
|
+
a free and open framework in which fonts may be shared and improved in
|
|
18
|
+
partnership with others.
|
|
19
|
+
|
|
20
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
21
|
+
redistributed freely as long as they are not sold by themselves.
|
|
22
|
+
The fonts, including any derivative works, can be bundled, embedded,
|
|
23
|
+
redistributed and/or sold with any software provided that any reserved
|
|
24
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
25
|
+
however, cannot be released under any other type of license. The
|
|
26
|
+
requirement for fonts to remain under this license does not apply to
|
|
27
|
+
any document created using the fonts or their derivatives.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
DEFINITIONS
|
|
32
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
33
|
+
Holder(s) under this license and clearly marked as such.
|
|
34
|
+
This may include source files, build scripts and documentation.
|
|
35
|
+
|
|
36
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
37
|
+
copyright statement(s).
|
|
38
|
+
|
|
39
|
+
"Original Version" refers to the collection of Font Software components
|
|
40
|
+
as distributed by the Copyright Holder(s).
|
|
41
|
+
|
|
42
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
43
|
+
or substituting — in part or in whole —
|
|
44
|
+
any of the components of the Original Version, by changing formats or
|
|
45
|
+
by porting the Font Software to a new environment.
|
|
46
|
+
|
|
47
|
+
"Author" refers to any designer, engineer, programmer, technical writer
|
|
48
|
+
or other person who contributed to the Font Software.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
PERMISSION & CONDITIONS
|
|
52
|
+
|
|
53
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
54
|
+
copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
55
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
56
|
+
Software, subject to the following conditions:
|
|
57
|
+
|
|
58
|
+
1) Neither the Font Software nor any of its individual components,in
|
|
59
|
+
Original or Modified Versions, may be sold by itself.
|
|
60
|
+
|
|
61
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
62
|
+
redistributed and/or sold with any software, provided that each copy
|
|
63
|
+
contains the above copyright notice and this license. These can be
|
|
64
|
+
included either as stand-alone text files, human-readable headers or
|
|
65
|
+
in the appropriate machine-readable metadata fields within text or
|
|
66
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
67
|
+
|
|
68
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
69
|
+
Name(s) unless explicit written permission is granted by the
|
|
70
|
+
corresponding Copyright Holder. This restriction only applies to the
|
|
71
|
+
primary font name as presented to the users.
|
|
72
|
+
|
|
73
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
74
|
+
Software shall not be used to promote, endorse or advertise any
|
|
75
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
76
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
77
|
+
permission.
|
|
78
|
+
|
|
79
|
+
5) The Font Software, modified or unmodified, in part or in whole, must
|
|
80
|
+
be distributed entirely under this license, and must not be distributed
|
|
81
|
+
under any other license. The requirement for fonts to remain under
|
|
82
|
+
this license does not apply to any document created using the Font
|
|
83
|
+
Software.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
TERMINATION
|
|
88
|
+
This license becomes null and void if any of the above conditions are not met.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
DISCLAIMER
|
|
93
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
94
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
95
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
96
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
97
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
98
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
99
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
100
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
|
|
101
|
+
DEALINGS IN THE FONT SOFTWARE.
|
|
102
|
+
|
package/NOTICE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
jubarte-pdf
|
|
2
|
+
Copyright 2026 Jandira Technologies, LLC
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (LICENSE).
|
|
5
|
+
|
|
6
|
+
The WebAssembly module in pkg/ is built from the jubarte renderer
|
|
7
|
+
(https://github.com/jandira-tech/jubarte, Apache-2.0; see its NOTICE for the
|
|
8
|
+
attributions of the code it derives from) and contains these font files,
|
|
9
|
+
unmodified, each under the SIL Open Font License 1.1:
|
|
10
|
+
|
|
11
|
+
- Carlito (Regular, Bold, Italic, Bold Italic)
|
|
12
|
+
Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic, with Reserved Font
|
|
13
|
+
Name "Carlito". Licence text: LICENSES/Carlito-OFL.txt
|
|
14
|
+
|
|
15
|
+
- Liberation Sans, Liberation Serif and Liberation Mono (Regular, Bold,
|
|
16
|
+
Italic, Bold Italic of each)
|
|
17
|
+
Digitized data copyright (c) 2010 Google Corporation, with Reserved Font
|
|
18
|
+
Name Arimo, Tinos and Cousine. Copyright (c) 2012 Red Hat, Inc., with
|
|
19
|
+
Reserved Font Name Liberation. Licence text: LICENSES/Liberation-OFL.txt
|
package/README.md
CHANGED
|
@@ -1,3 +1,167 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jubarte-pdf
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/jandira-tech/jubarte-pdf/actions/workflows/ci.yml)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
DOCX to PDF without a converter service: in the browser, in Node or in Bun,
|
|
7
|
+
with no LibreOffice and no container.
|
|
8
|
+
|
|
9
|
+
It is [jubarte](https://github.com/jandira-tech/jubarte)'s renderer built as
|
|
10
|
+
one WebAssembly module that does this conversion and nothing else, with a
|
|
11
|
+
small loader for each place it runs.
|
|
12
|
+
|
|
13
|
+
| | |
|
|
14
|
+
|---|---|
|
|
15
|
+
| Module | `pkg/jubarte_pdf_wasm_bg.wasm`, 10.9 MB (3.4 MB with Brotli) |
|
|
16
|
+
| Exports | one function, `docxToPdf` |
|
|
17
|
+
| Fonts | 16 faces compiled in: Carlito and Liberation Sans, Serif and Mono |
|
|
18
|
+
| Engine | `jubarte-render` 0.19.0 |
|
|
19
|
+
|
|
20
|
+
## Use it on a server
|
|
21
|
+
|
|
22
|
+
A server that renders Word documents by posting them to a converter service
|
|
23
|
+
(Gotenberg, which runs LibreOffice in a container) can render them in its own
|
|
24
|
+
process instead:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { createPdfConverter } from "jubarte-pdf/server";
|
|
28
|
+
|
|
29
|
+
// At startup. This starts nothing.
|
|
30
|
+
const pdfConverter = createPdfConverter({
|
|
31
|
+
maxPdfBytes: 50 * 1024 * 1024,
|
|
32
|
+
// Optional: where a converter service is still deployed, it keeps the other types.
|
|
33
|
+
fallback: (file) => convertWithGotenberg(file),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const result = await pdfConverter.convertToPdf({ bytes, mimeType, fileName });
|
|
37
|
+
if (Result.isError(result)) {
|
|
38
|
+
// result.error.kind: "refused" | "response-too-large" | "timeout" | "crashed" | "unsupported-type"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- **No service to deploy for Word documents.** The worker thread starts with
|
|
43
|
+
the first `.docx` and stops after a minute without one (`idleMs`), which
|
|
44
|
+
gives its memory back.
|
|
45
|
+
- **The server's event loop stays free.** A conversion not done within
|
|
46
|
+
`timeoutMs` of the call (default 30 s) has its thread stopped; the next
|
|
47
|
+
document gets a fresh one.
|
|
48
|
+
- **No request leaves the process.** The module has no file or network call,
|
|
49
|
+
so a document cannot make the converter fetch anything.
|
|
50
|
+
|
|
51
|
+
It converts `.docx` only. Other types go to `fallback` when one is given and
|
|
52
|
+
are refused as `unsupported-type` when none is.
|
|
53
|
+
|
|
54
|
+
`better-result` is a peer dependency of this entry. It runs under Node and
|
|
55
|
+
Bun. A server bundled into one file moves this code away from its worker
|
|
56
|
+
script: keep `jubarte-pdf` out of the bundle, or pass the worker's address as
|
|
57
|
+
`worker`.
|
|
58
|
+
|
|
59
|
+
A server that already isolates document work in subprocesses needs none of
|
|
60
|
+
this. Its worker is a few lines on top of the engine:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { loadPdfEngine } from "jubarte-pdf";
|
|
64
|
+
import wasmPath from "jubarte-pdf/wasm" with { type: "file" }; // Bun
|
|
65
|
+
|
|
66
|
+
const engine = await loadPdfEngine(await Bun.file(wasmPath).arrayBuffer());
|
|
67
|
+
const pdf = engine.docxToPdf(new Uint8Array(await Bun.stdin.arrayBuffer()));
|
|
68
|
+
process.stdout.write(pdf);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Use the engine directly
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { docxToPdf } from "jubarte-pdf";
|
|
75
|
+
|
|
76
|
+
const pdf = await docxToPdf(docxBytes, { revisions: "word", comments: "end" });
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
| Option | Default | Meaning |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| `compress` | `true` | Deflate the PDF's streams. |
|
|
82
|
+
| `revisions` | `"conventional"` | How tracked changes are painted: `"conventional"` (red, blue and green marks), `"word"` (Microsoft Word's markup) or `"custom"`. |
|
|
83
|
+
| `revisionPalette` | none | The marks for `"custom"`, such as `"deleted=#AA0000:strike"`. |
|
|
84
|
+
| `comments` | `"margin"` | `"margin"` draws balloons beside the text; `"end"` lists the comments after the last page. |
|
|
85
|
+
| `changedOnly` | `false` | Keep only the pages a tracked change or a comment touches. |
|
|
86
|
+
|
|
87
|
+
In a browser the module is not fetched until the first conversion; a page
|
|
88
|
+
that imports this package with `import()` on the export action ships a start
|
|
89
|
+
script without it (`test/bundle.test.ts` builds one with Vite to check).
|
|
90
|
+
|
|
91
|
+
`loadPdfEngine(source?)` loads the module ahead of time and returns the
|
|
92
|
+
synchronous engine. Pass `source` (a URL, a `Response`, bytes or a compiled
|
|
93
|
+
`WebAssembly.Module`) when your host serves the `.wasm` file from somewhere
|
|
94
|
+
else; the file is also exported as `jubarte-pdf/wasm`. Vite and other
|
|
95
|
+
bundlers that understand `new URL(..., import.meta.url)` need no setup. In
|
|
96
|
+
Node the file is read from the package's `pkg/` folder.
|
|
97
|
+
|
|
98
|
+
Two limits to know:
|
|
99
|
+
|
|
100
|
+
- A Node application that bundles this package into one file (esbuild, tsup)
|
|
101
|
+
moves the code away from `pkg/`. The load then rejects with
|
|
102
|
+
`WasmNotFoundError`; keep `jubarte-pdf` external in that bundle, or pass
|
|
103
|
+
`source`.
|
|
104
|
+
- The engine is one instance per page, loaded from one place. The first
|
|
105
|
+
`loadPdfEngine` call decides where from; a later call with a different
|
|
106
|
+
`source` rejects with `EngineAlreadyLoadedError` instead of being ignored.
|
|
107
|
+
|
|
108
|
+
## Fonts
|
|
109
|
+
|
|
110
|
+
The module needs no font from the host and makes no network request. A
|
|
111
|
+
document's fonts map to the compiled-in ones by Word's metrics:
|
|
112
|
+
|
|
113
|
+
| The document asks for | The PDF embeds |
|
|
114
|
+
|---|---|
|
|
115
|
+
| Calibri | Carlito |
|
|
116
|
+
| Arial, Helvetica | Liberation Sans |
|
|
117
|
+
| Times New Roman | Liberation Serif |
|
|
118
|
+
| Courier New | Liberation Mono |
|
|
119
|
+
|
|
120
|
+
Carlito and Liberation have the same advance widths as the fonts they stand
|
|
121
|
+
in for, so lines and pages break where Word breaks them. A native jubarte on
|
|
122
|
+
a machine that has Calibri embeds Calibri itself; the text and the page count
|
|
123
|
+
are the same either way.
|
|
124
|
+
|
|
125
|
+
Other families fall back to one of the four. `jubarte-render` 0.19.0 has no
|
|
126
|
+
way to hand it more font files under WebAssembly, so a document set in, say,
|
|
127
|
+
Cambria or a CJK font is rendered with a substitute.
|
|
128
|
+
|
|
129
|
+
## What is in the module
|
|
130
|
+
|
|
131
|
+
Only the renderer and the two crates under it (`jubarte-dom`, `jubarte-opc`).
|
|
132
|
+
Compare, tracked-change editing, Markdown, validation and the command line
|
|
133
|
+
are separate crates that this one does not depend on. The module asks its
|
|
134
|
+
host for the date, to stamp the PDF, and for random bytes, which the zip
|
|
135
|
+
reader links; it has no file, network, console or timer call. `pnpm test`
|
|
136
|
+
checks all of this on the built file.
|
|
137
|
+
|
|
138
|
+
## Development
|
|
139
|
+
|
|
140
|
+
Requirements: Rust (stable, with the `wasm32-unknown-unknown` target),
|
|
141
|
+
[wasm-pack](https://github.com/wasm-bindgen/wasm-pack) 0.15, Node 20 or newer,
|
|
142
|
+
pnpm, optionally Bun, and poppler (`pdfinfo`, `pdffonts`, `pdftotext`) for the tests that
|
|
143
|
+
read the PDFs.
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
pnpm install
|
|
147
|
+
pnpm build # the module into pkg/, then the library into dist/
|
|
148
|
+
pnpm test # 42 tests
|
|
149
|
+
pnpm typecheck && pnpm lint
|
|
150
|
+
cargo test # the conversion's own two tests, natively
|
|
151
|
+
pnpm demo # a page that exports a DOCX in the browser
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
What the tests measure:
|
|
155
|
+
|
|
156
|
+
| File | Measures |
|
|
157
|
+
|---|---|
|
|
158
|
+
| `test/server.test.ts` | The server converter with the real module in a real worker thread: lazy start, idle stop, results, fallback, refusals, size limit, timeout and recovery. |
|
|
159
|
+
| `test/bun.test.ts` | The built converter under Bun. Skipped where Bun is not installed. |
|
|
160
|
+
| `test/engine.test.ts` | The real module: poppler reads pages, text and embedded fonts from its PDFs. |
|
|
161
|
+
| `test/surface.test.ts` | The built `.wasm` file's exports and imports, and Cargo's dependency graph. |
|
|
162
|
+
| `test/bundle.test.ts` | Vite builds the demo; the start script holds no engine and the `.wasm` file is separate. |
|
|
163
|
+
|
|
164
|
+
## Licence
|
|
165
|
+
|
|
166
|
+
Apache-2.0. The module contains the Carlito and Liberation fonts under the
|
|
167
|
+
SIL Open Font License 1.1; see `NOTICE` and `LICENSES/`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DOCX to PDF engine: one WebAssembly module with jubarte's renderer and
|
|
3
|
+
* its fonts compiled in.
|
|
4
|
+
*
|
|
5
|
+
* Importing this file does not fetch or compile the module. `loadPdfEngine`
|
|
6
|
+
* does, once; every later call returns the same engine.
|
|
7
|
+
*/
|
|
8
|
+
/** How tracked changes are painted. */
|
|
9
|
+
export type RevisionStyle = "conventional" | "word" | "custom";
|
|
10
|
+
export type PdfOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* Deflate the PDF's streams. On by default: an exported file is several
|
|
13
|
+
* times smaller, and nothing here needs the streams as plain text.
|
|
14
|
+
*/
|
|
15
|
+
compress?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* `conventional` (default): red, blue and green redline marks. `word`:
|
|
18
|
+
* Microsoft Word's own markup. `custom`: the marks of `revisionPalette`.
|
|
19
|
+
*/
|
|
20
|
+
revisions?: RevisionStyle;
|
|
21
|
+
/** For `custom`, such as `"deleted=#AA0000:strike"`. */
|
|
22
|
+
revisionPalette?: string;
|
|
23
|
+
/** `margin` (default): balloons beside the text. `end`: listed after the last page. */
|
|
24
|
+
comments?: "margin" | "end";
|
|
25
|
+
/** Keep only the pages a tracked change or a comment touches. */
|
|
26
|
+
changedOnly?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type PdfEngine = {
|
|
29
|
+
/** Render a DOCX package to PDF. Throws an `Error` with the renderer's message. */
|
|
30
|
+
docxToPdf(docx: Uint8Array, options?: PdfOptions): Uint8Array;
|
|
31
|
+
};
|
|
32
|
+
/** Where the `.wasm` file comes from, when the default location does not suit. */
|
|
33
|
+
export type WasmSource = URL | string | Response | BufferSource | WebAssembly.Module;
|
|
34
|
+
/** Raised when the `.wasm` file is not where the package expects it. */
|
|
35
|
+
export declare class WasmNotFoundError extends Error {
|
|
36
|
+
constructor(location: URL, cause: unknown);
|
|
37
|
+
}
|
|
38
|
+
/** Raised when the engine is asked for from a second place after it was loaded from a first. */
|
|
39
|
+
export declare class EngineAlreadyLoadedError extends Error {
|
|
40
|
+
constructor();
|
|
41
|
+
}
|
|
42
|
+
type SourceInput = WasmSource | (() => WasmSource | Promise<WasmSource>);
|
|
43
|
+
/**
|
|
44
|
+
* Fetch, compile and start the engine. The first call does the work; later
|
|
45
|
+
* calls (and calls made while it is still loading) get the same engine. A
|
|
46
|
+
* failed load is not kept, so the next call tries again.
|
|
47
|
+
*
|
|
48
|
+
* The engine is one instance per page, loaded from one place. A later call
|
|
49
|
+
* may omit `source` or repeat the first one; a different `source` rejects
|
|
50
|
+
* with {@link EngineAlreadyLoadedError} instead of being ignored.
|
|
51
|
+
*/
|
|
52
|
+
export declare const loadPdfEngine: (source?: SourceInput) => Promise<PdfEngine>;
|
|
53
|
+
/** Render a DOCX package to PDF, loading the engine first when needed. */
|
|
54
|
+
export declare const docxToPdf: (docx: Uint8Array, options?: PdfOptions) => Promise<Uint8Array>;
|
|
55
|
+
export {};
|