Module: Pdfsink::Cli Private
- Defined in:
- lib/pdfsink/cli.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Low-level runner for the pdfsink-rs CLI binary.
This module is not intended for direct use – see the public API on Pdfsink, Document, and Page instead. Every method shells out to the binary, returning either its raw stdout (for text) or the parsed JSON it prints.
Constant Summary collapse
- BINARY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"pdfsink-rs"
Class Attribute Summary collapse
-
.binary ⇒ String
private
Absolute path to the pdfsink-rs binary.
Class Method Summary collapse
-
.info(path) ⇒ Hash
private
Document-level metadata for every page: dimensions, rotation, bbox, and per-page object counts.
-
.links(path, page) ⇒ Array<Hash>
private
Hyperlinks on a single page.
-
.objects(path, page) ⇒ Hash
private
All page objects (chars, lines, rects, curves, images, …) as a dict.
-
.search(path, page, pattern) ⇒ Array<Hash>
private
Regex search matches for a single page.
-
.table(path, page, strategy) ⇒ Array<Array>?
private
Extracted table for a single page, or nil if none was found.
-
.text(path, page) ⇒ String
private
Extracted text for a single page.
-
.version ⇒ String
private
The pdfsink-rs version string, e.g.
-
.words(path, page) ⇒ Array<Hash>
private
Words with positions for a single page.
Class Attribute Details
.binary ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Absolute path to the pdfsink-rs binary. Search order:
1. PDFSINK_BIN environment variable (explicit override)
2. lib/pdfsink/ inside the gem (where extconf.rb copies the build)
3. ext/pdfsink/bin/ (dev / cargo-install location)
4. The bare name, resolved against PATH at exec time
26 27 28 |
# File 'lib/pdfsink/cli.rb', line 26 def binary @binary ||= find_binary end |
Class Method Details
.info(path) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Document-level metadata for every page: dimensions, rotation, bbox, and per-page object counts.
48 49 50 |
# File 'lib/pdfsink/cli.rb', line 48 def info(path) run_json("info", path) end |
.links(path, page) ⇒ Array<Hash>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Hyperlinks on a single page.
85 86 87 |
# File 'lib/pdfsink/cli.rb', line 85 def links(path, page) run_json("links", path, page.to_s) end |
.objects(path, page) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
All page objects (chars, lines, rects, curves, images, …) as a dict.
78 79 80 |
# File 'lib/pdfsink/cli.rb', line 78 def objects(path, page) run_json("objects", path, page.to_s) end |
.search(path, page, pattern) ⇒ Array<Hash>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Regex search matches for a single page.
71 72 73 |
# File 'lib/pdfsink/cli.rb', line 71 def search(path, page, pattern) run_json("search", path, page.to_s, pattern) end |
.table(path, page, strategy) ⇒ Array<Array>?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extracted table for a single page, or nil if none was found.
93 94 95 |
# File 'lib/pdfsink/cli.rb', line 93 def table(path, page, strategy) run_json("table", path, page.to_s, strategy) end |
.text(path, page) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extracted text for a single page.
57 58 59 |
# File 'lib/pdfsink/cli.rb', line 57 def text(path, page) run("text", path, page.to_s) end |
.version ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The pdfsink-rs version string, e.g. “pdfsink-rs 0.2.8”.
The CLI has no version subcommand, so this reports the crate version the gem was built against.
39 40 41 |
# File 'lib/pdfsink/cli.rb', line 39 def version Pdfsink::PDFSINK_RS_VERSION end |
.words(path, page) ⇒ Array<Hash>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Words with positions for a single page.
64 65 66 |
# File 'lib/pdfsink/cli.rb', line 64 def words(path, page) run_json("words", path, page.to_s) end |