combine_pdf 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 836492be159026a99d02304d504ddbf5fa2fb842
|
4
|
+
data.tar.gz: 518dc2a996a97b25c4143ee4be147fef1dd65e94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8c55e40b2f752757fe8588ec30b9a29767d6c28a9957d2a94ecf869b08c8ab07aa8560cc3d81590a2fa8721a5f547ca95d2aa9f721c2af50cfd6611131da617
|
7
|
+
data.tar.gz: fd0be69a79f8048b39cdcdd45aabce11439cba505ae1703e54f1b135eaa8cd5d0697df8bfb08357556afa5ea2eb99f4fa9177f45adcad4ee83312c9e19369482
|
data/CHANGELOG.md
CHANGED
@@ -2,12 +2,17 @@
|
|
2
2
|
|
3
3
|
***
|
4
4
|
|
5
|
+
Change log v.0.1.13
|
6
|
+
|
7
|
+
**fix**: fix for Acrobat Reader compatablity (by removing color-space declarations). Should solve issue #13 , reported originaly by Imanol and Diyei Gomi.
|
8
|
+
|
9
|
+
***
|
10
|
+
|
5
11
|
Change log v.0.1.12
|
6
12
|
|
7
13
|
**fix**: fix for page rotation inheritance.
|
8
14
|
|
9
|
-
**fix**: fix for the issue
|
10
|
-
|
15
|
+
**fix**: fix for the issue was discovered while observing issue #13, reported originaly by Imanol and Diyei Gomi. The issue was probably caused by parsing errors introduced while parsing hex strings (a case sensitive method was used by mistake and this is now corrected).
|
11
16
|
***
|
12
17
|
|
13
18
|
Change log v.0.1.11
|
@@ -41,7 +41,7 @@ module CombinePDF
|
|
41
41
|
def initialize(mediabox = [0, 0, 595.3, 841.9])
|
42
42
|
# indirect_reference_id, :indirect_generation_number
|
43
43
|
@contents = ""
|
44
|
-
@base_font_name = "Writer" + SecureRandom.
|
44
|
+
@base_font_name = "Writer" + SecureRandom.hex(7) + "PDF"
|
45
45
|
self[:Type] = :Page
|
46
46
|
self[:indirect_reference_id] = 0
|
47
47
|
self[:Resources] = {}
|
@@ -141,7 +141,10 @@ module CombinePDF
|
|
141
141
|
end
|
142
142
|
box_graphic_state = graphic_state box_graphic_state # adds the graphic state to Resources and gets the reference
|
143
143
|
box_stream << "#{PDFOperations._object_to_pdf box_graphic_state} gs\n"
|
144
|
-
|
144
|
+
|
145
|
+
# the following line was removed for Acrobat Reader compatability
|
146
|
+
# box_stream << "DeviceRGB CS\nDeviceRGB cs\n"
|
147
|
+
|
145
148
|
if options[:box_color]
|
146
149
|
box_stream << "#{options[:box_color].join(' ')} rg\n"
|
147
150
|
end
|
@@ -231,7 +234,10 @@ module CombinePDF
|
|
231
234
|
text_stream << "q\n"
|
232
235
|
text_graphic_state = graphic_state({ca: options[:opacity], CA: options[:opacity], LW: options[:stroke_width].to_f, LC: 2, LJ: 1, LD: 0, CTM: options[:ctm]})
|
233
236
|
text_stream << "#{PDFOperations._object_to_pdf text_graphic_state} gs\n"
|
234
|
-
|
237
|
+
|
238
|
+
# the following line was removed for Acrobat Reader compatability
|
239
|
+
# text_stream << "DeviceRGB CS\nDeviceRGB cs\n"
|
240
|
+
|
235
241
|
# set text render mode
|
236
242
|
if options[:font_color]
|
237
243
|
text_stream << "#{options[:font_color].join(' ')} rg\n"
|
@@ -253,7 +259,7 @@ module CombinePDF
|
|
253
259
|
encode(text, fonts).each do |encoded|
|
254
260
|
text_stream << "BT\n" # the Begine Text marker
|
255
261
|
text_stream << PDFOperations._format_name_to_pdf(set_font encoded[0]) # Set font name
|
256
|
-
text_stream << " #{font_size} Tf\n" # set font size and add font operator
|
262
|
+
text_stream << " #{font_size.round 3} Tf\n" # set font size and add font operator
|
257
263
|
text_stream << "#{x.round 4} #{y.round 4} Td\n" # set location for text object
|
258
264
|
text_stream << ( encoded[1] ) # insert the encoded string to the stream
|
259
265
|
text_stream << " Tj\n" # the Text object operator and the End Text marker
|
@@ -345,7 +351,7 @@ module CombinePDF
|
|
345
351
|
#return name
|
346
352
|
name
|
347
353
|
end
|
348
|
-
# register or get a registered
|
354
|
+
# register or get a registered graphic state dictionary.
|
349
355
|
# the method returns the name of the graphos state, for use in a content stream.
|
350
356
|
def graphic_state(graphic_state_dictionary = {})
|
351
357
|
# if the graphic state exists, return it's name
|
@@ -358,7 +364,7 @@ module CombinePDF
|
|
358
364
|
# set graphic state type
|
359
365
|
graphic_state_dictionary[:Type] = :ExtGState
|
360
366
|
# set a secure name for the graphic state
|
361
|
-
name = (SecureRandom.
|
367
|
+
name = (SecureRandom.hex(9)).to_sym
|
362
368
|
# add object to reasource
|
363
369
|
resources[:ExtGState][name] = graphic_state_dictionary
|
364
370
|
#return name
|
@@ -85,6 +85,12 @@ module CombinePDF
|
|
85
85
|
module Fonts
|
86
86
|
module_function
|
87
87
|
|
88
|
+
# returns a list containing the registered font names
|
89
|
+
def fonts_list
|
90
|
+
initiate_library
|
91
|
+
FONTS_LIBRARY.keys
|
92
|
+
end
|
93
|
+
|
88
94
|
# gets a font from the fonts library
|
89
95
|
def get_font(name = :Helvetica)
|
90
96
|
initiate_library
|
@@ -129,7 +129,7 @@ module CombinePDF
|
|
129
129
|
resources.each do |k,v|
|
130
130
|
if v.is_a?(Hash)
|
131
131
|
new_dictionary = {}
|
132
|
-
new_name = "Combine" + SecureRandom.
|
132
|
+
new_name = "Combine" + SecureRandom.hex(7) + "PDF"
|
133
133
|
i = 1
|
134
134
|
v.each do |old_key, value|
|
135
135
|
new_key = (new_name + i.to_s).to_sym
|
@@ -153,7 +153,8 @@ module CombinePDF
|
|
153
153
|
end
|
154
154
|
# patch back to PDF defaults, for OCRed PDF files.
|
155
155
|
# stream[:raw_stream_content] = "q\nq\nq\nDeviceRGB CS\nDeviceRGB cs\n0 0 0 rg\n0 0 0 RG\n0 Tr\n%s\nQ\nQ\nQ\n" % stream[:raw_stream_content]
|
156
|
-
|
156
|
+
# the following was removed for Acrobat Reader compatability: DeviceRGB CS\nDeviceRGB cs\n
|
157
|
+
stream[:raw_stream_content] = "q\nq\nq\n0 0 0 rg\n0 0 0 RG\n0 Tr\n1 0 0 1 0 0 cm\n%s\nQ\nQ\nQ\n" % stream[:raw_stream_content]
|
157
158
|
end
|
158
159
|
|
159
160
|
new_page
|
data/lib/combine_pdf/version.rb
CHANGED