ironpress 1.4.1
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 +7 -0
- data/Cargo.toml +13 -0
- data/README.md +35 -0
- data/ext/ironpress/extconf.rb +2 -0
- data/lib/ironpress.rb +7 -0
- data/src/lib.rs +21 -0
- metadata +63 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a8b3f2e0d143d70b639e046af56f03eea96c37fa0a390e97e2f99df0bed83b29
|
|
4
|
+
data.tar.gz: 83c5ff6b10889dce1f638f9002018bb8d96c9824b2b4a163955669e4320a40c3
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: eb57314872bb3c1f926c1efed4b52d94a432bd6515cfdde4237d6ca514f977c5382b5a8f72a7185ad79e05d321f73edd4e06476ebd41fdd0563e4bbae93dd486
|
|
7
|
+
data.tar.gz: 6400a6185997a6988e29fe9f4e8f0d03eb45b7330e00d51f937eabc1913f536ee5f0a58e7fceb4059112f296c5dd21225b7c7630259d265e8a8c0ba5f660c86e
|
data/Cargo.toml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "ironpress-ruby"
|
|
3
|
+
version = "1.4.1"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
publish = false
|
|
6
|
+
|
|
7
|
+
[lib]
|
|
8
|
+
name = "ironpress_ruby"
|
|
9
|
+
crate-type = ["cdylib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
ironpress-core = { path = "../..", package = "ironpress" }
|
|
13
|
+
magnus = "0.7"
|
data/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Ironpress
|
|
2
|
+
|
|
3
|
+
Pure Rust HTML/CSS/Markdown to PDF converter. No browser, no system dependencies.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
gem install ironpress
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or in your Gemfile:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem "ironpress"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
require "ironpress"
|
|
21
|
+
|
|
22
|
+
# HTML to PDF
|
|
23
|
+
pdf = Ironpress.html_to_pdf("<h1>Hello World</h1><p>Generated with Ironpress.</p>")
|
|
24
|
+
File.binwrite("output.pdf", pdf)
|
|
25
|
+
|
|
26
|
+
# Markdown to PDF
|
|
27
|
+
pdf = Ironpress.markdown_to_pdf("# Hello\n\nGenerated from **Markdown**.")
|
|
28
|
+
File.binwrite("output.pdf", pdf)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Performance
|
|
32
|
+
|
|
33
|
+
- **10-100x faster** than browser-based solutions (Puppeteer, wkhtmltopdf)
|
|
34
|
+
- **~5MB** native extension, no runtime dependencies
|
|
35
|
+
- Instant startup, no browser process
|
data/lib/ironpress.rb
ADDED
data/src/lib.rs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
use magnus::{Error, RString, Ruby, define_module, function, prelude::*};
|
|
2
|
+
|
|
3
|
+
fn html_to_pdf(ruby: &Ruby, html: String) -> Result<RString, Error> {
|
|
4
|
+
let pdf = ironpress_core::html_to_pdf(&html)
|
|
5
|
+
.map_err(|e| Error::new(ruby.exception_runtime_error(), e.to_string()))?;
|
|
6
|
+
Ok(ruby.str_from_slice(&pdf))
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
fn markdown_to_pdf(ruby: &Ruby, markdown: String) -> Result<RString, Error> {
|
|
10
|
+
let pdf = ironpress_core::markdown_to_pdf(&markdown)
|
|
11
|
+
.map_err(|e| Error::new(ruby.exception_runtime_error(), e.to_string()))?;
|
|
12
|
+
Ok(ruby.str_from_slice(&pdf))
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#[magnus::init]
|
|
16
|
+
fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
17
|
+
let module = define_module("Ironpress")?;
|
|
18
|
+
module.define_singleton_method("html_to_pdf", function!(html_to_pdf, 1))?;
|
|
19
|
+
module.define_singleton_method("markdown_to_pdf", function!(markdown_to_pdf, 1))?;
|
|
20
|
+
Ok(())
|
|
21
|
+
}
|
metadata
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ironpress
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.4.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Paul Gaston Gouron
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-04-14 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rb_sys
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.9'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.9'
|
|
27
|
+
description: Convert HTML, CSS, and Markdown to PDF with no browser or system dependencies.
|
|
28
|
+
Native Rust extension for maximum performance.
|
|
29
|
+
email:
|
|
30
|
+
executables: []
|
|
31
|
+
extensions:
|
|
32
|
+
- ext/ironpress/extconf.rb
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- Cargo.toml
|
|
36
|
+
- README.md
|
|
37
|
+
- ext/ironpress/extconf.rb
|
|
38
|
+
- lib/ironpress.rb
|
|
39
|
+
- src/lib.rs
|
|
40
|
+
homepage: https://github.com/gastongouron/ironpress
|
|
41
|
+
licenses:
|
|
42
|
+
- MIT
|
|
43
|
+
metadata: {}
|
|
44
|
+
post_install_message:
|
|
45
|
+
rdoc_options: []
|
|
46
|
+
require_paths:
|
|
47
|
+
- lib
|
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '3.0'
|
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '0'
|
|
58
|
+
requirements: []
|
|
59
|
+
rubygems_version: 3.5.22
|
|
60
|
+
signing_key:
|
|
61
|
+
specification_version: 4
|
|
62
|
+
summary: Pure Rust HTML/CSS/Markdown to PDF converter
|
|
63
|
+
test_files: []
|