lib/thinreports/generator/pdf/prawn_ext.rb in thinreports-0.7.6 vs lib/thinreports/generator/pdf/prawn_ext.rb in thinreports-0.7.7
- old
+ new
@@ -1,10 +1,9 @@
# coding: utf-8
# @private
module Prawn
- # @private
class Document
# Create around alias.
alias_method :original_width_of, :width_of
def width_of(string, options={})
@@ -24,8 +23,26 @@
if w > sw || h > sh
options[:fit] = [sw, sh]
end
end
original_calc_image_dimensions(info, options)
+ end
+ end
+
+ # Patch: https://github.com/prawnpdf/prawn/commit/34039d13b7886692debca11e85b9a572a20d57ee
+ module Core
+ class Reference
+ def <<(data)
+ (@stream ||= "") << data
+ @data[:Length] = @stream.length
+ @stream
+ end
+
+ def compress_stream
+ @stream = Zlib::Deflate.deflate(@stream)
+ @data[:Filter] = :FlateDecode
+ @data[:Length] = @stream.length
+ @compressed = true
+ end
end
end
end