• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

How to open a PDF in a Portlet

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am new to portlet environment.
My aim is to let the PDF open at user's end/make him save it.

As portal sets the content type (e.g, text/html) and encoding as the portal page starts rendering. In my case, the setContentType() would be useless since the servlet container won't let me change it. I can either use a popup browser window for the pdf as, or use an iframe if I want to render the pdf inside the portlet window.

This is my present code, but it is not good enough to do the above thing.



Please guide me in this, as I am not knowing how to do it??
Thanks & Regards,
Saurabh.
 
author and cow tipper
Posts: 5006
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IBM has a special document viewer portlet:

IBM Document Viewer Portlet

Which portal are you using? If it's IBM, maybe you can open up some of the JSP files and see what they're doing in this portlet.

-Cameron McKenzie
 
Saurabh Joshi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cameron,

I am using Liferay portal.
Please give me some help with this, I am stuck here.

Thanks,
Saurabh.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You cannot push binary in portlet like you do in web application. What you have to do is to generate the PDF on the server and pass the path info to the portlet so that it can read the pdf as a normal client.
you might have to use the <EMBED> tag to display the pdf in the portlet.

<EMBED TYPE="application/pdf" SRC="<%=filename%>" WIDTH='<%=width%>' HEIGHT='<%=portletRequest.getAttribute("height")%>' HREF='<%=filename%>' PLUGINSPAGE="http://www.adobe.com/products/acrobat/readstep.html" ></EMBED>

If you had used WebSphere portal, the document viewer portlet comes out of the box, but looks like you are using liferay. But its easy, you should be able to achieve the functionality.
[ December 01, 2007: Message edited by: Sanjay Kannan ]
 
Saurabh Joshi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sanjay,
Thanks for this information, I will surely try this and update you.
Thanks,
Saurabh.
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm usingRegards, Jan
 
Saurabh Joshi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jan & Sanjay,

I tried with both of your suggestions, But I think I am making some mistake.
When I tried with tag in my .jsp, I get a empty portlet with nothing in it.
And when I tried


It's not showing me the

Click Here

hyperlink.

Please suggest me where I am going wrong??
It's urgent.

Thanks for your support.
Saurabh.
 
Jan Cumps
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

c:/ccqr.pdf

Your href should point to a location within your web application,not to a windows directory format.

In your web app, try to create a directory named: pdfs
Put your ccqr.pdf there.
Than change c:/ccqr.pdf in your page to: /pdfs/ccqr.pdf

Regards, Jan
 
Saurabh Joshi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jan,

Thanks for that information.
IT WORKED FOR ME.

Saurabh.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic