You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Eyal Golan <eg...@gmail.com> on 2009/04/25 21:33:57 UTC
Need help with Wicket, ResourceStream (itext adn pdf)
Hi,
I've been struggling to understand the concept of sending resources (such as
PDF) to the output with Wicket.
I searched many site and wasn't able to find anything useful for me.
(I found only one thread in this mailing list regarding iText).
Anyway,
Suppose I know how to create a PDF file.
How can I then show it to the user?
Suppose I have created the Document. What next?
If someone can give a direction in here or a link to good example, I would
be most appreciate.
Thanks
Eyal Golan
egolan74@gmail.com
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74
P Save a tree. Please don't print this e-mail unless it's really necessary
Re: Need help with Wicket, ResourceStream (itext adn pdf)
Posted by Eyal Golan <eg...@gmail.com>.
Thanks a-lot. Will look into it.
Eyal Golan
egolan74@gmail.com
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74
P Save a tree. Please don't print this e-mail unless it's really necessary
On Sat, Apr 25, 2009 at 11:16 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:
> If what you want is streaming back the PDF contents something like:
>
> ResourceLink fileLink = new ResourceLink("file", new
> DynamicWebResource(file.getName()) {
>
> private static final long serialVersionUID = 1L;
>
> @Override
> protected ResourceState getResourceState() {
> return new DynamicWebResource.ResourceState() {
> @Override
> public String getContentType() {
> return DownLoadExportPanel.this.getContentType();
> }
>
> @Override
> public byte[] getData() {
> try {
> return FileUtils.bytes(new
> FileInputStream(file));
> } catch (Exception e) {
> return null;
> }
> }
> };
> }
> });
>
> <a wicket:id="file"><span wicket:id="message"></span></a>
>
> will do the Job. Here I'm assuming the PDF is in a file...
>
> 2- If what you want is showing the PDF inside an iframe maybe the following
> link can be of some help
>
>
> http://cwiki.apache.org/WICKET/displaying-content-eg-pdf-excel-word-in-an-iframe.html
>
> Best,
>
> Ernesto
>
> On Sat, Apr 25, 2009 at 9:33 PM, Eyal Golan <eg...@gmail.com> wrote:
>
> > Hi,
> > I've been struggling to understand the concept of sending resources (such
> > as
> > PDF) to the output with Wicket.
> > I searched many site and wasn't able to find anything useful for me.
> > (I found only one thread in this mailing list regarding iText).
> >
> > Anyway,
> > Suppose I know how to create a PDF file.
> > How can I then show it to the user?
> >
> > Suppose I have created the Document. What next?
> >
> > If someone can give a direction in here or a link to good example, I
> would
> > be most appreciate.
> >
> > Thanks
> >
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
>
Re: Need help with Wicket, ResourceStream (itext adn pdf)
Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
If what you want is streaming back the PDF contents something like:
ResourceLink fileLink = new ResourceLink("file", new
DynamicWebResource(file.getName()) {
private static final long serialVersionUID = 1L;
@Override
protected ResourceState getResourceState() {
return new DynamicWebResource.ResourceState() {
@Override
public String getContentType() {
return DownLoadExportPanel.this.getContentType();
}
@Override
public byte[] getData() {
try {
return FileUtils.bytes(new
FileInputStream(file));
} catch (Exception e) {
return null;
}
}
};
}
});
<a wicket:id="file"><span wicket:id="message"></span></a>
will do the Job. Here I'm assuming the PDF is in a file...
2- If what you want is showing the PDF inside an iframe maybe the following
link can be of some help
http://cwiki.apache.org/WICKET/displaying-content-eg-pdf-excel-word-in-an-iframe.html
Best,
Ernesto
On Sat, Apr 25, 2009 at 9:33 PM, Eyal Golan <eg...@gmail.com> wrote:
> Hi,
> I've been struggling to understand the concept of sending resources (such
> as
> PDF) to the output with Wicket.
> I searched many site and wasn't able to find anything useful for me.
> (I found only one thread in this mailing list regarding iText).
>
> Anyway,
> Suppose I know how to create a PDF file.
> How can I then show it to the user?
>
> Suppose I have created the Document. What next?
>
> If someone can give a direction in here or a link to good example, I would
> be most appreciate.
>
> Thanks
>
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P Save a tree. Please don't print this e-mail unless it's really necessary
>