pdf-core 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pdf/core/document_state.rb +4 -12
- data/lib/pdf/core/page.rb +0 -16
- data/lib/pdf/core/text.rb +1 -8
- data/lib/pdf/core.rb +0 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0290a0011b662d535affad39a3429a005f9cf7a
|
4
|
+
data.tar.gz: 9b22752a0a1d9e8595994ffd555a0ca8cb68daa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 043e585e7e4ea111d09ccad6a8c713cedbaff314a9521394507bf3a77c862d360daa0fbda9c57b5bcf5a4feae4a1cdab1468114c5f6ceac9c37a18cebcf858fd
|
7
|
+
data.tar.gz: 35088210934d898e38a255a754277c3530e4fe8b7c7f5f0800eeb1f6a2680d56bec8420d8533e62e3fdc3c48bd234f8c213f912e89b6e4b235e2176a45f664e1
|
@@ -4,19 +4,11 @@ module PDF
|
|
4
4
|
def initialize(options)
|
5
5
|
normalize_metadata(options)
|
6
6
|
|
7
|
-
if options[:
|
8
|
-
|
9
|
-
|
10
|
-
else
|
11
|
-
@store = PDF::Core::ObjectStore.new(:template => options[:template])
|
12
|
-
end
|
13
|
-
@store.info.data.merge!(options[:info]) if options[:info]
|
7
|
+
if options[:print_scaling]
|
8
|
+
@store = PDF::Core::ObjectStore.new(:info => options[:info],
|
9
|
+
:print_scaling => options[:print_scaling])
|
14
10
|
else
|
15
|
-
|
16
|
-
@store = PDF::Core::ObjectStore.new(:info => options[:info], :print_scaling => options[:print_scaling])
|
17
|
-
else
|
18
|
-
@store = PDF::Core::ObjectStore.new(:info => options[:info])
|
19
|
-
end
|
11
|
+
@store = PDF::Core::ObjectStore.new(:info => options[:info])
|
20
12
|
end
|
21
13
|
|
22
14
|
@version = 1.3
|
data/lib/pdf/core/page.rb
CHANGED
@@ -75,21 +75,6 @@ module PDF
|
|
75
75
|
@stamp_stream || document.state.store[@content]
|
76
76
|
end
|
77
77
|
|
78
|
-
# As per the PDF spec, each page can have multiple content streams. This will
|
79
|
-
# add a fresh, empty content stream this the page, mainly for use in loading
|
80
|
-
# template files.
|
81
|
-
#
|
82
|
-
def new_content_stream
|
83
|
-
return if in_stamp_stream?
|
84
|
-
|
85
|
-
unless dictionary.data[:Contents].is_a?(Array)
|
86
|
-
dictionary.data[:Contents] = [content]
|
87
|
-
end
|
88
|
-
@content = document.ref({})
|
89
|
-
dictionary.data[:Contents] << document.state.store[@content]
|
90
|
-
document.open_graphics_state
|
91
|
-
end
|
92
|
-
|
93
78
|
def dictionary
|
94
79
|
defined?(@stamp_dictionary) && @stamp_dictionary || document.state.store[@dictionary]
|
95
80
|
end
|
@@ -159,7 +144,6 @@ module PDF
|
|
159
144
|
|
160
145
|
def init_from_object(options)
|
161
146
|
@dictionary = options[:object_id].to_i
|
162
|
-
dictionary.data[:Parent] = document.state.store.pages if options[:page_template]
|
163
147
|
|
164
148
|
unless dictionary.data[:Contents].is_a?(Array) # content only on leafs
|
165
149
|
@content = dictionary.data[:Contents].identifier
|
data/lib/pdf/core/text.rb
CHANGED
@@ -171,20 +171,13 @@ module PDF
|
|
171
171
|
# * :stroke_clip - stroke text then add to path for clipping
|
172
172
|
# * :fill_stroke_clip - fill then stroke text, then add to path for clipping
|
173
173
|
# * :clip - add text to path for clipping
|
174
|
-
#
|
175
|
-
# There's the special mode :unknown which only occurs when we're working
|
176
|
-
# with templates. If left in :unknown, the first text command will force
|
177
|
-
# an assertion to :fill.
|
178
174
|
def text_rendering_mode(mode=nil)
|
179
175
|
return (defined?(@text_rendering_mode) && @text_rendering_mode || :fill) if mode.nil?
|
180
176
|
unless MODES.key?(mode)
|
181
177
|
raise ArgumentError, "mode must be between one of #{MODES.keys.join(', ')} (#{mode})"
|
182
178
|
end
|
183
179
|
original_mode = self.text_rendering_mode
|
184
|
-
|
185
|
-
original_mode = :fill
|
186
|
-
add_content "\n#{MODES[:fill]} Tr"
|
187
|
-
end
|
180
|
+
|
188
181
|
if original_mode == mode
|
189
182
|
yield
|
190
183
|
else
|
data/lib/pdf/core.rb
CHANGED
@@ -22,9 +22,6 @@ module PDF
|
|
22
22
|
# This error is raised when PdfObject() fails
|
23
23
|
FailedObjectConversion = Class.new(StandardError)
|
24
24
|
|
25
|
-
# This error is raised when object store fails to load a template file
|
26
|
-
TemplateError = Class.new(StandardError)
|
27
|
-
|
28
25
|
# This error is raise when trying to restore a graphic state that
|
29
26
|
EmptyGraphicStateStack = Class.new(StandardError)
|
30
27
|
|