Hi Andrea,
Today A. Weber (Penplan) wrote:
>
> With PHP, we generate a PDF document on the server (using fpdf.php). This
> document can be saved as a file locally on the server or passed to the
> client with "Content-Type: application/pdf" or "Content-Type:
> application/x-download".
>
> What is the best way to display the PDF document in Qooxdoo or allow the
> user to download it (possibly without having to save the file on the server
> and passing the URL to the client) ?
> - qx.io.remote.Request ?
> - qx.io.remote.transport.Iframe ?
> - qx.ui.embed.iFrame ?
>
> seem to be the right way.
>
> Any pointer to the right direction (or a code snippet) is greatly
> appreciated!
the trick is to have your server ship out the pdf via http with
proper content-type settings ... and opening the coresponding url
from within your qooxdoo application. You can use either the
qx.bom.Window or an embeded IFrame for this.
Note that the latest chrome version has a serious bug which causes
the page zoom to go bonkers when a pdf is displayed within an
iframe. So I would opt for bom.Window ... example:
var url = ...;
var openBt = new qx.ui.form.Button(this.tr("Open PDF"));
myVbox.add(openBt);
openBt.addListener('execute',function(){
var win = qx.bom.Window.open(url, '_blank');
qx.bom.Event.addNativeListener(win,'load', function(e) {
var body = qx.dom.Node.getBodyElement(win);
var doc = qx.dom.Node.getDocumentElement(win);
if ((doc && qx.dom.Hierarchy.isEmpty(doc))
|| (body && qx.dom.Hierarchy.isEmpty(body))) {
// if an external viewer is handling the pdf
// we can as well close the window again
win.close();
}
});
},this);
Note that the window is being opened as a reaction to a button
click of the user. with this we work around popup blockers who
prevent windows from spontaneously being opend from within js.
hth
tobi
> Regards,
>
> Andrea
>
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel