blitz-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 +21 -0
- package/README.md +355 -2
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/assets/icon.svg +4 -0
- package/dist/api.d.ts +7 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +46 -0
- package/dist/api.js.map +1 -0
- package/dist/assets.d.ts +7 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +52 -0
- package/dist/assets.js.map +1 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +3 -0
- package/dist/browser.js.map +1 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +10 -0
- package/dist/node.js.map +1 -0
- package/dist/options.d.ts +24 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +135 -0
- package/dist/options.js.map +1 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/examples/bun.ts +8 -0
- package/examples/german-invoice/README.md +70 -0
- package/examples/german-invoice/data.mjs +83 -0
- package/examples/german-invoice/invoice.css +59 -0
- package/examples/german-invoice/template.mjs +49 -0
- package/examples/german-invoice.mjs +20 -0
- package/examples/invoice.html +29 -0
- package/examples/node.mjs +8 -0
- package/examples/pagination.html +40 -0
- package/examples/pagination.mjs +8 -0
- package/licenses/DejaVu.txt +187 -0
- package/licenses/RUST_DEPENDENCIES.txt +11577 -0
- package/package.json +89 -4
- package/src/api.ts +44 -0
- package/src/assets.ts +43 -0
- package/src/browser.ts +6 -0
- package/src/node.ts +12 -0
- package/src/options.ts +101 -0
- package/src/types.ts +49 -0
- package/vendor/README.md +17 -0
- package/vendor/stylo/.cargo-ok +1 -0
- package/vendor/stylo/.cargo_vcs_info.json +6 -0
- package/vendor/stylo/Cargo.lock +1485 -0
- package/vendor/stylo/Cargo.toml +274 -0
- package/vendor/stylo/LICENSE +373 -0
- package/vendor/stylo/README.md +6 -0
- package/vendor/stylo/applicable_declarations.rs +328 -0
- package/vendor/stylo/author_styles.rs +79 -0
- package/vendor/stylo/bezier.rs +176 -0
- package/vendor/stylo/bloom.rs +414 -0
- package/vendor/stylo/build.rs +91 -0
- package/vendor/stylo/build_gecko.rs +393 -0
- package/vendor/stylo/color/color_function.rs +601 -0
- package/vendor/stylo/color/component.rs +207 -0
- package/vendor/stylo/color/convert.rs +935 -0
- package/vendor/stylo/color/gamut/raytrace.rs +265 -0
- package/vendor/stylo/color/gamut.rs +227 -0
- package/vendor/stylo/color/mix.rs +645 -0
- package/vendor/stylo/color/mod.rs +750 -0
- package/vendor/stylo/color/parsing.rs +770 -0
- package/vendor/stylo/color/to_css.rs +297 -0
- package/vendor/stylo/context.rs +716 -0
- package/vendor/stylo/counter_style/mod.rs +754 -0
- package/vendor/stylo/counter_style/predefined.rs +61 -0
- package/vendor/stylo/counter_style/update_predefined.py +35 -0
- package/vendor/stylo/custom_properties.rs +2023 -0
- package/vendor/stylo/custom_properties_map.rs +220 -0
- package/vendor/stylo/data.rs +693 -0
- package/vendor/stylo/device/gecko.rs +486 -0
- package/vendor/stylo/device/mod.rs +304 -0
- package/vendor/stylo/device/servo.rs +507 -0
- package/vendor/stylo/dom.rs +1164 -0
- package/vendor/stylo/dom_apis.rs +937 -0
- package/vendor/stylo/driver.rs +172 -0
- package/vendor/stylo/error_reporting.rs +484 -0
- package/vendor/stylo/font_face.rs +558 -0
- package/vendor/stylo/font_metrics.rs +124 -0
- package/vendor/stylo/gecko/anon_boxes.toml +113 -0
- package/vendor/stylo/gecko/arc_types.rs +211 -0
- package/vendor/stylo/gecko/conversions.rs +59 -0
- package/vendor/stylo/gecko/data.rs +222 -0
- package/vendor/stylo/gecko/media_features.rs +971 -0
- package/vendor/stylo/gecko/mod.rs +20 -0
- package/vendor/stylo/gecko/non_ts_pseudo_class_list.rs +119 -0
- package/vendor/stylo/gecko/pseudo_element.rs +640 -0
- package/vendor/stylo/gecko/pseudo_element_definition.mako.rs +298 -0
- package/vendor/stylo/gecko/pseudo_elements.py +137 -0
- package/vendor/stylo/gecko/pseudo_elements.toml +197 -0
- package/vendor/stylo/gecko/regen_pseudo_elements.py +33 -0
- package/vendor/stylo/gecko/restyle_damage.rs +127 -0
- package/vendor/stylo/gecko/selector_parser.rs +627 -0
- package/vendor/stylo/gecko/snapshot.rs +202 -0
- package/vendor/stylo/gecko/snapshot_helpers.rs +334 -0
- package/vendor/stylo/gecko/traversal.rs +52 -0
- package/vendor/stylo/gecko/wrapper.rs +2258 -0
- package/vendor/stylo/gecko_bindings/mod.rs +34 -0
- package/vendor/stylo/gecko_bindings/sugar/mod.rs +12 -0
- package/vendor/stylo/gecko_bindings/sugar/ns_com_ptr.rs +15 -0
- package/vendor/stylo/gecko_bindings/sugar/ns_compatibility.rs +19 -0
- package/vendor/stylo/gecko_bindings/sugar/ns_style_auto_array.rs +111 -0
- package/vendor/stylo/gecko_bindings/sugar/origin_flags.rs +31 -0
- package/vendor/stylo/gecko_bindings/sugar/ownership.rs +70 -0
- package/vendor/stylo/gecko_bindings/sugar/refptr.rs +299 -0
- package/vendor/stylo/gecko_string_cache/mod.rs +543 -0
- package/vendor/stylo/gecko_string_cache/namespace.rs +106 -0
- package/vendor/stylo/global_style_data.rs +224 -0
- package/vendor/stylo/invalidation/element/document_state.rs +156 -0
- package/vendor/stylo/invalidation/element/element_wrapper.rs +432 -0
- package/vendor/stylo/invalidation/element/invalidation_map.rs +1631 -0
- package/vendor/stylo/invalidation/element/invalidator.rs +1470 -0
- package/vendor/stylo/invalidation/element/mod.rs +13 -0
- package/vendor/stylo/invalidation/element/relative_selector.rs +1399 -0
- package/vendor/stylo/invalidation/element/restyle_hints.rs +226 -0
- package/vendor/stylo/invalidation/element/state_and_attributes.rs +756 -0
- package/vendor/stylo/invalidation/media_queries.rs +144 -0
- package/vendor/stylo/invalidation/mod.rs +10 -0
- package/vendor/stylo/invalidation/stylesheets.rs +745 -0
- package/vendor/stylo/invalidation/viewport_units.rs +71 -0
- package/vendor/stylo/lib.rs +336 -0
- package/vendor/stylo/logical_geometry.rs +1684 -0
- package/vendor/stylo/macros.rs +70 -0
- package/vendor/stylo/matching.rs +1226 -0
- package/vendor/stylo/media_queries/media_list.rs +168 -0
- package/vendor/stylo/media_queries/media_query.rs +190 -0
- package/vendor/stylo/media_queries/mod.rs +13 -0
- package/vendor/stylo/parallel.rs +205 -0
- package/vendor/stylo/parser.rs +276 -0
- package/vendor/stylo/piecewise_linear.rs +282 -0
- package/vendor/stylo/prefs.rs +33 -0
- package/vendor/stylo/properties/build.py +119 -0
- package/vendor/stylo/properties/cascade.rs +2704 -0
- package/vendor/stylo/properties/computed_value_flags.rs +206 -0
- package/vendor/stylo/properties/counted_unknown_properties.py +104 -0
- package/vendor/stylo/properties/counter_style_descriptors.toml +45 -0
- package/vendor/stylo/properties/data.py +1375 -0
- package/vendor/stylo/properties/declaration_block.rs +1788 -0
- package/vendor/stylo/properties/font_face_descriptors.toml +50 -0
- package/vendor/stylo/properties/gecko.mako.rs +1555 -0
- package/vendor/stylo/properties/helpers/animated_properties.mako.rs +800 -0
- package/vendor/stylo/properties/helpers.mako.rs +812 -0
- package/vendor/stylo/properties/longhands.toml +4305 -0
- package/vendor/stylo/properties/mod.rs +1857 -0
- package/vendor/stylo/properties/properties.html.mako +31 -0
- package/vendor/stylo/properties/properties.mako.rs +3103 -0
- package/vendor/stylo/properties/property_descriptors.toml +18 -0
- package/vendor/stylo/properties/shorthands.rs +4241 -0
- package/vendor/stylo/properties/shorthands.toml +575 -0
- package/vendor/stylo/properties/vendored_python/mako-1.3.10-py3-none-any.whl +0 -0
- package/vendor/stylo/properties/vendored_python/markupsafe/LICENSE.txt +28 -0
- package/vendor/stylo/properties/vendored_python/markupsafe/__init__.py +384 -0
- package/vendor/stylo/properties/vendored_python/toml-0.10.2-py2.py3-none-any.whl +0 -0
- package/vendor/stylo/properties/view_transition_descriptors.toml +11 -0
- package/vendor/stylo/properties_and_values/mod.rs +12 -0
- package/vendor/stylo/properties_and_values/registry.rs +65 -0
- package/vendor/stylo/properties_and_values/rule.rs +331 -0
- package/vendor/stylo/properties_and_values/syntax/ascii.rs +60 -0
- package/vendor/stylo/properties_and_values/syntax/data_type.rs +146 -0
- package/vendor/stylo/properties_and_values/syntax/mod.rs +437 -0
- package/vendor/stylo/properties_and_values/value.rs +758 -0
- package/vendor/stylo/queries/condition.rs +996 -0
- package/vendor/stylo/queries/feature.rs +199 -0
- package/vendor/stylo/queries/feature_expression.rs +1170 -0
- package/vendor/stylo/queries/mod.rs +19 -0
- package/vendor/stylo/queries/values.rs +46 -0
- package/vendor/stylo/rule_cache.rs +267 -0
- package/vendor/stylo/rule_collector.rs +554 -0
- package/vendor/stylo/rule_tree/core.rs +787 -0
- package/vendor/stylo/rule_tree/level.rs +396 -0
- package/vendor/stylo/rule_tree/map.rs +201 -0
- package/vendor/stylo/rule_tree/mod.rs +427 -0
- package/vendor/stylo/rule_tree/source.rs +80 -0
- package/vendor/stylo/rule_tree/unsafe_box.rs +78 -0
- package/vendor/stylo/scoped_tls.rs +80 -0
- package/vendor/stylo/selector_map.rs +1050 -0
- package/vendor/stylo/selector_parser.rs +305 -0
- package/vendor/stylo/servo/animation.rs +1922 -0
- package/vendor/stylo/servo/attr.rs +714 -0
- package/vendor/stylo/servo/encoding_support.rs +81 -0
- package/vendor/stylo/servo/media_features.rs +254 -0
- package/vendor/stylo/servo/mod.rs +16 -0
- package/vendor/stylo/servo/restyle_damage.rs +215 -0
- package/vendor/stylo/servo/selector_parser.rs +1036 -0
- package/vendor/stylo/servo/shadow_parts.rs +207 -0
- package/vendor/stylo/shared_lock.rs +271 -0
- package/vendor/stylo/sharing/checks.rs +281 -0
- package/vendor/stylo/sharing/mod.rs +1000 -0
- package/vendor/stylo/simple_buckets_map.rs +52 -0
- package/vendor/stylo/str.rs +168 -0
- package/vendor/stylo/style_adjuster.rs +1086 -0
- package/vendor/stylo/style_resolver.rs +658 -0
- package/vendor/stylo/stylesheet_set.rs +658 -0
- package/vendor/stylo/stylesheets/appearance_base_rule.rs +51 -0
- package/vendor/stylo/stylesheets/container_rule.rs +769 -0
- package/vendor/stylo/stylesheets/counter_style_rule.rs +7 -0
- package/vendor/stylo/stylesheets/document_rule.rs +272 -0
- package/vendor/stylo/stylesheets/font_face_rule.rs +7 -0
- package/vendor/stylo/stylesheets/font_feature_values_rule.rs +481 -0
- package/vendor/stylo/stylesheets/font_palette_values_rule.rs +304 -0
- package/vendor/stylo/stylesheets/import_rule.rs +259 -0
- package/vendor/stylo/stylesheets/keyframes_rule.rs +733 -0
- package/vendor/stylo/stylesheets/layer_rule.rs +221 -0
- package/vendor/stylo/stylesheets/loader.rs +29 -0
- package/vendor/stylo/stylesheets/margin_rule.rs +190 -0
- package/vendor/stylo/stylesheets/media_rule.rs +191 -0
- package/vendor/stylo/stylesheets/mod.rs +918 -0
- package/vendor/stylo/stylesheets/namespace_rule.rs +43 -0
- package/vendor/stylo/stylesheets/nested_declarations_rule.rs +51 -0
- package/vendor/stylo/stylesheets/origin.rs +249 -0
- package/vendor/stylo/stylesheets/page_rule.rs +354 -0
- package/vendor/stylo/stylesheets/position_try_rule.rs +68 -0
- package/vendor/stylo/stylesheets/property_rule.rs +5 -0
- package/vendor/stylo/stylesheets/rule_list.rs +167 -0
- package/vendor/stylo/stylesheets/rule_parser.rs +1189 -0
- package/vendor/stylo/stylesheets/rules_iterator.rs +397 -0
- package/vendor/stylo/stylesheets/scope_rule.rs +511 -0
- package/vendor/stylo/stylesheets/starting_style_rule.rs +54 -0
- package/vendor/stylo/stylesheets/style_rule.rs +80 -0
- package/vendor/stylo/stylesheets/stylesheet.rs +570 -0
- package/vendor/stylo/stylesheets/supports_rule.rs +486 -0
- package/vendor/stylo/stylesheets/view_transition_rule.rs +81 -0
- package/vendor/stylo/stylist.rs +5076 -0
- package/vendor/stylo/thread_state.rs +87 -0
- package/vendor/stylo/traversal.rs +765 -0
- package/vendor/stylo/traversal_flags.rs +68 -0
- package/vendor/stylo/typed_om/mod.rs +981 -0
- package/vendor/stylo/typed_om/numeric.rs +128 -0
- package/vendor/stylo/typed_om/numeric_declaration.rs +93 -0
- package/vendor/stylo/typed_om/numeric_type.rs +640 -0
- package/vendor/stylo/typed_om/sum_value.rs +426 -0
- package/vendor/stylo/url/gecko.rs +367 -0
- package/vendor/stylo/url/mod.rs +71 -0
- package/vendor/stylo/url/servo.rs +239 -0
- package/vendor/stylo/use_counters/mod.rs +137 -0
- package/vendor/stylo/values/animated/color.rs +103 -0
- package/vendor/stylo/values/animated/effects.rs +26 -0
- package/vendor/stylo/values/animated/font.rs +37 -0
- package/vendor/stylo/values/animated/grid.rs +161 -0
- package/vendor/stylo/values/animated/lists.rs +141 -0
- package/vendor/stylo/values/animated/mod.rs +550 -0
- package/vendor/stylo/values/animated/svg.rs +46 -0
- package/vendor/stylo/values/animated/text.rs +58 -0
- package/vendor/stylo/values/animated/transform.rs +1592 -0
- package/vendor/stylo/values/computed/align.rs +90 -0
- package/vendor/stylo/values/computed/angle.rs +130 -0
- package/vendor/stylo/values/computed/animation.rs +124 -0
- package/vendor/stylo/values/computed/background.rs +13 -0
- package/vendor/stylo/values/computed/basic_shape.rs +267 -0
- package/vendor/stylo/values/computed/border.rs +163 -0
- package/vendor/stylo/values/computed/box.rs +267 -0
- package/vendor/stylo/values/computed/calc.rs +334 -0
- package/vendor/stylo/values/computed/color.rs +161 -0
- package/vendor/stylo/values/computed/column.rs +11 -0
- package/vendor/stylo/values/computed/corner_shape.rs +155 -0
- package/vendor/stylo/values/computed/counters.rs +26 -0
- package/vendor/stylo/values/computed/easing.rs +109 -0
- package/vendor/stylo/values/computed/effects.rs +30 -0
- package/vendor/stylo/values/computed/flex.rs +19 -0
- package/vendor/stylo/values/computed/font.rs +1517 -0
- package/vendor/stylo/values/computed/image.rs +273 -0
- package/vendor/stylo/values/computed/length.rs +576 -0
- package/vendor/stylo/values/computed/length_percentage.rs +1055 -0
- package/vendor/stylo/values/computed/list.rs +16 -0
- package/vendor/stylo/values/computed/mod.rs +1141 -0
- package/vendor/stylo/values/computed/motion.rs +73 -0
- package/vendor/stylo/values/computed/outline.rs +7 -0
- package/vendor/stylo/values/computed/page.rs +77 -0
- package/vendor/stylo/values/computed/param.rs +9 -0
- package/vendor/stylo/values/computed/percentage.rs +143 -0
- package/vendor/stylo/values/computed/position.rs +273 -0
- package/vendor/stylo/values/computed/ratio.rs +88 -0
- package/vendor/stylo/values/computed/rect.rs +19 -0
- package/vendor/stylo/values/computed/resolution.rs +76 -0
- package/vendor/stylo/values/computed/svg.rs +66 -0
- package/vendor/stylo/values/computed/table.rs +7 -0
- package/vendor/stylo/values/computed/text.rs +199 -0
- package/vendor/stylo/values/computed/time.rs +83 -0
- package/vendor/stylo/values/computed/transform.rs +559 -0
- package/vendor/stylo/values/computed/tree_counting.rs +30 -0
- package/vendor/stylo/values/computed/ui.rs +23 -0
- package/vendor/stylo/values/computed/url.rs +12 -0
- package/vendor/stylo/values/distance.rs +139 -0
- package/vendor/stylo/values/generics/animation.rs +363 -0
- package/vendor/stylo/values/generics/background.rs +65 -0
- package/vendor/stylo/values/generics/basic_shape.rs +1389 -0
- package/vendor/stylo/values/generics/border.rs +303 -0
- package/vendor/stylo/values/generics/box.rs +552 -0
- package/vendor/stylo/values/generics/calc.rs +2986 -0
- package/vendor/stylo/values/generics/color.rs +318 -0
- package/vendor/stylo/values/generics/column.rs +44 -0
- package/vendor/stylo/values/generics/counters.rs +320 -0
- package/vendor/stylo/values/generics/easing.rs +132 -0
- package/vendor/stylo/values/generics/effects.rs +131 -0
- package/vendor/stylo/values/generics/flex.rs +34 -0
- package/vendor/stylo/values/generics/font.rs +376 -0
- package/vendor/stylo/values/generics/grid.rs +962 -0
- package/vendor/stylo/values/generics/image.rs +653 -0
- package/vendor/stylo/values/generics/length.rs +656 -0
- package/vendor/stylo/values/generics/mod.rs +303 -0
- package/vendor/stylo/values/generics/motion.rs +274 -0
- package/vendor/stylo/values/generics/page.rs +167 -0
- package/vendor/stylo/values/generics/position.rs +669 -0
- package/vendor/stylo/values/generics/ratio.rs +88 -0
- package/vendor/stylo/values/generics/rect.rs +147 -0
- package/vendor/stylo/values/generics/size.rs +102 -0
- package/vendor/stylo/values/generics/svg.rs +226 -0
- package/vendor/stylo/values/generics/text.rs +268 -0
- package/vendor/stylo/values/generics/transform.rs +1157 -0
- package/vendor/stylo/values/generics/ui.rs +147 -0
- package/vendor/stylo/values/generics/url.rs +51 -0
- package/vendor/stylo/values/mod.rs +820 -0
- package/vendor/stylo/values/resolved/animation.rs +33 -0
- package/vendor/stylo/values/resolved/color.rs +53 -0
- package/vendor/stylo/values/resolved/counters.rs +45 -0
- package/vendor/stylo/values/resolved/mod.rs +316 -0
- package/vendor/stylo/values/specified/align.rs +711 -0
- package/vendor/stylo/values/specified/angle.rs +407 -0
- package/vendor/stylo/values/specified/animation.rs +921 -0
- package/vendor/stylo/values/specified/background.rs +270 -0
- package/vendor/stylo/values/specified/basic_shape.rs +986 -0
- package/vendor/stylo/values/specified/border.rs +430 -0
- package/vendor/stylo/values/specified/box.rs +2231 -0
- package/vendor/stylo/values/specified/calc.rs +1657 -0
- package/vendor/stylo/values/specified/color.rs +1210 -0
- package/vendor/stylo/values/specified/column.rs +11 -0
- package/vendor/stylo/values/specified/corner_shape.rs +152 -0
- package/vendor/stylo/values/specified/counters.rs +242 -0
- package/vendor/stylo/values/specified/easing.rs +225 -0
- package/vendor/stylo/values/specified/effects.rs +421 -0
- package/vendor/stylo/values/specified/flex.rs +42 -0
- package/vendor/stylo/values/specified/font.rs +2103 -0
- package/vendor/stylo/values/specified/frequency.rs +39 -0
- package/vendor/stylo/values/specified/grid.rs +407 -0
- package/vendor/stylo/values/specified/image.rs +1385 -0
- package/vendor/stylo/values/specified/intersection_observer.rs +80 -0
- package/vendor/stylo/values/specified/length.rs +2024 -0
- package/vendor/stylo/values/specified/list.rs +190 -0
- package/vendor/stylo/values/specified/mod.rs +531 -0
- package/vendor/stylo/values/specified/motion.rs +316 -0
- package/vendor/stylo/values/specified/number.rs +603 -0
- package/vendor/stylo/values/specified/outline.rs +69 -0
- package/vendor/stylo/values/specified/page.rs +94 -0
- package/vendor/stylo/values/specified/param.rs +121 -0
- package/vendor/stylo/values/specified/percentage.rs +364 -0
- package/vendor/stylo/values/specified/position.rs +2247 -0
- package/vendor/stylo/values/specified/ratio.rs +29 -0
- package/vendor/stylo/values/specified/rect.rs +28 -0
- package/vendor/stylo/values/specified/resolution.rs +237 -0
- package/vendor/stylo/values/specified/source_size_list.rs +135 -0
- package/vendor/stylo/values/specified/svg.rs +427 -0
- package/vendor/stylo/values/specified/svg_path.rs +1115 -0
- package/vendor/stylo/values/specified/table.rs +38 -0
- package/vendor/stylo/values/specified/text.rs +1561 -0
- package/vendor/stylo/values/specified/time.rs +313 -0
- package/vendor/stylo/values/specified/transform.rs +599 -0
- package/vendor/stylo/values/specified/tree_counting.rs +32 -0
- package/vendor/stylo/values/specified/ui.rs +344 -0
- package/vendor/stylo/values/specified/url.rs +12 -0
- package/vendor/stylo/values/tagged_numeric.rs +253 -0
- package/wasm/blitz_pdf.d.ts +67 -0
- package/wasm/blitz_pdf.js +699 -0
- package/wasm/blitz_pdf_bg.wasm +0 -0
- package/wasm/blitz_pdf_bg.wasm.d.ts +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 blitz-pdf contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,356 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="assets/icon.svg" width="64" height="64" alt="">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# blitz-pdf
|
|
4
|
+
|
|
5
|
+
HTML and CSS to **vector PDF/A-3u**, powered by [Blitz](https://github.com/DioxusLabs/blitz)
|
|
6
|
+
and [Krilla](https://github.com/LaurenzV/krilla), compiled to WebAssembly.
|
|
7
|
+
|
|
8
|
+
Runs in **Bun, Node.js, and browsers**. Text is selectable and searchable, fonts
|
|
9
|
+
are subsetted and embedded, and shapes remain vectors. No Chromium, GPU, native
|
|
10
|
+
addon, or rendering service. Source images remain images.
|
|
11
|
+
|
|
12
|
+
This is an early implementation; see the limitations below.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install blitz-pdf
|
|
18
|
+
# or
|
|
19
|
+
bun add blitz-pdf
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Node.js and Bun
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { renderPdf } from "blitz-pdf";
|
|
26
|
+
|
|
27
|
+
const pdf = await renderPdf(`
|
|
28
|
+
<style>body { font-family: sans-serif } h1 { color: #2457db }</style>
|
|
29
|
+
<h1>Hello, PDF</h1>
|
|
30
|
+
<p>Selectable text: café, office, €.</p>
|
|
31
|
+
`, { format: "A4", margin: "15mm", title: "Example" });
|
|
32
|
+
|
|
33
|
+
// Node.js
|
|
34
|
+
await (await import("node:fs/promises")).writeFile("example.pdf", pdf);
|
|
35
|
+
|
|
36
|
+
// Bun
|
|
37
|
+
// await Bun.write("example.pdf", pdf);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The first render loads the bundled WASM automatically. The npm package includes
|
|
41
|
+
JavaScript, TypeScript declarations, and the WASM containing the fonts. Consumers
|
|
42
|
+
do not need Rust. The package is ESM, targeting Node.js 20+ and modern Bun.
|
|
43
|
+
|
|
44
|
+
## Browser
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import { renderPdf } from "blitz-pdf/browser";
|
|
48
|
+
|
|
49
|
+
const bytes = await renderPdf("<h1>Made in the browser</h1>");
|
|
50
|
+
const url = URL.createObjectURL(new Blob([bytes], { type: "application/pdf" }));
|
|
51
|
+
const link = document.createElement("a");
|
|
52
|
+
link.href = url;
|
|
53
|
+
link.download = "example.pdf";
|
|
54
|
+
link.click();
|
|
55
|
+
// Revoke the URL when it is no longer needed.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Bundlers should copy the WASM referenced through `new URL(..., import.meta.url)`.
|
|
59
|
+
For a custom deployment, set its location before the first render:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import { init, renderPdf } from "blitz-pdf/browser";
|
|
63
|
+
await init({ wasm: new URL("/assets/blitz_pdf_bg.wasm", location.href) });
|
|
64
|
+
const pdf = await renderPdf("<p>Ready</p>");
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The binary is exported as `blitz-pdf/wasm`. Serve it with
|
|
68
|
+
`Content-Type: application/wasm`. `init` also accepts bytes, a `Response`, or a
|
|
69
|
+
compiled `WebAssembly.Module`. Concurrent callers share initialization; failed
|
|
70
|
+
loads can be retried.
|
|
71
|
+
|
|
72
|
+
Asset I/O is asynchronous. HTML layout and PDF serialization perform synchronous
|
|
73
|
+
CPU work. Use a Web Worker or server worker thread when the calling thread must
|
|
74
|
+
stay responsive. Each worker gets its own WASM instance. Shared memory and
|
|
75
|
+
cross-origin isolation are not required.
|
|
76
|
+
|
|
77
|
+
## Options
|
|
78
|
+
|
|
79
|
+
`renderPdf(html: string, options?: PdfOptions): Promise<Uint8Array>`
|
|
80
|
+
|
|
81
|
+
| Option | Default | Meaning |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `format` | `"A4"` | `A3`, `A4`, `A5`, `Letter`, `Legal`, or `Tabloid` |
|
|
84
|
+
| `width`, `height` | From format | Supply both for custom dimensions; omit `format` |
|
|
85
|
+
| `landscape` | `false` | Swap width and height |
|
|
86
|
+
| `margin` | `0` | One length or `{ top, right, bottom, left }`; omitted sides are zero |
|
|
87
|
+
| `media` | `"print"` | CSS media queries: `print` or `screen` |
|
|
88
|
+
| `title` | Unset | PDF metadata title |
|
|
89
|
+
| `pageNumbers` | `false` | `true` or `{ template, align, fontSize }` for an automatic text footer |
|
|
90
|
+
| `baseUrl` | `https://blitz-pdf.invalid/` | Resolve relative asset URLs |
|
|
91
|
+
| `assets` | `{}` | Resource map or `(url) => data / Promise<data>`; data is a UTF-8 string, `Uint8Array`, or `ArrayBuffer` |
|
|
92
|
+
| `fonts` | `[]` | Additional static TTF, OTF, WOFF, or WOFF2 font bytes |
|
|
93
|
+
| `maxPages` | `100` | Reject larger documents; maximum 1000 |
|
|
94
|
+
|
|
95
|
+
Lengths accept numbers in CSS pixels (96 px = 1 inch), or strings with `px`,
|
|
96
|
+
`pt`, `mm`, `cm`, or `in`. PDF dimensions use 72 points per inch. Page dimensions
|
|
97
|
+
are limited to 19200 CSS pixels; margins must leave printable content.
|
|
98
|
+
`getEngineVersion()` returns the package version and pinned Blitz revision.
|
|
99
|
+
|
|
100
|
+
## Resources and fonts
|
|
101
|
+
|
|
102
|
+
The renderer requests resources through `assets` or decodes data URLs. Supply an
|
|
103
|
+
asset map or a loading function; network and file access are controlled by your
|
|
104
|
+
function. Missing resources fail with an error.
|
|
105
|
+
Linked CSS, nested imports, images, and `@font-face` use the same resolver.
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
const pdf = await renderPdf(`
|
|
109
|
+
<link rel="stylesheet" href="invoice.css">
|
|
110
|
+
<img src="logo.png" width="80">
|
|
111
|
+
<h1>Invoice</h1>
|
|
112
|
+
`, {
|
|
113
|
+
baseUrl: "https://example.com/documents/",
|
|
114
|
+
assets: {
|
|
115
|
+
"invoice.css": "h1 { color: navy }",
|
|
116
|
+
"logo.png": new Uint8Array(await (await fetch("/logo.png")).arrayBuffer()),
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For dynamic loading, `assets` can be an async function in Bun, Node, browsers,
|
|
122
|
+
and workers:
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
const pdf = await renderPdf(`
|
|
126
|
+
<link rel="stylesheet" href="invoice.css">
|
|
127
|
+
<img src="logo.png" width="80">
|
|
128
|
+
<h1>Invoice</h1>
|
|
129
|
+
`, {
|
|
130
|
+
baseUrl: "https://example.com/documents/",
|
|
131
|
+
assets: async (url) => {
|
|
132
|
+
const response = await fetch(url);
|
|
133
|
+
if (!response.ok) throw new Error(`HTTP ${response.status} loading ${url}`);
|
|
134
|
+
return response.arrayBuffer();
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The callback receives an **absolute URL string**, resolved against the document
|
|
140
|
+
or referring stylesheet. Return UTF-8 text, a `Uint8Array` (including a Node/Bun
|
|
141
|
+
`Buffer`), or an `ArrayBuffer`; synchronous returns also work. For filesystem
|
|
142
|
+
assets, use a `file:` base URL and return `readFile(new URL(url))` in your callback.
|
|
143
|
+
`AssetData`, `AssetMap`, and `AssetResolver` are exported TypeScript types.
|
|
144
|
+
|
|
145
|
+
Blitz discovers resources as it parses and lays out the document, including
|
|
146
|
+
nested CSS imports, font faces, and CSS background images. Loading completes
|
|
147
|
+
before pagination and PDF serialization. Each absolute URL is loaded once per
|
|
148
|
+
render and cached for that render; data URLs bypass the callback. Up to eight
|
|
149
|
+
independent callbacks run concurrently. Concurrent renders have separate caches.
|
|
150
|
+
Browser callbacks follow the browser's normal CORS rules.
|
|
151
|
+
|
|
152
|
+
Returning `null` or `undefined` rejects the render as a missing asset. A thrown
|
|
153
|
+
error or rejected promise includes the resource URL and preserves the original
|
|
154
|
+
error as `cause`. Invalid return types and assets exceeding the combined 64 MiB
|
|
155
|
+
limit also reject. Already-running callbacks may finish after another callback
|
|
156
|
+
fails; their results are discarded. Apply fetch timeouts in your loader when
|
|
157
|
+
needed. The existing asset-map API continues to work.
|
|
158
|
+
|
|
159
|
+
DejaVu Sans regular, bold, italic, and bold italic are bundled; DejaVu Sans Mono
|
|
160
|
+
backs `monospace`. Other generic families fall back to DejaVu Sans. There is no
|
|
161
|
+
system font discovery. Fonts passed in `fonts` use their internal family names;
|
|
162
|
+
use `@font-face` with an asset URL for a CSS alias. Supply fonts for scripts not
|
|
163
|
+
covered by the bundled family.
|
|
164
|
+
|
|
165
|
+
Input limits: 16 MiB HTML, 64 MiB supplied assets, 32 MiB supplied fonts, and 1024
|
|
166
|
+
resource requests. These are practical limits, not a complete sandbox; isolate
|
|
167
|
+
untrusted documents in a terminable worker with application limits.
|
|
168
|
+
|
|
169
|
+
## PDF/A-3 conformance
|
|
170
|
+
|
|
171
|
+
Every successful render targets **PDF/A-3u (ISO 19005-3, level U)**. The PDF 1.7
|
|
172
|
+
output includes embedded fonts and Unicode mappings, an sRGB ICC output intent,
|
|
173
|
+
device-independent colors, PDF/A identification in XMP, document IDs, and a UTC
|
|
174
|
+
creation timestamp. Text remains selectable; no page or text rasterization is
|
|
175
|
+
used. Transparency and source images remain supported.
|
|
176
|
+
|
|
177
|
+
Krilla's archival validator runs during serialization. Nonconforming inputs,
|
|
178
|
+
such as a missing glyph or a font with restricted embedding permissions, fail
|
|
179
|
+
the render instead of producing a mislabeled file. Use fonts licensed for
|
|
180
|
+
embedding. Level U does not require a structure tree; tagged PDF/A-3a is not
|
|
181
|
+
implemented.
|
|
182
|
+
|
|
183
|
+
The independent conformance test captures PDFs from the Bun integration suite
|
|
184
|
+
and validates each with [veraPDF](https://docs.verapdf.org/cli/validation/).
|
|
185
|
+
It also requires a deliberately nonconforming control PDF to fail validation.
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
# Development/CI only; Java 21 and unzip are required for installation.
|
|
189
|
+
npm run setup:verapdf
|
|
190
|
+
npm run test:pdfa
|
|
191
|
+
# Or use an existing installation:
|
|
192
|
+
VERAPDF_BIN=/path/to/verapdf npm run test:pdfa
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The installer pins veraPDF 1.30.3 and verifies its SHA-256 checksum. Reports and
|
|
196
|
+
captured PDFs are saved under `output/pdfa-validation/`. Java and veraPDF are
|
|
197
|
+
not runtime dependencies of the npm package.
|
|
198
|
+
|
|
199
|
+
## Page breaks
|
|
200
|
+
|
|
201
|
+
Pagination uses the printable area after `margin`. Supported controls in normal
|
|
202
|
+
vertical flow include:
|
|
203
|
+
|
|
204
|
+
- `break-before` / `break-after`: `page`, `always`, `avoid`, `avoid-page`,
|
|
205
|
+
`left`, `right`, `recto`, and `verso`.
|
|
206
|
+
- `break-inside: avoid` / `avoid-page`, plus legacy `page-break-before`,
|
|
207
|
+
`page-break-after`, and `page-break-inside` aliases.
|
|
208
|
+
- Inherited `widows` and `orphans` (positive integers; default 2).
|
|
209
|
+
- Automatic protection of text lines, table rows, images, and SVG boxes.
|
|
210
|
+
|
|
211
|
+
```html
|
|
212
|
+
<style>
|
|
213
|
+
h2 { break-after: avoid; }
|
|
214
|
+
.chapter { break-before: page; }
|
|
215
|
+
.card { break-inside: avoid; }
|
|
216
|
+
p { widows: 3; orphans: 3; }
|
|
217
|
+
</style>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Selectors, external stylesheets, print/screen queries, variables, specificity,
|
|
221
|
+
and `!important` use Stylo's real cascade. Adjacent forced breaks coalesce;
|
|
222
|
+
first/last break rules do not add accidental blank pages. Left/right/recto/verso
|
|
223
|
+
may intentionally insert a blank page, respecting the document's direction.
|
|
224
|
+
All pages, including intentional blanks, count toward `maxPages`.
|
|
225
|
+
|
|
226
|
+
Forced breaks take precedence over keep-together rules. Blocks larger than a
|
|
227
|
+
page are allowed to fragment, and impossible widow/orphan constraints are
|
|
228
|
+
relaxed to make progress. A text line that cannot fit the printable height
|
|
229
|
+
fails explicitly. Keep-with-next protects a heading even when the following
|
|
230
|
+
paragraph spans multiple pages.
|
|
231
|
+
|
|
232
|
+
### Page numbers
|
|
233
|
+
|
|
234
|
+
```js
|
|
235
|
+
const pdf = await renderPdf(html, {
|
|
236
|
+
format: "A4",
|
|
237
|
+
margin: "17mm",
|
|
238
|
+
pageNumbers: {
|
|
239
|
+
template: "RE-2026-1042 · Seite {page} von {pages}",
|
|
240
|
+
align: "right",
|
|
241
|
+
fontSize: "8pt",
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
`pageNumbers: true` defaults to `"{page} / {pages}"`, right alignment, and
|
|
247
|
+
12 CSS pixels (9pt). The template is a single line containing `{page}` and
|
|
248
|
+
optionally `{pages}`. Alignment accepts `left`, `center`, or `right`; font size
|
|
249
|
+
accepts the usual lengths, from 1 to 48 CSS pixels. A template that does not
|
|
250
|
+
fit the page width fails explicitly.
|
|
251
|
+
|
|
252
|
+
The renderer reserves a footer band of `2 × fontSize + 8px` above the bottom
|
|
253
|
+
margin **before pagination**. Numbers use the final page count, including
|
|
254
|
+
intentional blanks. The footer uses embedded DejaVu Sans and the same Unicode
|
|
255
|
+
shaping as body text, preserving selectable text and PDF/A-3u. It works with
|
|
256
|
+
async assets in every runtime. `PageNumberOptions` is an exported TypeScript type.
|
|
257
|
+
|
|
258
|
+
## German invoice example
|
|
259
|
+
|
|
260
|
+
```sh
|
|
261
|
+
npm run example:german-invoice
|
|
262
|
+
# Or run the same generator using Bun:
|
|
263
|
+
bun examples/german-invoice.mjs
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Creates `output/pdf/german-invoice.pdf`: three A4 pages, 24 itemized services,
|
|
267
|
+
German dates and currency, supplier/customer details, invoice and order numbers,
|
|
268
|
+
a service period, a 3% project discount, 19% VAT, payment details, and automatic
|
|
269
|
+
“Seite X von Y” footers. The final amount is **25.631,23 EUR**. Calculations use
|
|
270
|
+
integer cents and half-up rounding. The stylesheet loads through the async
|
|
271
|
+
`assets` callback. The generator also writes the HTML/CSS and calculated totals
|
|
272
|
+
alongside the PDF for inspection.
|
|
273
|
+
|
|
274
|
+
The [example source and scope](examples/german-invoice/README.md) explain the
|
|
275
|
+
fictitious data and the German invoice fields. This is a **PDF/A-3u example
|
|
276
|
+
without embedded XML**, as opposed to a structured e-invoice. Its 2026 domestic
|
|
277
|
+
B2B scenario assumes the recipient agrees to PDF delivery under the applicable
|
|
278
|
+
transition rule. [§ 14 UStG](https://www.gesetze-im-internet.de/ustg_1980/__14.html),
|
|
279
|
+
[§ 27(38) UStG](https://www.gesetze-im-internet.de/ustg_1980/__27.html).
|
|
280
|
+
|
|
281
|
+
## Current limits
|
|
282
|
+
|
|
283
|
+
- CSS support follows Blitz, whose coverage is evolving.
|
|
284
|
+
- Text retains shaped glyphs and Unicode cluster mappings, including ligatures.
|
|
285
|
+
Unrecognized or ambiguous text runs are rejected rather than assigned guessed
|
|
286
|
+
Unicode.
|
|
287
|
+
- Pagination fragments one continuous vertical layout. CSS `@page`, repeated
|
|
288
|
+
table/fixed headers, nested multicolumn fragmentation, and independent
|
|
289
|
+
fragmentation of parallel flex/grid flows are not implemented. Oversized
|
|
290
|
+
boxes/images may span pages; box decorations are sliced rather than cloned.
|
|
291
|
+
- CSS filters, blurred shadows, non-default variable font instances, and
|
|
292
|
+
repeating radial gradients are rejected. Use static font faces. There is no
|
|
293
|
+
automatic raster fallback.
|
|
294
|
+
- Gradients become sRGB PDF shadings; advanced CSS interpolation spaces may
|
|
295
|
+
differ. SVG shapes stay vector; upstream SVG text may become vector outlines.
|
|
296
|
+
- Scripts are not executed. Interactive forms, link annotations, accessibility
|
|
297
|
+
tags, encryption, and signatures are not generated.
|
|
298
|
+
|
|
299
|
+
## Development
|
|
300
|
+
|
|
301
|
+
Install Node.js 22.13+ for development tooling, Bun, and rustup. The repository
|
|
302
|
+
pins Rust 1.99.0 and its WASM target in `rust-toolchain.toml`.
|
|
303
|
+
|
|
304
|
+
```sh
|
|
305
|
+
npm ci
|
|
306
|
+
cargo install wasm-bindgen-cli --version 0.2.129 --locked
|
|
307
|
+
npm run build
|
|
308
|
+
bun test
|
|
309
|
+
npm run test:node
|
|
310
|
+
npm run example:node
|
|
311
|
+
# or: bun run example:bun
|
|
312
|
+
npm pack
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
The wasm-bindgen CLI version must match `Cargo.lock`. Dependencies and upstream
|
|
316
|
+
commits are locked. `npm pack` verifies artifacts and renders a PDF before making
|
|
317
|
+
the tarball; it does not publish. Install locally using
|
|
318
|
+
`npm install ./blitz-pdf-0.1.0.tgz`.
|
|
319
|
+
|
|
320
|
+
The pinned Stylo source in `vendor/stylo` enables paged-media properties in the
|
|
321
|
+
Servo build; `vendor/README.md` records the small patch. Its MPL-2.0 source is
|
|
322
|
+
included in the npm archive.
|
|
323
|
+
|
|
324
|
+
`bun test` exercises the compiled module through its public package export. Tests
|
|
325
|
+
extract Unicode with PDF.js and inspect embedded fonts, vector paths, absence
|
|
326
|
+
of page images, dimensions, pagination, assets, media queries, and error recovery.
|
|
327
|
+
For browser verification, run `npm run test:browser` and open
|
|
328
|
+
`http://127.0.0.1:4173`. CI builds WASM, runs Bun and Node tests, validates the
|
|
329
|
+
captured PDFs with veraPDF, benchmarks, and packs an npm artifact.
|
|
330
|
+
|
|
331
|
+
## Performance benchmarks
|
|
332
|
+
|
|
333
|
+
```sh
|
|
334
|
+
bun run bench
|
|
335
|
+
bun run bench --iterations=50 --warmup=5
|
|
336
|
+
bun run bench --iterations=50 --warmup=5 --json > benchmark-results.json
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Benchmarks measure WASM initialization separately, then first-render, mean,
|
|
340
|
+
median, p95, throughput, and output size for small HTML, a styled invoice,
|
|
341
|
+
100 paragraphs, matching asset-map/async-loader documents with nested CSS
|
|
342
|
+
and a font, and the complete three-page German invoice with page numbers.
|
|
343
|
+
The async benchmarks use in-memory data to measure resolver overhead
|
|
344
|
+
without network latency. Warmed samples include parsing, styling/layout,
|
|
345
|
+
painting, font subsetting, and PDF serialization. Resource fetches, file writes, and process
|
|
346
|
+
startup are excluded. Each iteration renders a new document. JSON records the
|
|
347
|
+
runtime, platform, sample count, and RSS.
|
|
348
|
+
|
|
349
|
+
Results depend on hardware, engine, fonts, and document complexity. Run on your
|
|
350
|
+
deployment hardware. CI records results without a timing threshold on shared
|
|
351
|
+
runners.
|
|
352
|
+
|
|
353
|
+
## License
|
|
354
|
+
|
|
355
|
+
MIT. See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) and `licenses/` for
|
|
356
|
+
dependencies and fonts. This is an independent integration.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
blitz-pdf is an independent project, not an official Dioxus Labs package.
|
|
4
|
+
|
|
5
|
+
The distributed WebAssembly module includes:
|
|
6
|
+
|
|
7
|
+
- [Blitz](https://github.com/DioxusLabs/blitz), MIT OR Apache-2.0, pinned to `e72650a6e67941852fddf025295cfee30c39ea32`.
|
|
8
|
+
- [Krilla](https://github.com/LaurenzV/krilla), MIT OR Apache-2.0, for PDF serialization and font subsetting.
|
|
9
|
+
- [Parley](https://github.com/linebender/parley), MIT OR Apache-2.0, for text layout.
|
|
10
|
+
- [Stylo](https://github.com/servo/stylo), MPL-2.0, for CSS styling.
|
|
11
|
+
- [Taffy](https://github.com/DioxusLabs/taffy), MIT, for layout.
|
|
12
|
+
|
|
13
|
+
The resolved dependency inventory and upstream license notices are in
|
|
14
|
+
`licenses/RUST_DEPENDENCIES.txt`. `Cargo.lock` pins versions and source commits.
|
|
15
|
+
Upstream sources are available at the repository links in that inventory and
|
|
16
|
+
through crates.io. Stylo 0.22.0 is patched to expose paged-media CSS properties
|
|
17
|
+
in its Servo build. Its full modified MPL-2.0 source and license are included in
|
|
18
|
+
`vendor/stylo`; `vendor/README.md` lists the changes. Other dependencies are used
|
|
19
|
+
without source modifications.
|
|
20
|
+
|
|
21
|
+
Bundled DejaVu fonts use the Bitstream Vera / DejaVu license reproduced in
|
|
22
|
+
`licenses/DejaVu.txt`. The regular WOFF2 comes from Blitz's
|
|
23
|
+
`examples/wasm_hello/assets/DejaVuSans.woff2` at the pinned revision. Other faces
|
|
24
|
+
are from the official DejaVu 2.37 TTF release. Fonts are subsetted and embedded
|
|
25
|
+
in generated PDFs.
|
package/assets/icon.svg
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
2
|
+
<rect width="64" height="64" rx="14" fill="#2563eb"/>
|
|
3
|
+
<text x="32" y="32" dy="0.35em" text-anchor="middle" font-family="ui-sans-serif, system-ui, -apple-system, sans-serif" font-size="26" font-weight="600" fill="#ffffff">BP</text>
|
|
4
|
+
</svg>
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InitOptions, PdfOptions, WasmSource } from "./types.js";
|
|
2
|
+
export declare function createApi(defaultSource: () => Promise<WasmSource> | WasmSource, prepare?: (source: WasmSource) => Promise<WasmSource>): {
|
|
3
|
+
init: (options?: InitOptions) => Promise<void>;
|
|
4
|
+
renderPdf: (html: string, options?: PdfOptions) => Promise<Uint8Array>;
|
|
5
|
+
getEngineVersion: () => Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEtE,wBAAgB,SAAS,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,EAC7E,OAAO,GAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAA0B;qBAItD,WAAW,KAAQ,OAAO,CAAC,IAAI,CAAC;sBAUxB,MAAM,YAAW,UAAU,KAAQ,OAAO,CAAC,UAAU,CAAC;4BAqBlD,OAAO,CAAC,MAAM,CAAC;EAEnD"}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import loadWasm, { render_pdf, engine_version, RenderJob } from "../wasm/blitz_pdf.js";
|
|
2
|
+
import { createAssetLoader } from "./assets.js";
|
|
3
|
+
import { normalizeOptions } from "./options.js";
|
|
4
|
+
export function createApi(defaultSource, prepare = async (source) => source) {
|
|
5
|
+
let ready;
|
|
6
|
+
/** Initialize once. Concurrent callers share initialization; failed loads can be retried. */
|
|
7
|
+
function init(options = {}) {
|
|
8
|
+
if (ready)
|
|
9
|
+
return ready;
|
|
10
|
+
ready = (async () => {
|
|
11
|
+
const source = await prepare(options.wasm ?? await defaultSource());
|
|
12
|
+
await loadWasm({ module_or_path: source });
|
|
13
|
+
})().catch((error) => { ready = undefined; throw error; });
|
|
14
|
+
return ready;
|
|
15
|
+
}
|
|
16
|
+
/** Render HTML/CSS to a vector PDF/A-3u with embedded fonts and selectable text. */
|
|
17
|
+
async function renderPdf(html, options = {}) {
|
|
18
|
+
if (typeof html !== "string")
|
|
19
|
+
throw new TypeError("html must be a string");
|
|
20
|
+
if (new TextEncoder().encode(html).byteLength > 16 * 1024 * 1024)
|
|
21
|
+
throw new RangeError("HTML exceeds the 16 MiB limit");
|
|
22
|
+
const { assetResolver, ...normalized } = normalizeOptions(options);
|
|
23
|
+
await init();
|
|
24
|
+
if (!assetResolver)
|
|
25
|
+
return render_pdf(html, normalized);
|
|
26
|
+
const load = createAssetLoader(assetResolver);
|
|
27
|
+
const job = new RenderJob(html, normalized);
|
|
28
|
+
try {
|
|
29
|
+
for (;;) {
|
|
30
|
+
const urls = job.pending_assets();
|
|
31
|
+
if (urls.length === 0)
|
|
32
|
+
return job.finish();
|
|
33
|
+
const data = await load(urls);
|
|
34
|
+
for (let i = 0; i < urls.length; i++)
|
|
35
|
+
job.provide_asset(urls[i], data[i]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
// In-flight JS loaders never access this job, including after a sibling rejects.
|
|
40
|
+
job.free();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function getEngineVersion() { await init(); return engine_version(); }
|
|
44
|
+
return { init, renderPdf, getEngineVersion };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,UAAU,SAAS,CAAC,aAAqD,EAC7E,UAAuD,KAAK,EAAC,MAAM,EAAC,EAAE,CAAC,MAAM;IAC7E,IAAI,KAAgC,CAAC;IAErC,6FAA6F;IAC7F,SAAS,IAAI,CAAC,UAAuB,EAAE;QACrC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;QACxB,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE;YAClB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,aAAa,EAAE,CAAC,CAAC;YACpE,MAAM,QAAQ,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7C,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,GAAG,KAAK,GAAG,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oFAAoF;IACpF,KAAK,UAAU,SAAS,CAAC,IAAY,EAAE,UAAsB,EAAE;QAC7D,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;QAC3E,IAAI,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI;YAAE,MAAM,IAAI,UAAU,CAAC,+BAA+B,CAAC,CAAC;QACxH,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACnE,MAAM,IAAI,EAAE,CAAC;QACb,IAAI,CAAC,aAAa;YAAE,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACxD,MAAM,IAAI,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,SAAS,CAAC;gBACR,MAAM,IAAI,GAAG,GAAG,CAAC,cAAc,EAAE,CAAC;gBAClC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;oBAAE,OAAO,GAAG,CAAC,MAAM,EAAE,CAAC;gBAC3C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;oBAAE,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAE,EAAE,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,iFAAiF;YACjF,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,CAAC;IACH,CAAC;IAED,KAAK,UAAU,gBAAgB,KAAsB,MAAM,IAAI,EAAE,CAAC,CAAC,OAAO,cAAc,EAAE,CAAC,CAAC,CAAC;IAC7F,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAC/C,CAAC"}
|
package/dist/assets.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AssetData, AssetResolver, BinaryData } from "./types.js";
|
|
2
|
+
export declare const MAX_ASSET_BYTES: number;
|
|
3
|
+
export declare function copyBytes(value: BinaryData, name: string): Uint8Array;
|
|
4
|
+
export declare function assetBytes(value: AssetData, name: string): Uint8Array;
|
|
5
|
+
/** Load independent requests concurrently, with a byte budget shared by all batches of this render. */
|
|
6
|
+
export declare function createAssetLoader(resolver: AssetResolver): (urls: string[]) => Promise<Uint8Array[]>;
|
|
7
|
+
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvE,eAAO,MAAM,eAAe,QAAmB,CAAC;AAEhD,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAKrE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAErE;AAED,uGAAuG;AACvG,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,IAEzC,MAAM,MAAM,EAAE,KAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAwBrD"}
|
package/dist/assets.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const MAX_ASSET_BYTES = 64 * 1024 * 1024;
|
|
2
|
+
export function copyBytes(value, name) {
|
|
3
|
+
// Buffer.slice() creates a view, so use a constructor to snapshot every Uint8Array.
|
|
4
|
+
if (value instanceof Uint8Array)
|
|
5
|
+
return new Uint8Array(value);
|
|
6
|
+
if (value instanceof ArrayBuffer)
|
|
7
|
+
return new Uint8Array(value.slice(0));
|
|
8
|
+
throw new TypeError(`${name} must be a Uint8Array or ArrayBuffer`);
|
|
9
|
+
}
|
|
10
|
+
export function assetBytes(value, name) {
|
|
11
|
+
return typeof value === "string" ? new TextEncoder().encode(value) : copyBytes(value, name);
|
|
12
|
+
}
|
|
13
|
+
/** Load independent requests concurrently, with a byte budget shared by all batches of this render. */
|
|
14
|
+
export function createAssetLoader(resolver) {
|
|
15
|
+
let totalBytes = 0;
|
|
16
|
+
return async (urls) => {
|
|
17
|
+
const results = new Array(urls.length);
|
|
18
|
+
let next = 0;
|
|
19
|
+
let failed = false;
|
|
20
|
+
async function worker() {
|
|
21
|
+
while (!failed && next < urls.length) {
|
|
22
|
+
const index = next++;
|
|
23
|
+
const url = urls[index];
|
|
24
|
+
try {
|
|
25
|
+
let value;
|
|
26
|
+
try {
|
|
27
|
+
value = await resolver(url);
|
|
28
|
+
}
|
|
29
|
+
catch (cause) {
|
|
30
|
+
throw new Error(`Failed to load asset: ${url}`, { cause });
|
|
31
|
+
}
|
|
32
|
+
if (failed)
|
|
33
|
+
return;
|
|
34
|
+
if (value == null)
|
|
35
|
+
throw new Error(`Missing asset: ${url}. The asset resolver returned ${String(value)}`);
|
|
36
|
+
const data = assetBytes(value, `Asset resolver result for ${url}`);
|
|
37
|
+
totalBytes += data.byteLength;
|
|
38
|
+
if (totalBytes > MAX_ASSET_BYTES)
|
|
39
|
+
throw new RangeError("Assets exceed the 64 MiB limit");
|
|
40
|
+
results[index] = data;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
failed = true;
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
await Promise.all(Array.from({ length: Math.min(8, urls.length) }, worker));
|
|
49
|
+
return results;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhD,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,IAAY;IACvD,oFAAoF;IACpF,IAAI,KAAK,YAAY,UAAU;QAAE,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAC9D,IAAI,KAAK,YAAY,WAAW;QAAE,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,sCAAsC,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAgB,EAAE,IAAY;IACvD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC9F,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,iBAAiB,CAAC,QAAuB;IACvD,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,OAAO,KAAK,EAAE,IAAc,EAAyB,EAAE;QACrD,MAAM,OAAO,GAAG,IAAI,KAAK,CAAa,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,KAAK,UAAU,MAAM;YACnB,OAAO,CAAC,MAAM,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;gBACrC,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;gBACrB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAE,CAAC;gBACzB,IAAI,CAAC;oBACH,IAAI,KAAyC,CAAC;oBAC9C,IAAI,CAAC;wBAAC,KAAK,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;oBAAC,CAAC;oBACpC,OAAO,KAAK,EAAE,CAAC;wBAAC,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;oBAAC,CAAC;oBAC7E,IAAI,MAAM;wBAAE,OAAO;oBACnB,IAAI,KAAK,IAAI,IAAI;wBAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,iCAAiC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;oBAC1G,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,EAAE,6BAA6B,GAAG,EAAE,CAAC,CAAC;oBACnE,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC;oBAC9B,IAAI,UAAU,GAAG,eAAe;wBAAE,MAAM,IAAI,UAAU,CAAC,gCAAgC,CAAC,CAAC;oBACzF,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;gBACxB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAAC,MAAM,GAAG,IAAI,CAAC;oBAAC,MAAM,KAAK,CAAC;gBAAC,CAAC;YACjD,CAAC;QACH,CAAC;QACD,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;QAC5E,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { AssetData, AssetMap, AssetResolver, BinaryData, InitOptions, Length, PageFormat, PageNumberOptions, PdfOptions, WasmSource } from "./types.js";
|
|
2
|
+
export declare const init: (options?: import("./types.js").InitOptions) => Promise<void>, renderPdf: (html: string, options?: import("./types.js").PdfOptions) => Promise<Uint8Array>, getEngineVersion: () => Promise<string>;
|
|
3
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7J,eAAO,MAAQ,IAAI,iEAAE,SAAS,oFAAE,gBAAgB,uBAE/C,CAAC"}
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,SAAS,CAC5D,GAAG,EAAE,CAAC,IAAI,GAAG,CAAC,2BAA2B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAC5D,CAAC"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { AssetData, AssetMap, AssetResolver, BinaryData, InitOptions, Length, PageFormat, PageNumberOptions, PdfOptions, WasmSource } from "./types.js";
|
|
2
|
+
export declare const init: (options?: import("./types.js").InitOptions) => Promise<void>, renderPdf: (html: string, options?: import("./types.js").PdfOptions) => Promise<Uint8Array>, getEngineVersion: () => Promise<string>;
|
|
3
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7J,eAAO,MAAQ,IAAI,iEAAE,SAAS,oFAAE,gBAAgB,uBAO/C,CAAC"}
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { createApi } from "./api.js";
|
|
3
|
+
export const { init, renderPdf, getEngineVersion } = createApi(() => readFile(new URL("../wasm/blitz_pdf_bg.wasm", import.meta.url)), async (source) => {
|
|
4
|
+
if (source instanceof URL && source.protocol === "file:")
|
|
5
|
+
return readFile(source);
|
|
6
|
+
if (typeof source === "string" && source.startsWith("file:"))
|
|
7
|
+
return readFile(new URL(source));
|
|
8
|
+
return source;
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,SAAS,CAC5D,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,2BAA2B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EACrE,KAAK,EAAC,MAAM,EAAC,EAAE;IACb,IAAI,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;IAClF,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,QAAQ,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/F,OAAO,MAAM,CAAC;AAChB,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PdfOptions } from "./types.js";
|
|
2
|
+
export declare function normalizeOptions(options?: PdfOptions): {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
margin: {
|
|
6
|
+
top: number;
|
|
7
|
+
right: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
left: number;
|
|
10
|
+
};
|
|
11
|
+
media: "print" | "screen";
|
|
12
|
+
maxPages: number;
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
assets: Record<string, Uint8Array<ArrayBufferLike>>;
|
|
15
|
+
assetResolver: import("./types.js").AssetResolver | undefined;
|
|
16
|
+
fonts: Uint8Array<ArrayBufferLike>[];
|
|
17
|
+
pageNumbers: {
|
|
18
|
+
template: string;
|
|
19
|
+
align: "left" | "center" | "right";
|
|
20
|
+
fontSize: number;
|
|
21
|
+
} | null;
|
|
22
|
+
title: string | null;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyC,UAAU,EAAE,MAAM,YAAY,CAAC;AA8BpF,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,UAAe;;;;;;;;;;;;;;;;kBAwB1B,MAAM;eAAS,MAAM,GAAG,QAAQ,GAAG,OAAO;kBAAY,MAAM;;;EA6C1F"}
|