downloading .pdf file

Hi,

I know how to get a .html file and writing contents into a file in the server.

eg. doc = Nokogiri::HTML(open(“http://projectmadurai.org”).read) my_file = File.new(“pm.html”, “w”) my_file.puts doc.inner_html my_file.close

I want to download a .pdf file in a similar way. How can I achieve this?