metaskills-pdf-writer 1.2.2 → 1.2.3
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.
- data/lib/pdf/techbook.rb +5 -1
- data/lib/pdf/writer.rb +5 -1
- data/lib/pdf/writer/graphics.rb +5 -1
- metadata +2 -2
data/lib/pdf/techbook.rb
CHANGED
@@ -854,7 +854,11 @@ class PDF::TechBook < PDF::Writer
|
|
854
854
|
# class program, then regenerate.
|
855
855
|
if (_tm_doc < _tm_cch) and (_tm_prg < _tm_cch)
|
856
856
|
$stderr.puts PDF::Writer::Lang[:techbook_using_cached_doc] % File.basename(files[:cache])
|
857
|
-
|
857
|
+
if RUBY_VERSION >= '1.9'
|
858
|
+
pdf = File.open(files[:cache], "rb:binary") { |cf| Marshal.load(cf.read) }
|
859
|
+
else
|
860
|
+
pdf = File.open(files[:cache], "rb") { |cf| Marshal.load(cf.read) }
|
861
|
+
end
|
858
862
|
pdf.save_as(files[:pdf])
|
859
863
|
File.open(files[:pdf], "wb") { |pf| pf.write pdf.render }
|
860
864
|
exit(0)
|
data/lib/pdf/writer.rb
CHANGED
@@ -1467,7 +1467,11 @@ class PDF::Writer
|
|
1467
1467
|
end
|
1468
1468
|
|
1469
1469
|
def char_width(font, char)
|
1470
|
-
|
1470
|
+
if RUBY_VERSION >= '1.9'
|
1471
|
+
char = char.bytes.to_a.first unless @fonts[font].c[char]
|
1472
|
+
else
|
1473
|
+
char = char[0] unless @fonts[font].c[char]
|
1474
|
+
end
|
1471
1475
|
|
1472
1476
|
if @fonts[font].differences and @fonts[font].c[char].nil?
|
1473
1477
|
name = @fonts[font].differences[char] || 'M'
|
data/lib/pdf/writer/graphics.rb
CHANGED
@@ -543,7 +543,11 @@ module PDF::Writer::Graphics
|
|
543
543
|
if image.respond_to?(:read)
|
544
544
|
data = image.read
|
545
545
|
else
|
546
|
-
|
546
|
+
if RUBY_VERSION >= '1.9'
|
547
|
+
open(image,'rb:binary') { |ff| data = ff.read }
|
548
|
+
else
|
549
|
+
open(image,'rb') { |ff| data = ff.read }
|
550
|
+
end
|
547
551
|
end
|
548
552
|
|
549
553
|
add_image(data, x, y, width, height, nil, link)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metaskills-pdf-writer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-05-
|
14
|
+
date: 2009-05-19 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|