# Downloading .pdf file

**URL:** <https://www.ruby-forum.com/t/downloading-pdf-file/188989>\
**Category:** Rails\
**Created:** [May 21, 2010, 12:55pm UTC](https://www.ruby-forum.com/t/downloading-pdf-file/188989 "2010-05-21T12:55:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amalasingh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@amalasingh](https://www.ruby-forum.com/u/amalasingh)\
**Post date:** [May 21, 2010, 12:55pm UTC](https://www.ruby-forum.com/t/downloading-pdf-file/188989/1 "2010-05-21T12:55:59Z")

</div>

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](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?

–  
Nandri(Thanks in Tamil),  
Amala S.
