You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by hannach <ha...@solutiondynamics.com> on 2012/11/08 04:48:19 UTC

Unique PDF file name for displaying PDF in iframe

Hi there,

Recently I have implemented displaying PDF in iframe on my system reference
to 
https://cwiki.apache.org/WICKET/displaying-content-eg-pdf-excel-word-in-an-iframe.html.

I have list of documents and when user clicks each row, panel at the bottom
will refresh and show corresponding PDF.

It's all good however, when you try to download this PDF file, the file name
is non-user friendly as it looks something like
http---localhost-8080-?wicket-interface=-1-windows-0-window-......-embeddedPdf--IResourceListener--.

This name came from the URL of the iframe. (i.e. src)

Is there any way that I could make PDF name unique and user friendly?

Thank you in advance





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unique-PDF-file-name-for-displaying-PDF-in-iframe-tp4653701.html
Sent from the Users forum 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: Unique PDF file name for displaying PDF in iframe

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

It you use ResourceLink then the produced Url will be the path to the link
in the page, as you see.
In Wicket 1.5 you can mount resources to nice looking urls.
See http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ for
more details.


On Thu, Nov 8, 2012 at 11:57 AM, hannach <ha...@solutiondynamics.com>wrote:

> Thank you.
> Your solution worked fine with Chrome (with built-in PDF viewer plugin) but
> when I tried it with IE or Safari that has Adobe Acrobat as PDF viewer did
> not work so well. Perhaps it's Adobe thing...
>
> Is there a way to make each iframe's src unique every time user renders
> different document?
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Unique-PDF-file-name-for-displaying-PDF-in-iframe-tp4653701p4653710.html
> Sent from the Users forum 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
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Unique PDF file name for displaying PDF in iframe

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
append a random noise parameter to the URL

On Thu, Nov 8, 2012 at 10:57 AM, hannach <ha...@solutiondynamics.com>wrote:

> Thank you.
> Your solution worked fine with Chrome (with built-in PDF viewer plugin) but
> when I tried it with IE or Safari that has Adobe Acrobat as PDF viewer did
> not work so well. Perhaps it's Adobe thing...
>
> Is there a way to make each iframe's src unique every time user renders
> different document?
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Unique-PDF-file-name-for-displaying-PDF-in-iframe-tp4653701p4653710.html
> Sent from the Users forum 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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>

Re: Unique PDF file name for displaying PDF in iframe

Posted by hannach <ha...@solutiondynamics.com>.
Thank you.
Your solution worked fine with Chrome (with built-in PDF viewer plugin) but
when I tried it with IE or Safari that has Adobe Acrobat as PDF viewer did
not work so well. Perhaps it's Adobe thing...

Is there a way to make each iframe's src unique every time user renders
different document?




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unique-PDF-file-name-for-displaying-PDF-in-iframe-tp4653701p4653710.html
Sent from the Users forum 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: Unique PDF file name for displaying PDF in iframe

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Override

protected void setHeaders(WebResponse response)
{
super.setHeaders(response);
                response.setHeader("Content-Disposition", "inline;" +
((!Strings.isEmpty(filename)) ? ("; filename=\"" + filename + "\"") : ""));

}

On Thu, Nov 8, 2012 at 9:44 AM, hannach <ha...@solutiondynamics.com>wrote:

> Thank you for your suggestion.
>
> I've tried to set the filename however filename is set as the
> Content-Disposition header however this prompt the user to download the
> file
> instead of opening in the browser.
>
> What I want is to open the rendered document in iframe and when user
> chooses
> to download it I want it to have a unique name.
>
> Is there a way to have unique src in iframe instead of something like
> src="http://localhost:8080/?wicket:interface=:1:windows:0::IResourceLister
> "?
>
> Thanks in advance
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Unique-PDF-file-name-for-displaying-PDF-in-iframe-tp4653701p4653706.html
> Sent from the Users forum 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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>

Re: Unique PDF file name for displaying PDF in iframe

Posted by hannach <ha...@solutiondynamics.com>.
Thank you for your suggestion.

I've tried to set the filename however filename is set as the
Content-Disposition header however this prompt the user to download the file
instead of opening in the browser.

What I want is to open the rendered document in iframe and when user chooses
to download it I want it to have a unique name.

Is there a way to have unique src in iframe instead of something like
src="http://localhost:8080/?wicket:interface=:1:windows:0::IResourceLister"?

Thanks in advance





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unique-PDF-file-name-for-displaying-PDF-in-iframe-tp4653701p4653706.html
Sent from the Users forum 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: Unique PDF file name for displaying PDF in iframe

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Can you try overriding the constructor

public DynamicWebResource(String filename);

and passing a unique file name.

On Thu, Nov 8, 2012 at 4:48 AM, hannach <ha...@solutiondynamics.com>wrote:

> Hi there,
>
> Recently I have implemented displaying PDF in iframe on my system reference
> to
>
> https://cwiki.apache.org/WICKET/displaying-content-eg-pdf-excel-word-in-an-iframe.html
> .
>
> I have list of documents and when user clicks each row, panel at the bottom
> will refresh and show corresponding PDF.
>
> It's all good however, when you try to download this PDF file, the file
> name
> is non-user friendly as it looks something like
>
> http---localhost-8080-?wicket-interface=-1-windows-0-window-......-embeddedPdf--IResourceListener--.
>
> This name came from the URL of the iframe. (i.e. src)
>
> Is there any way that I could make PDF name unique and user friendly?
>
> Thank you in advance
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Unique-PDF-file-name-for-displaying-PDF-in-iframe-tp4653701.html
> Sent from the Users forum 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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>