lib/prawn/document.rb in prawn-0.13.0 vs lib/prawn/document.rb in prawn-0.13.1
- old
+ new
@@ -368,11 +368,11 @@
render_body(output)
render_xref(output)
render_trailer(output)
if output.instance_of?(StringIO)
str = output.string
- str.force_encoding("ASCII-8BIT") if str.respond_to?(:force_encoding)
+ str.force_encoding(::Encoding::ASCII_8BIT)
return str
else
return nil
end
end
@@ -380,11 +380,10 @@
# Renders the PDF document to file.
#
# pdf.render_file "foo.pdf"
#
def render_file(filename)
- Kernel.const_defined?("Encoding") ? mode = "wb:ASCII-8BIT" : mode = "wb"
- File.open(filename,mode) { |f| render(f) }
+ File.open(filename, "wb") { |f| render(f) }
end
# The bounds method returns the current bounding box you are currently in,
# which is by default the box represented by the margin box on the
# document itself. When called from within a created <tt>bounding_box</tt>