turbo-html2pdf 0.1.1 → 0.1.3
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/Cargo.toml +7 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/lib.rs +15 -24
- package/turbo-pdf-napi.darwin-arm64.node +0 -0
- package/turbo-pdf-napi.linux-arm64-gnu.node +0 -0
- package/turbo-pdf-napi.linux-x64-gnu.node +0 -0
- package/turbo-pdf-napi.linux-x64-musl.node +0 -0
- package/turbo-pdf-napi.win32-x64-msvc.node +0 -0
package/Cargo.toml
CHANGED
|
@@ -29,5 +29,12 @@ serde_json = { workspace = true }
|
|
|
29
29
|
napi = { version = "2", default-features = false, features = ["napi6", "serde-json"] }
|
|
30
30
|
napi-derive = "2"
|
|
31
31
|
|
|
32
|
+
[features]
|
|
33
|
+
# Passthrough for the core `svg` feature (vector `<img>` via resvg). OFF by
|
|
34
|
+
# default: the standard `turbo-html2pdf` package ships without it. The separate
|
|
35
|
+
# `turbo-html2pdf-svg` package is built with `napi build --features svg` (see the
|
|
36
|
+
# `build-napi-svg`/`publish-svg` jobs in .github/workflows/release.yml).
|
|
37
|
+
svg = ["turbo-pdf-core/svg"]
|
|
38
|
+
|
|
32
39
|
[build-dependencies]
|
|
33
40
|
napi-build = "2"
|
package/README.md
CHANGED
|
@@ -201,7 +201,7 @@ fs.writeFileSync('out.pdf', pdf) // %PDF-1.7
|
|
|
201
201
|
|
|
202
202
|
## Status
|
|
203
203
|
|
|
204
|
-
`v0.1.
|
|
204
|
+
`v0.1.3`. The core engine is complete and heavily tested (the `turbo-pdf-core`
|
|
205
205
|
crate holds 100% line coverage with a cyclomatic-complexity ≤ 5 gate). Bindings:
|
|
206
206
|
Node (napi) and WebAssembly. See [`docs/`](https://github.com/miaskiewicz/turbo-html2pdf/blob/main/docs/) for the full guide and
|
|
207
207
|
[`benches/competitive/`](https://github.com/miaskiewicz/turbo-html2pdf/blob/main/benches/competitive/) for the benchmark harness.
|
package/package.json
CHANGED
package/src/lib.rs
CHANGED
|
@@ -119,30 +119,14 @@ impl JsEncryption {
|
|
|
119
119
|
/// all-granted default.
|
|
120
120
|
fn into_core(self) -> Encryption {
|
|
121
121
|
let mut perms = Permissions::all();
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
if let Some(v) = self.annotate {
|
|
132
|
-
perms.annotate = v;
|
|
133
|
-
}
|
|
134
|
-
if let Some(v) = self.fill_forms {
|
|
135
|
-
perms.fill_forms = v;
|
|
136
|
-
}
|
|
137
|
-
if let Some(v) = self.accessibility {
|
|
138
|
-
perms.accessibility = v;
|
|
139
|
-
}
|
|
140
|
-
if let Some(v) = self.assemble {
|
|
141
|
-
perms.assemble = v;
|
|
142
|
-
}
|
|
143
|
-
if let Some(v) = self.high_quality_print {
|
|
144
|
-
perms.high_quality_print = v;
|
|
145
|
-
}
|
|
122
|
+
apply_perm(&mut perms.print, self.print);
|
|
123
|
+
apply_perm(&mut perms.modify, self.modify);
|
|
124
|
+
apply_perm(&mut perms.copy, self.copy);
|
|
125
|
+
apply_perm(&mut perms.annotate, self.annotate);
|
|
126
|
+
apply_perm(&mut perms.fill_forms, self.fill_forms);
|
|
127
|
+
apply_perm(&mut perms.accessibility, self.accessibility);
|
|
128
|
+
apply_perm(&mut perms.assemble, self.assemble);
|
|
129
|
+
apply_perm(&mut perms.high_quality_print, self.high_quality_print);
|
|
146
130
|
Encryption {
|
|
147
131
|
user_password: self.user_password,
|
|
148
132
|
owner_password: self.owner_password,
|
|
@@ -151,6 +135,13 @@ impl JsEncryption {
|
|
|
151
135
|
}
|
|
152
136
|
}
|
|
153
137
|
|
|
138
|
+
/// Apply an optional permission override onto a slot (no-op when `None`).
|
|
139
|
+
fn apply_perm(slot: &mut bool, over: Option<bool>) {
|
|
140
|
+
if let Some(v) = over {
|
|
141
|
+
*slot = v;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
154
145
|
/// A page watermark. Set `text` for a shaped-word mark (defaulting to `DRAFT`
|
|
155
146
|
/// when omitted) or `image` for a raster mark resolved by name through `images`;
|
|
156
147
|
/// the two are mutually exclusive (`image` wins if both are set). All other
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|