Open inline pdf in a portlet

hi All,

I want to display an inline pdf on load of a portlet.

For that set output stream to response object in beforeRenderResponse() method.

However, onload of the page it is giving below exception

I suspect that by the time beforeRenderResponse() method gets called, response object must have already been committed with a content type. Could you please advise which method can I override to set the content type and display an inline pdf on load of a portlet?

Kind regards,
Raja sekhar Kintali

Your portlet is rendering a fragment of a larger page, so you can not change the content type of the response in the middle of rendering the page.

Probably what you want to do is to render the html object tags in the portlet that will render the PDF inline by making a second http request to retrieve the PDF file content.

See: http://pdfobject.com/markup/index.php

I have also attached a example CAF project that demonstrates a couple of ways to display a PDF inline in a portlet if you want to see a working example.
ininepdf.zip (252 KB)

hi Eric,

Thanks for your time and the sample code provided. am able to open inline pdf now in a portlet.

Kind regards,
Raja sekhar Kintali