2

I need to make a temporary copy of the pdf file, show it and delete it after a while.
Now I do so:

content = File.open(pdf).read # in pdf i have path to original pdf
locale_file = Tempfile.open('whatever.pdf')
locale_file.write content
locale_file.flush

But the temporary pdf is empty. How to fix?

I need a copy of the original pdf in a temporary file.

UPD

content = File.open(pdf).read
locale_file = Tempfile.open('whatever.pdf')
locale_file.write content
locale_file.rewind
spickermann
  • 89,540
  • 8
  • 92
  • 120
evans
  • 527
  • 6
  • 20

0 Answers0