sghtmltopdf 0.5.1-aarch64-linux → 0.6.1-aarch64-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 +4 -4
- data/README.md +2 -0
- data/lib/sghtmltopdf/3.2/sghtmltopdf.so +0 -0
- data/lib/sghtmltopdf/3.3/sghtmltopdf.so +0 -0
- data/lib/sghtmltopdf/3.4/sghtmltopdf.so +0 -0
- data/lib/sghtmltopdf/4.0/sghtmltopdf.so +0 -0
- data/lib/sghtmltopdf/renderer.rb +14 -0
- data/lib/sghtmltopdf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c096aac7e911b6b8973eca4ffeedd3062bcffd9f07dddada073da979bc2d5747
|
|
4
|
+
data.tar.gz: 27be2c0d59a710383ab875bb4ce084353791ca15d9c5575087945ba5929d946c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9cbe4f4d889f9964a31ff1e5794432d91bc3ab672a2106a9e4e6900255561f5acec42f69da259c5de9184f58eec4d1aeb726c818878b1729ccf1ea1346966395
|
|
7
|
+
data.tar.gz: ec4caf9af68bb791cc07206c579a6d62ec99970ab98a1eddf78d2605a2bb6ba8c9d2ae4ee94789e4d6f87b89e18ec24604fdd748982311eed2882493bcc75359
|
data/README.md
CHANGED
|
@@ -89,6 +89,8 @@ end
|
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
View-rendering keys (`template`, `layout`, `locals`, …) go to `render_to_string`, response keys (`filename`, `disposition`, `status`) go to `send_data`, `show_as_html: true` returns the HTML instead of a PDF, and everything else is passed to the converter.
|
|
92
|
+
|
|
93
|
+
`render_to_string(pdf: "invoice", template: "invoices/show")` returns PDF bytes without setting the controller response. You can then pass those bytes to `send_data` or save them elsewhere; response options such as `filename`, `disposition`, and `status` only apply to `render pdf:`.
|
|
92
94
|
Converter keys are flat CLI flag names, so wicked_pdf's nested `margin: {top: 10}` becomes `margin_top: "10mm"` (with the unit spelled out); the [migration guide](https://waka.github.io/sghtmltopdf/en/migration/wicked-pdf.html) maps every key one by one.
|
|
93
95
|
|
|
94
96
|
### Assets
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/sghtmltopdf/renderer.rb
CHANGED
|
@@ -10,6 +10,19 @@ module Sghtmltopdf
|
|
|
10
10
|
#
|
|
11
11
|
# It is a pure Ruby class with no dependency on Rails, so it can be unit tested without Rails.
|
|
12
12
|
class Renderer
|
|
13
|
+
module RenderToString
|
|
14
|
+
def render_to_string(*args, &block)
|
|
15
|
+
options = args.first.is_a?(Hash) ? args.first : args[1]
|
|
16
|
+
return super unless options.is_a?(Hash) && options.key?(:pdf)
|
|
17
|
+
|
|
18
|
+
normalized_args = args.map { |arg| arg.is_a?(Hash) ? arg.dup : arg }
|
|
19
|
+
options = _normalize_args(*normalized_args, &block)
|
|
20
|
+
renderer = Renderer.new(options.delete(:pdf), options, default_name: action_name)
|
|
21
|
+
html = super(**renderer.render_options, &block)
|
|
22
|
+
renderer.body_for(html)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
13
26
|
# The keys passed straight to `render_to_string`.
|
|
14
27
|
RAILS_RENDER_KEYS = %i[
|
|
15
28
|
action assigns body collection file formats handlers html inline layout
|
|
@@ -39,6 +52,7 @@ module Sghtmltopdf
|
|
|
39
52
|
# Register the renderer with `ActionController::Renderers.add(:pdf)`.
|
|
40
53
|
# Called from the Railtie's Action Controller load hook (`on_load`).
|
|
41
54
|
def self.register!
|
|
55
|
+
::ActionController::Rendering.prepend(RenderToString)
|
|
42
56
|
::ActionController::Renderers.add(:pdf) do |name, options|
|
|
43
57
|
renderer = ::Sghtmltopdf::Renderer.new(name, options, default_name: action_name)
|
|
44
58
|
html = render_to_string(**renderer.render_options)
|
data/lib/sghtmltopdf/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sghtmltopdf
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- yo_waka
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
Ruby binding for sghtmltopdf, a successor to wkhtmltopdf: an HTML-to-PDF
|