prawn-rails 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/README.md +12 -0
- data/lib/prawn-rails/config.rb +2 -0
- data/lib/prawn-rails/document.rb +17 -1
- data/lib/prawn-rails/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: 98ab6c1736809af9812490c14ccc652d5835462fe406116ea1d2dbb1e5c985a1
|
4
|
+
data.tar.gz: b561b81198ec9b3ddea346f4ade6be71f684a280fd00068c286c675748733554
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a33b34482d7a7aa9bf834695b684abcc51e3fa6e5808d8792a1cfee4160100885877f4a68eec4e81055b403c301f528567a810fec864e9911cd684b08ece7af
|
7
|
+
data.tar.gz: e5c0b84bb673f92dd211554cde2966d93d027242552c93cd6d124498b26ab9ec4448cc1f3afd22227b139e09a55bd5cce21b99e0895c63152cee4fdb76c48d3c
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
* `Unreleased` - [View Diff](https://github.com/cortiz/prawn-rails/compare/v1.
|
3
|
+
* `Unreleased` - [View Diff](https://github.com/cortiz/prawn-rails/compare/v1.6.0...master)
|
4
4
|
- Nothing yet
|
5
5
|
|
6
|
+
* `v1.6.0` - [View Diff](https://github.com/cortiz/prawn-rails/compare/v1.5.0...v1.6.0)
|
7
|
+
- [#55](https://github.com/cortiz/prawn-rails/pull/55) - Add config options `additional_fonts` and `default_font_name`
|
8
|
+
|
6
9
|
* `v1.5.0` - [View Diff](https://github.com/cortiz/prawn-rails/compare/v1.4.2...v1.5.0)
|
7
10
|
- [#52](https://github.com/cortiz/prawn-rails/pull/52) - Add active_support as a dependency and use the active_support lazy load hooks
|
8
11
|
- [#51](https://github.com/cortiz/prawn-rails/pull/51) - Remove usage of openstruct for config object
|
data/README.md
CHANGED
@@ -60,9 +60,21 @@ Add a `prawn-rails.rb` config to your Rails app under `config/initializers` like
|
|
60
60
|
|
61
61
|
```ruby
|
62
62
|
PrawnRails.config do |config|
|
63
|
+
# Prawn::Document options
|
63
64
|
config.page_layout = :portrait
|
64
65
|
config.page_size = "A4"
|
65
66
|
config.skip_page_creation = false
|
67
|
+
|
68
|
+
# PrawnRails options
|
69
|
+
config.additional_fonts = {
|
70
|
+
"some-custom-font" => {
|
71
|
+
normal: Rails.root.join('app/assets/fonts/print/some-custom-font.ttf'),
|
72
|
+
italic: Rails.root.join('app/assets/fonts/print/some-custom-font-italic.ttf'),
|
73
|
+
bold: Rails.root.join('app/assets/fonts/print/some-custom-font-bold.ttf'),
|
74
|
+
bold_italic: Rails.root.join('app/assets/fonts/print/some-custom-font-bold-italic.ttf'),
|
75
|
+
},
|
76
|
+
}
|
77
|
+
config.default_font_name = "some-custom-font"
|
66
78
|
end
|
67
79
|
```
|
68
80
|
|
data/lib/prawn-rails/config.rb
CHANGED
data/lib/prawn-rails/document.rb
CHANGED
@@ -4,7 +4,7 @@ require 'prawn/table'
|
|
4
4
|
module PrawnRails
|
5
5
|
class Document < Prawn::Document
|
6
6
|
def initialize(options = {})
|
7
|
-
options = PrawnRails.config.merge(options)
|
7
|
+
options = PrawnRails.config.except(:additional_fonts, :default_font_name).merge(options)
|
8
8
|
|
9
9
|
super(options)
|
10
10
|
end
|
@@ -16,5 +16,21 @@ module PrawnRails
|
|
16
16
|
# To circumvent this situation, we call to_s on value, and delegate action to actual Prawn::Document
|
17
17
|
super(value.to_s, options)
|
18
18
|
end
|
19
|
+
|
20
|
+
def start_new_page(options = {})
|
21
|
+
return_val = super
|
22
|
+
|
23
|
+
if state.page_count == 1
|
24
|
+
if PrawnRails.config.additional_fonts
|
25
|
+
font_families.update(PrawnRails.config.additional_fonts)
|
26
|
+
end
|
27
|
+
|
28
|
+
if PrawnRails.config.default_font_name
|
29
|
+
font(PrawnRails.config.default_font_name)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
return_val
|
34
|
+
end
|
19
35
|
end
|
20
36
|
end
|
data/lib/prawn-rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Ortiz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: prawn
|