You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Sipin Verma <si...@gmail.com> on 2012/09/13 12:55:22 UTC

How to use pdfviewer in liferay portlet to see a pdf

Hi ,

My requirement is to open a pdf document from my local machine hard disk or
from a online available pdf link in my liferay portlet.
I am looking into PDFBox but I am not able to understand how to start. What
APIs I should use to open a pdf document in my portlet.

Can anyone help me with some sample code or directions to use pdfviewer for
opening a pdf in browser.

*Sipin Verma*

Re: How to use pdfviewer in liferay portlet to see a pdf

Posted by Sipin Verma <si...@gmail.com>.
I have created a <a> link in my jsp and have called the
<portlet:actionURL/> .
*<a href="<portlet:actionURL/>" > show pdf</a>*

In my processAction() I have kept below code:
*URL url = new URL("http://samplepdf.com/sample.pdf");
PDDocument.load(url);*

It's not showing anything to me after the jsp page is loaded. My doubt is
that after loading the document, how is it shown in jsp? Do we have to use
some tag to show the pdf?

Can you add the missing part in my code or give me a working sample of code
that loads a pdf document and shows in jsp.

Thanks




On Thu, Sep 13, 2012 at 4:48 PM, <jl...@gi-bon.sk> wrote:

> you have several options:
> a) download that file (you can use HttpURLConnection or something else),
> store it locally and use PDDocument.load(file)
> b) open inputstream from that remote server and use
> PDDocument.load(inputstream)
> c) use PDDocument.load(url)
>
> actualy this is not matter of pdfbox.
>
>
>
> Best regards
> Juraj Lonc
>
>
>
>
> From:   Sipin Verma <si...@gmail.com>
> To:     users@pdfbox.apache.org,
> Date:   13. 09. 2012 13:09
> Subject:        Re: How to use pdfviewer in liferay portlet to see a pdf
>
>
>
> ok. Thanks for your reply.
> I have 2 options to read pdf files.
> 1) from document library
> 2) from some other server
>
> Suppose I have the pdf download link then how can I feed this link to pdf
> box so that it opens it in my portlet page.
>
>
>
> On Thu, Sep 13, 2012 at 4:32 PM, <jl...@gi-bon.sk> wrote:
>
> > Hi Sipin,
> >
> > portlet is not able to open file from your local machine.
> > portlet has access to server files only.
> >
> > so you have to make portlet where user can upload some pdf file, then
> > portlet can process that file (and then use pdfbox)
> >
> >
> > Best regards
> > Juraj Lonc
> >
> >
> >
> >
> >
> > From:   Sipin Verma <si...@gmail.com>
> > To:     users@pdfbox.apache.org,
> > Date:   13. 09. 2012 12:56
> > Subject:        How to use pdfviewer in liferay portlet to see a pdf
> >
> >
> >
> > Hi ,
> >
> > My requirement is to open a pdf document from my local machine hard disk
> > or
> > from a online available pdf link in my liferay portlet.
> > I am looking into PDFBox but I am not able to understand how to start.
> > What
> > APIs I should use to open a pdf document in my portlet.
> >
> > Can anyone help me with some sample code or directions to use pdfviewer
> > for
> > opening a pdf in browser.
> >
> > *Sipin Verma*
> >
> >
>
>

Re: How to use pdfviewer in liferay portlet to see a pdf

Posted by jl...@gi-bon.sk.
you have several options:
a) download that file (you can use HttpURLConnection or something else), 
store it locally and use PDDocument.load(file)
b) open inputstream from that remote server and use 
PDDocument.load(inputstream)
c) use PDDocument.load(url)

actualy this is not matter of pdfbox.



Best regards
Juraj Lonc




From:   Sipin Verma <si...@gmail.com>
To:     users@pdfbox.apache.org, 
Date:   13. 09. 2012 13:09
Subject:        Re: How to use pdfviewer in liferay portlet to see a pdf



ok. Thanks for your reply.
I have 2 options to read pdf files.
1) from document library
2) from some other server

Suppose I have the pdf download link then how can I feed this link to pdf
box so that it opens it in my portlet page.



On Thu, Sep 13, 2012 at 4:32 PM, <jl...@gi-bon.sk> wrote:

> Hi Sipin,
>
> portlet is not able to open file from your local machine.
> portlet has access to server files only.
>
> so you have to make portlet where user can upload some pdf file, then
> portlet can process that file (and then use pdfbox)
>
>
> Best regards
> Juraj Lonc
>
>
>
>
>
> From:   Sipin Verma <si...@gmail.com>
> To:     users@pdfbox.apache.org,
> Date:   13. 09. 2012 12:56
> Subject:        How to use pdfviewer in liferay portlet to see a pdf
>
>
>
> Hi ,
>
> My requirement is to open a pdf document from my local machine hard disk
> or
> from a online available pdf link in my liferay portlet.
> I am looking into PDFBox but I am not able to understand how to start.
> What
> APIs I should use to open a pdf document in my portlet.
>
> Can anyone help me with some sample code or directions to use pdfviewer
> for
> opening a pdf in browser.
>
> *Sipin Verma*
>
>


Re: How to use pdfviewer in liferay portlet to see a pdf

Posted by Sipin Verma <si...@gmail.com>.
ok. Thanks for your reply.
I have 2 options to read pdf files.
1) from document library
2) from some other server

Suppose I have the pdf download link then how can I feed this link to pdf
box so that it opens it in my portlet page.



On Thu, Sep 13, 2012 at 4:32 PM, <jl...@gi-bon.sk> wrote:

> Hi Sipin,
>
> portlet is not able to open file from your local machine.
> portlet has access to server files only.
>
> so you have to make portlet where user can upload some pdf file, then
> portlet can process that file (and then use pdfbox)
>
>
> Best regards
> Juraj Lonc
>
>
>
>
>
> From:   Sipin Verma <si...@gmail.com>
> To:     users@pdfbox.apache.org,
> Date:   13. 09. 2012 12:56
> Subject:        How to use pdfviewer in liferay portlet to see a pdf
>
>
>
> Hi ,
>
> My requirement is to open a pdf document from my local machine hard disk
> or
> from a online available pdf link in my liferay portlet.
> I am looking into PDFBox but I am not able to understand how to start.
> What
> APIs I should use to open a pdf document in my portlet.
>
> Can anyone help me with some sample code or directions to use pdfviewer
> for
> opening a pdf in browser.
>
> *Sipin Verma*
>
>

Re: How to use pdfviewer in liferay portlet to see a pdf

Posted by jl...@gi-bon.sk.
Hi Sipin,

portlet is not able to open file from your local machine.
portlet has access to server files only.

so you have to make portlet where user can upload some pdf file, then 
portlet can process that file (and then use pdfbox)


Best regards
Juraj Lonc





From:   Sipin Verma <si...@gmail.com>
To:     users@pdfbox.apache.org, 
Date:   13. 09. 2012 12:56
Subject:        How to use pdfviewer in liferay portlet to see a pdf



Hi ,

My requirement is to open a pdf document from my local machine hard disk 
or
from a online available pdf link in my liferay portlet.
I am looking into PDFBox but I am not able to understand how to start. 
What
APIs I should use to open a pdf document in my portlet.

Can anyone help me with some sample code or directions to use pdfviewer 
for
opening a pdf in browser.

*Sipin Verma*