dragonfly_pdf 0.0.4 → 0.0.5
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af0bd06c8f18ba0d4d17d560bcb95037ca732e3c
|
4
|
+
data.tar.gz: c976c19c34d4a2a6501f64569f2d1a475cc72027
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29e5f6b494b74bc570482ad6a79210bb22d70ebf560d6b792c287bf28a190dd3027cfbfbe9348d8a6d044633a0caee90311d202dabfa5a0e731c4b38f603913d
|
7
|
+
data.tar.gz: 02ceb2c7c85dfc91f68d88de5073f99122ab763dc99a54d7316a0800547cd20f4cc40b39ff77cbe930a79ab162d494af6d8f3c02294aeffd4c5d0376b6a1ff71
|
data/README.md
CHANGED
@@ -59,8 +59,7 @@ It returns a hash of properties:
|
|
59
59
|
page_numbers: [[1], [2, 3], [4]],
|
60
60
|
widths: [[210.0], [210.0, 210.0], [210.0]],
|
61
61
|
heights: [[297.0], [297.0, 297.0], [297.0]],
|
62
|
-
aspect_ratios: [[0.71], [0.71, 0.71], [0.71]]
|
63
|
-
info: { … }
|
62
|
+
aspect_ratios: [[0.71], [0.71, 0.71], [0.71]]
|
64
63
|
}
|
65
64
|
```
|
66
65
|
|
@@ -93,6 +92,14 @@ The available options and their default values are:
|
|
93
92
|
}
|
94
93
|
```
|
95
94
|
|
95
|
+
### Subset Fonts
|
96
|
+
|
97
|
+
Subset fonts in PDF.
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
pdf.subset_fonts
|
101
|
+
```
|
102
|
+
|
96
103
|
## Contributing
|
97
104
|
|
98
105
|
1. Fork it ( https://github.com/tomasc/dragonfly_pdf/fork )
|
@@ -12,7 +12,6 @@ module DragonflyPdf
|
|
12
12
|
{
|
13
13
|
aspect_ratios: aspect_ratios(pdf, spreads),
|
14
14
|
heights: heights(pdf, spreads),
|
15
|
-
info: pdf.info,
|
16
15
|
page_count: page_count(pdf, spreads),
|
17
16
|
page_numbers: page_numbers(pdf, spreads),
|
18
17
|
spread_count: spread_count(pdf, spreads),
|
@@ -48,7 +47,7 @@ module DragonflyPdf
|
|
48
47
|
end
|
49
48
|
|
50
49
|
# ---------------------------------------------------------------------
|
51
|
-
|
50
|
+
|
52
51
|
def heights pdf, spreads
|
53
52
|
pdf_page_heights = pdf.pages.map do |page|
|
54
53
|
media_box = page.attributes[:MediaBox]
|
@@ -75,7 +74,7 @@ module DragonflyPdf
|
|
75
74
|
end
|
76
75
|
|
77
76
|
# ---------------------------------------------------------------------
|
78
|
-
|
77
|
+
|
79
78
|
def aspect_ratios pdf, spreads
|
80
79
|
pdf_aspect_ratios = widths(pdf, false).zip(heights(pdf, false)).map do |width, height|
|
81
80
|
(width / height)
|
@@ -101,7 +100,7 @@ module DragonflyPdf
|
|
101
100
|
end
|
102
101
|
|
103
102
|
# ---------------------------------------------------------------------
|
104
|
-
|
103
|
+
|
105
104
|
def page_numbers pdf, spreads
|
106
105
|
return pdf.pages.collect { |p| p.number } unless spreads
|
107
106
|
|
@@ -129,7 +128,7 @@ module DragonflyPdf
|
|
129
128
|
end
|
130
129
|
|
131
130
|
# ---------------------------------------------------------------------
|
132
|
-
|
131
|
+
|
133
132
|
def page_count pdf, spreads
|
134
133
|
page_numbers(pdf, spreads).flatten.count
|
135
134
|
end
|
@@ -140,7 +139,7 @@ module DragonflyPdf
|
|
140
139
|
end
|
141
140
|
|
142
141
|
# =====================================================================
|
143
|
-
|
142
|
+
|
144
143
|
def pt2mm pt
|
145
144
|
(pt / 72.0) * 25.4
|
146
145
|
end
|
@@ -6,7 +6,7 @@ module DragonflyPdf
|
|
6
6
|
|
7
7
|
def call content, page_number=1, opts={}
|
8
8
|
format = opts.fetch(:format, :png)
|
9
|
-
density = opts.fetch(:density,
|
9
|
+
density = opts.fetch(:density, 150)
|
10
10
|
spreads = content.meta['spreads'] || false
|
11
11
|
|
12
12
|
args = "-alpha deactivate -background white -colorspace sRGB -density #{density}x#{density} -define pdf:use-cropbox=true -define pdf:use-trimbox=true"
|
@@ -36,8 +36,9 @@ module DragonflyPdf
|
|
36
36
|
content.ext = format
|
37
37
|
end
|
38
38
|
|
39
|
-
def update_url attrs,
|
39
|
+
def update_url attrs, page_number, opts={}
|
40
40
|
format = opts['format']
|
41
|
+
attrs.page_number = page_number
|
41
42
|
attrs.ext = format if format
|
42
43
|
end
|
43
44
|
|
@@ -57,4 +58,4 @@ module DragonflyPdf
|
|
57
58
|
|
58
59
|
end
|
59
60
|
end
|
60
|
-
end
|
61
|
+
end
|
@@ -232,14 +232,6 @@ module DragonflyPdf
|
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
235
|
-
# ---------------------------------------------------------------------
|
236
|
-
|
237
|
-
describe '#info' do
|
238
|
-
it 'returns Hash' do
|
239
|
-
analyser.call(single_pages)[:info].must_be_kind_of Hash
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
235
|
end
|
244
236
|
end
|
245
237
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dragonfly_pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dragonfly
|