You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ulrik <ul...@gmail.com> on 2008/09/15 16:13:20 UTC
Display a PDF in a new Window
Hello!
I have a PDF file in a byte[]. How do I display that PDF in a new window
when I click on a link?
Can someone please point me in the right direction?
//Ulrik
--
View this message in context: http://www.nabble.com/Display-a-PDF-in-a-new-Window-tp19493773p19493773.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Display a PDF in a new Window
Posted by Adriano dos Santos Fernandes <ad...@uol.com.br>.
ulrik escreveu:
> Hello!
>
> I have a PDF file in a byte[]. How do I display that PDF in a new window
> when I click on a link?
> Can someone please point me in the right direction?
Create a class extending from WebResource, override getResourceStream()
and return an object implementing IResourceStream.
In your Application.init, you'll have to mount it:
@Override
protected void init()
{
super.init();
mountSharedResource("/Report", new ResourceReference("Report") {
@Override
protected Resource newResource()
{
return new ReportWebResource();
}
}.getSharedResourceKey());
}
Adriano
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: Display a PDF in a new Window
Posted by ulrik <ul...@gmail.com>.
Thanx for the reply (both of you)
I will try the DynamicWebResource, and get back to you if I run into any
problems..
Kai Mütz wrote:
>
> ulrik <ma...@gmail.com> wrote:
>> Hello!
>>
>> I have a PDF file in a byte[]. How do I display that PDF in a new
>> window when I click on a link? Can someone please point me in the
>> right direction?
>
> DynamicWebResource should do it.
>
> http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/
> markup/html/DynamicWebResource.html
>
> Cheers,
> Kai
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Display-a-PDF-in-a-new-Window-tp19493773p19494802.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: Display a PDF in a new Window
Posted by Kai Mütz <km...@googlemail.com>.
Extend DynamicWebResource with something like
public class MyDynamicResource extends DynamicWebResource {
protected final ResourceState getResourceState() {
return new MyResourceState();
}
private class MyResourceState extends ResourceState {
public String getContentType() {
return "application/pdf";
}
public byte[] getData() {
return pdfAsBayeArry;
}
}
}
and add a ResourceLink to your page, e.g.:
add(new ResourceLink("pdf-link", new MyDynamicResource()));
HTH, Kai
ulrik <ma...@gmail.com> wrote:
> Hi again
>
> I have no idea of how to solve it..
> Could you please explain more in detail?
>
> What I want to do is, when I click on a link/button or something
> similar I want to open a pdf which will be downloaded from a database
> as a byte[]..
>
> How would I do this?
>
> //Ulrik
>
>
> Kai Mütz wrote:
>>
>> ulrik <ma...@gmail.com> wrote:
>>> Hello!
>>>
>>> I have a PDF file in a byte[]. How do I display that PDF in a new
>>> window when I click on a link? Can someone please point me in the
>>> right direction?
>>
>> DynamicWebResource should do it.
>>
>>
> http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apac
> he/wicket/
>> markup/html/DynamicWebResource.html
>>
>> Cheers,
>> Kai
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
http://www.nabble.com/Display-a-PDF-in-a-new-Window-tp19493773p19531929.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: Display a PDF in a new Window
Posted by ulrik <ul...@gmail.com>.
Hi again
I have no idea of how to solve it..
Could you please explain more in detail?
What I want to do is, when I click on a link/button or something similar I
want to open a pdf which will be downloaded from a database as a byte[]..
How would I do this?
//Ulrik
Kai Mütz wrote:
>
> ulrik <ma...@gmail.com> wrote:
>> Hello!
>>
>> I have a PDF file in a byte[]. How do I display that PDF in a new
>> window when I click on a link? Can someone please point me in the
>> right direction?
>
> DynamicWebResource should do it.
>
> http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/
> markup/html/DynamicWebResource.html
>
> Cheers,
> Kai
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Display-a-PDF-in-a-new-Window-tp19493773p19531929.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: Display a PDF in a new Window
Posted by Kai Mutz <km...@googlemail.com>.
ulrik <ma...@gmail.com> wrote:
> Hello!
>
> I have a PDF file in a byte[]. How do I display that PDF in a new
> window when I click on a link? Can someone please point me in the
> right direction?
DynamicWebResource should do it.
http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/
markup/html/DynamicWebResource.html
Cheers,
Kai
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org