rustpdf 0.2.0-x86_64-linux → 0.4.0-x86_64-linux

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95d16a8b08efac40f62d3b34401df96783fe696d1087b91cc28ee2024b36eb67
4
- data.tar.gz: 3975ed0333b5a5ac46ece57182b763c815bb8dc4e5f13586461d7ec3bba0a04f
3
+ metadata.gz: 927dc1a17caf2b405b6f76aae4fcbb8e2fcb60eed178eba44aa314ff491c4d25
4
+ data.tar.gz: 57a660201a0e93cd3e0f2be2367819464a62f22c4cc5056f4e470b5edbbcaec4
5
5
  SHA512:
6
- metadata.gz: 77a9b727af0be789c3bf95c82ba55f76c65cae9f8503e68eb528bc423404955cb61a79fbdb368191bc7448e5e24b4364e0835a27157c50851e45fd67d0a296be
7
- data.tar.gz: bc65a31c85ff678f1a17012fdfa318932e566629570be38c668322802adadf1d2365d1b88518807270065fc7d35139d852caca4ce698aef2b9ef95cd7806bcdd
6
+ metadata.gz: ec46a8638b228b00a6c2728b636824b924896554b8e8b3f0734b1a4d3108db2ac87680949a89852aab9bc596728e59e81e4ed665ca57d15140188e746fe000ba
7
+ data.tar.gz: 3c911b62b6e32ffcfba2e1d9a072a005d545d3f5d367902e42c8bfd2060969bfd3b96c291aa10fb28946f810b18de6dd3104b835e73538f1774ef8f2c1283e7e
data/README.md CHANGED
@@ -6,7 +6,7 @@ covers the whole product surface: vector graphics, embedded/subsetted fonts and
6
6
  text, wrapping paragraphs, images, **PDF/A** (levels 1b–3a),
7
7
  **tagged/accessible** output, embedded-file attachments, **AcroForm** fields,
8
8
  manipulation (merge/split/rotate/optimize/incremental update), **text
9
- extraction**, **encryption** (RC4 / AES-128 / AES-256) and **digital signatures**
9
+ extraction**, **page rendering** (page to PNG image), **encryption** (RC4 / AES-128 / AES-256) and **digital signatures**
10
10
  (PKCS#7 / PAdES) — plus **feature licensing**.
11
11
 
12
12
  Files (module `RustPdf`):
@@ -46,7 +46,7 @@ ed.encrypt(method: RustPdf::Cipher::AES256, owner: "owner").save("secured.pdf")
46
46
  signed = RustPdf.sign(data, key_der, cert_der, pades: true)
47
47
  ```
48
48
 
49
- Corporate features (PDF/A, signing, encryption, accessibility) require a license;
49
+ Corporate features (PDF/A, signing, encryption, accessibility, page rendering — a **Pro** feature) require a license;
50
50
  without one they raise `RustPdf::Error`. See [`docs/LICENSING.md`](../../docs/LICENSING.md).
51
51
 
52
52
  ## Test
@@ -79,6 +79,8 @@ module RustPdf
79
79
 
80
80
  "pdf_extract_text" => [[VP, SZ, VP, VP], I],
81
81
  "pdf_extract_images_to_dir" => [[VP, SZ, VP, VP], I],
82
+ "pdf_render_page_to_png" => [[VP, SZ, SZ, D, VP, VP], I],
83
+ "pdf_page_count" => [[VP, SZ, VP], I],
82
84
  "pdf_sign" => [[VP, SZ, VP, SZ, VP, SZ, VP, VP, VP, I, VP, VP], I],
83
85
  "pdf_timestamp" => [[VP, SZ, VP, SZ, VP, SZ, VP, VP, VP], I],
84
86
  "pdf_add_dss" => [[VP, SZ, VP, VP, SZ, VP, VP, SZ, VP, VP], I],
data/lib/rustpdf.rb CHANGED
@@ -25,6 +25,10 @@ module RustPdf
25
25
  A2A = 2
26
26
  A3B = 3
27
27
  A3A = 4
28
+ # PDF/A-4 (ISO 19005-4), based on PDF 2.0.
29
+ A4 = 5
30
+ A4E = 6
31
+ A4F = 7
28
32
  end
29
33
 
30
34
  # Paragraph alignment.
@@ -115,6 +119,20 @@ module RustPdf
115
119
  count[0, Native::SIZEOF_SZ].unpack1("J")
116
120
  end
117
121
 
122
+ # Render page +page+ (0-based) of +pdf+ to a PNG image at +dpi+
123
+ # dots-per-inch. Page rendering is a licensed Pro feature: raises unless a
124
+ # license granting it is active.
125
+ def render_page_to_png(pdf, page = 0, dpi = 150.0)
126
+ take_bytes { |pp, pn| Native.call("pdf_render_page_to_png", pdf, pdf.bytesize, page, dpi.to_f, pp, pn) }
127
+ end
128
+
129
+ # Number of pages in +pdf+ (free — no license required).
130
+ def page_count(pdf)
131
+ count = Fiddle::Pointer.malloc(Native::SIZEOF_SZ, Fiddle::RUBY_FREE)
132
+ check(Native.call("pdf_page_count", pdf, pdf.bytesize, count))
133
+ count[0, Native::SIZEOF_SZ].unpack1("J")
134
+ end
135
+
118
136
  # Validate every signature in +pdf+. Returns one Hash per signature with keys
119
137
  # "field_name", "sub_filter", "signer", "covers_whole_document",
120
138
  # "digest_valid", "signature_valid", "is_valid" and "byte_range". An empty
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rustpdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - rust-pdf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-28 00:00:00.000000000 Z
11
+ date: 2026-06-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Idiomatic Ruby binding over the rust-pdf C ABI (libpdf_ffi) using the
14
14
  built-in Fiddle stdlib.