Download PDF from inside qooxdoo desktop

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Download PDF from inside qooxdoo desktop

Marcel Ruff-3
Hi,

how do I best download a PDF from inside a qooxdoo desktop application?

If I use window target the popup blocker of firefox reacts.

How is it possible that inside my qooxdoo application the firefox download dialog opens
to save the pdf?

Thank you
Marcel

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Download PDF from inside qooxdoo desktop

kreimer
Hi,

I suggest qx.ui.basic.Label with rich : true so you can render a myPdf.
But in order to the browser ask the user to save the pdf as a file (rather than open it), you should indicate this in a http response of the pdf itself

Content-Disposition: attachment; filename=myPdf.pdf

if your server environment is java in you download servlet:

response.addHeader("Content-Disposition", "attachment; filename=myPdf.pdf");

if the pdf is downloaded from a static server (apache, lighttpd..) you have to map this header response in the server.

Regards!
Reply | Threaded
Open this post in threaded view
|

Re: Download PDF from inside qooxdoo desktop

kreimer
I suggest qx.ui.basic.Label with rich : true so you can render a
< a href="urlOfMyPdf" >myPdf< a >
 
Reply | Threaded
Open this post in threaded view
|

Re: Download PDF from inside qooxdoo desktop

oetiker
In reply to this post by Marcel Ruff-3
Today Marcel Ruff wrote:

> Hi,
>
> how do I best download a PDF from inside a qooxdoo desktop application?
>
> If I use window target the popup blocker of firefox reacts.
>
> How is it possible that inside my qooxdoo application the firefox download
> dialog opens
> to save the pdf?

I often open the pdf url in an iframe ... as long as the server
sets the appropriate content-type headers, the browser will popopen
a save dialog ...

cheers
tobi


> Thank you
> Marcel
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
www.oetiker.ch [hidden email] +41 62 775 9902


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Download PDF from inside qooxdoo desktop

John Spackman-3
In reply to this post by Marcel Ruff-3
Hi Marcel

If you want to suppress the popup blocker warning then the trick is to make sure that the window.open() happens as a direct result of the users click event – I’ve got this in one of my apps and it works fine on Firefox for a PDF download (the PDF opens in another tab, without a popup blocker warning):

    var btn = new qx.ui.form.Button("Download").set({ allowGrowY: false });

    this._add(btn);

    btn.addListener("execute", this.__onDownload, this);


//...snip ...


    __onDownload: function(evt) {

      var src = // get the absolute URL here

      window.open(src, "_blank");

    }


The user can then save the PDF.

Regards
John

From: Marcel Ruff <[hidden email]>
Reply-To: qooxdoo Development <[hidden email]>
Date: Friday, 4 December 2015 at 11:27
To: qooxdoo Development <[hidden email]>
Subject: [qooxdoo-devel] Download PDF from inside qooxdoo desktop

Hi,

how do I best download a PDF from inside a qooxdoo desktop application?

If I use window target the popup blocker of firefox reacts.

How is it possible that inside my qooxdoo application the firefox download dialog opens
to save the pdf?

Thank you
Marcel
------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140_______________________________________________ qooxdoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Download PDF from inside qooxdoo desktop

Dietrich Streifert
Hi Marcel,

my fault was, some time ago, trying to call window.open within a qx.event.Timer.once, which lead the window.open call being classified as a popup by Firefox, because it was decoupled from the user click. Of course some browsers detected this as a bad behaviour, some not. I think it worked with Chrome but not with Firefox.

As John said window.open has to be a direct result of a user action like a mouse click.

Regards
Dietrich

Am 04.12.2015 um 14:36 schrieb John Spackman:
Hi Marcel

If you want to suppress the popup blocker warning then the trick is to make sure that the window.open() happens as a direct result of the users click event – I’ve got this in one of my apps and it works fine on Firefox for a PDF download (the PDF opens in another tab, without a popup blocker warning):

    var btn = new qx.ui.form.Button("Download").set({ allowGrowY: false });

    this._add(btn);

    btn.addListener("execute", this.__onDownload, this);


//...snip ...


    __onDownload: function(evt) {

      var src = // get the absolute URL here

      window.open(src, "_blank");

    }


The user can then save the PDF.

Regards
John

From: Marcel Ruff <[hidden email]>
Reply-To: qooxdoo Development <[hidden email]>
Date: Friday, 4 December 2015 at 11:27
To: qooxdoo Development <[hidden email]>
Subject: [qooxdoo-devel] Download PDF from inside qooxdoo desktop

Hi,

how do I best download a PDF from inside a qooxdoo desktop application?

If I use window target the popup blocker of firefox reacts.

How is it possible that inside my qooxdoo application the firefox download dialog opens
to save the pdf?

Thank you
Marcel
------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140_______________________________________________ qooxdoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140


_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel