Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hidakatsuya/4660699 to your computer and use it in GitHub Desktop.
Save hidakatsuya/4660699 to your computer and use it in GitHub Desktop.
A patch for fix an error when print the pdf that is generated with encryption by prawn
require 'thinreports'
# https://github.com/prawnpdf/prawn/commit/34039d13b7886692debca11e85b9a572a20d57ee
class Prawn::Core::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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment