You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mfs <fa...@gmail.com> on 2008/08/22 03:49:36 UTC
Inline-pdf generated on the fly using DynamicWebResource - Showing
Custom FileName on "File -> Save As"
Guys,
I am struggling with an issue relating to PDF displayed inline on a browser
window, hopefully someone can point me to the right direction.....Below is
the scenario
I am generating a pdf on the fly using DynamicWebResource, and the pdf is
shown inline in a new browser window on the click of a button, as
expected...
The problem i am facing is with the usage of "File->SaveAs" or
"Adobe-Toolbar - Save Icon" when trying to save the file. Basically on
clicking any of the above the file-name shown by-default on the "Save-As
dialog" box is the context-path (the part before the url-parameters) i.e.
"mypage" in case the url is http://[host-name]/wap/mypage?id=123".
Even setting the headers to "Content-Disposition", "inline; filename=\"" +
filename + "\"" does doesn't work consistently across all browsers and to
what it turns out, in most of the cases clicking "File-SaveAs" (or the save
icon) results in context-path being shown in the save-as dialog box (as
mentioned above) , and hence the only solution i see is to come up with a
way where the url for the generated-pdf could modified/rendered such that it
appears as http://[host-name]/wap/[custom-file-name-for-every-pdf]
Any suggestions would be highly appreciated..
Thanks in advance,
Farhan.
--
View this message in context: http://www.nabble.com/Inline-pdf-generated-on-the-fly-using-DynamicWebResource---Showing-Custom-FileName-on-%22File--%3E-Save-As%22-tp19100081p19100081.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: Inline-pdf generated on the fly using DynamicWebResource -
Showing Custom FileName on "File -> Save As"
Posted by Ned Collyer <ne...@gmail.com>.
I don't have an environment at the moment, however I recall dealing with this
in struts by setting
Content-Disposition: attachment
or
Content-Type: download
(cant remember the exact)
basically forcing the download.
No one should be subjected to reading PDFs in a web browser!! DAMN YOU
ADOBE!
mfs wrote:
>
> Guys,
>
> I am struggling with an issue relating to PDF displayed inline on a
> browser window, hopefully someone can point me to the right
> direction.....Below is the scenario
>
> I am generating a pdf on the fly using DynamicWebResource, and the pdf is
> shown inline in a new browser window on the click of a button, as
> expected...
>
> The problem i am facing is with the usage of "File->SaveAs" or
> "Adobe-Toolbar - Save Icon" when trying to save the file. Basically on
> clicking any of the above the file-name shown by-default on the "Save-As
> dialog" box is the context-path (the part before the url-parameters) i.e.
> "mypage" in case the url is http://[host-name]/wap/mypage?id=123".
>
> Even setting the headers to "Content-Disposition", "inline; filename=\"" +
> filename + "\"" does doesn't work consistently across all browsers and to
> what it turns out, in most of the cases clicking "File-SaveAs" (or the
> save icon) results in context-path being shown in the save-as dialog box
> (as mentioned above) , and hence the only solution i see is to come up
> with a way where the url for the generated-pdf could modified/rendered
> such that it appears as
> http://[host-name]/wap/[custom-file-name-for-every-pdf]
>
> Any suggestions would be highly appreciated..
>
> Thanks in advance,
>
> Farhan.
>
--
View this message in context: http://www.nabble.com/Inline-pdf-generated-on-the-fly-using-DynamicWebResource---Showing-Custom-FileName-on-%22File--%3E-Save-As%22-tp19100081p19102300.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: Inline-pdf generated on the fly using DynamicWebResource - Showing
Custom FileName on "File -> Save As"
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Hi
I once did something similar, and after a lot of work trying to fix it
so it were consistent came to the conclusion that on that point too
browsers are different, we wanted it to open a doc inline.
mfs wrote:
> Guys,
>
> I am struggling with an issue relating to PDF displayed inline on a browser
> window, hopefully someone can point me to the right direction.....Below is
> the scenario
>
> I am generating a pdf on the fly using DynamicWebResource, and the pdf is
> shown inline in a new browser window on the click of a button, as
> expected...
>
> The problem i am facing is with the usage of "File->SaveAs" or
> "Adobe-Toolbar - Save Icon" when trying to save the file. Basically on
> clicking any of the above the file-name shown by-default on the "Save-As
> dialog" box is the context-path (the part before the url-parameters) i.e.
> "mypage" in case the url is http://[host-name]/wap/mypage?id=123".
>
> Even setting the headers to "Content-Disposition", "inline; filename=\"" +
> filename + "\"" does doesn't work consistently across all browsers and to
> what it turns out, in most of the cases clicking "File-SaveAs" (or the save
> icon) results in context-path being shown in the save-as dialog box (as
> mentioned above) , and hence the only solution i see is to come up with a
> way where the url for the generated-pdf could modified/rendered such that it
> appears as http://[host-name]/wap/[custom-file-name-for-every-pdf]
>
you should be able to todo this by using shared resources (depending on
usage, are it session relative or not).
> Any suggestions would be highly appreciated..
>
> Thanks in advance,
>
> Farhan.
>
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Inline-pdf generated on the fly using DynamicWebResource -
Showing Custom FileName on "File -> Save As"
Posted by Ned Collyer <ne...@gmail.com>.
Firstly - sorry for my initial post - i didnt see the "inline" bit in the
subject - so I wasn't very helpful.
You could also use a MixedParamUrlCodingStrategy and mount the page as
http://[host-name]/wap/[id]/[filename]
- then you can put in a check that the filename matches the ID (ie, its a
valid URL).
Martin Makundi wrote:
>
> Exactly. Use a bookmarkable page to render your dynamic resource which
> will give you an url
>
--
View this message in context: http://www.nabble.com/Inline-pdf-generated-on-the-fly-using-DynamicWebResource---Showing-Custom-FileName-on-%22File--%3E-Save-As%22-tp19100081p19104872.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: Inline-pdf generated on the fly using DynamicWebResource - Showing Custom FileName on "File -> Save As"
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> that i want to have a [custom-file-name].pdf declared based on the pdf being
> generated dynamically, so if i mount a page with a certain name (i am not
> sure but) i would have to use the same name as specified for mounting isn't
> it ?
Try Ned's suggestion about using MixedParamUrlCodingStrategy instead.
> Secondly i have question that when u talk about downloading the contents
> from bookmarkable page, you would mean flushing/streaming the pdf contents
> in the constructor of the bookmarkable page is it ? or am i missing
> something on this ?
The only thing that matters is that when you click the download link,
it points to an url that ends with your filename.
**
Martin
> Martin Makundi wrote:
>>
>>> The problem i am facing is with the usage of "File->SaveAs" or
>>> "Adobe-Toolbar - Save Icon" when trying to save the file. Basically on
>>> clicking any of the above the file-name shown by-default on the "Save-As
>>> dialog" box is the context-path (the part before the url-parameters) i.e.
>>> "mypage" in case the url is http://[host-name]/wap/mypage?id=123".
>>
>> Exactly. Use a bookmarkable page to render your dynamic resource which
>> will give you an url
>>
>> http://[host-name]/wap/MyFilename.ext
>>
>> **
>> Martin
>>
>> ---------------------------------------------------------------------
>> 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/Inline-pdf-generated-on-the-fly-using-DynamicWebResource---Showing-Custom-FileName-on-%22File--%3E-Save-As%22-tp19100081p19113506.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: Inline-pdf generated on the fly using DynamicWebResource -
Showing Custom FileName on "File -> Save As"
Posted by mfs <fa...@gmail.com>.
Hi Martin,
Actually i had some questions/clarifications as i posted in my other post,
and i.e.
that i want to have a [custom-file-name].pdf declared based on the pdf being
generated dynamically, so if i mount a page with a certain name (i am not
sure but) i would have to use the same name as specified for mounting isn't
it ?
Secondly i have question that when u talk about downloading the contents
from bookmarkable page, you would mean flushing/streaming the pdf contents
in the constructor of the bookmarkable page is it ? or am i missing
something on this ?
Thanks again
Martin Makundi wrote:
>
>> The problem i am facing is with the usage of "File->SaveAs" or
>> "Adobe-Toolbar - Save Icon" when trying to save the file. Basically on
>> clicking any of the above the file-name shown by-default on the "Save-As
>> dialog" box is the context-path (the part before the url-parameters) i.e.
>> "mypage" in case the url is http://[host-name]/wap/mypage?id=123".
>
> Exactly. Use a bookmarkable page to render your dynamic resource which
> will give you an url
>
> http://[host-name]/wap/MyFilename.ext
>
> **
> Martin
>
> ---------------------------------------------------------------------
> 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/Inline-pdf-generated-on-the-fly-using-DynamicWebResource---Showing-Custom-FileName-on-%22File--%3E-Save-As%22-tp19100081p19113506.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: Inline-pdf generated on the fly using DynamicWebResource - Showing Custom FileName on "File -> Save As"
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> The problem i am facing is with the usage of "File->SaveAs" or
> "Adobe-Toolbar - Save Icon" when trying to save the file. Basically on
> clicking any of the above the file-name shown by-default on the "Save-As
> dialog" box is the context-path (the part before the url-parameters) i.e.
> "mypage" in case the url is http://[host-name]/wap/mypage?id=123".
Exactly. Use a bookmarkable page to render your dynamic resource which
will give you an url
http://[host-name]/wap/MyFilename.ext
**
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org