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
  • 100,941
  • 9
  • 101
  • 131
evans
  • 549
  • 7
  • 22

0 Answers0