# Printing the PDF in new window

**URL:** <https://www.ruby-forum.com/t/printing-the-pdf-in-new-window/135436>\
**Category:** Rails\
**Created:** [April 22, 2008, 7:10am UTC](https://www.ruby-forum.com/t/printing-the-pdf-in-new-window/135436 "2008-04-22T07:10:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [April 22, 2008, 7:10am UTC](https://www.ruby-forum.com/t/printing-the-pdf-in-new-window/135436/1 "2008-04-22T07:10:27Z")

</div>

Hi,

I am working on printing the PDF in rails. I am using the send\_data  
method to achieve this.

I need the following functionality to be done.

When I click on “Print PDF” icon, a new window or tab should be opened  
and the result PDF content should be opened in the new window or  
tab(Currently it is working in the same window in which I have the  
“Print PDF” icon).

How can I do this?

Thanks in advance…

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [April 22, 2008, 8:01am UTC](https://www.ruby-forum.com/t/printing-the-pdf-in-new-window/135436/2 "2008-04-22T08:01:17Z")

</div>

Check this out :

\<%= link\_to ‘Print PDF’,{:action =\> ‘print\_now’, :id =\> @doc.id, :popup  
=\> [‘new\_window’,‘height=550,width=550’] %\>

Cheer,  
Reinhart  
[http://teapoci.blogspot.com](http://teapoci.blogspot.com)

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [April 22, 2008, 8:02am UTC](https://www.ruby-forum.com/t/printing-the-pdf-in-new-window/135436/3 "2008-04-22T08:02:21Z")

</div>

Check this out :

\<%= link\_to ‘Print PDF’,{:action =\> ‘print\_now’, :id =\> @doc.id},  
:popup  
=\> [‘new\_window’,‘height=550,width=550’] %\>

Cheer,  
Reinhart  
[http://teapoci.blogspot.com](http://teapoci.blogspot.com)

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [April 22, 2008, 8:11am UTC](https://www.ruby-forum.com/t/printing-the-pdf-in-new-window/135436/4 "2008-04-22T08:11:01Z")

</div>

Can I implement the same requirement for link\_to\_remote tag? But :popup  
is not working.

Is there any way to implement this for link\_to\_remote tag?

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [April 22, 2008, 8:47am UTC](https://www.ruby-forum.com/t/printing-the-pdf-in-new-window/135436/5 "2008-04-22T08:47:27Z")

</div>

My script above is working with me

> \<%= link\_to ‘Print PDF’,{:action =\> ‘print\_now’, :id =\> @doc.id},  
> :popup =\> [‘new\_window’,‘height=550,width=550’] %\>

You can use it for link\_to\_remote, check this out :

[http://www.ruby-forum.com/topic/112989](http://www.ruby-forum.com/topic/112989)
