On 01/30/2012 01:41 PM, slah wrote:
> hello,
>
> when I download a pdf file from internet it's displayed in the browser
> window (acrobat plugin I guess renders it).
>
> I'm using this qooxdoo code:
>
> __openPopup : function(pageURL, title,w,h) {
>                                       var left = (screen.width/2)-(w/2);
>                                       var top = (screen.height/2)-(h/2);
>                                       var targetWin = window.open(pageURL, 
> title, 'toolbar=no, location=no,
> directories=no, status=no, menubar=no, scrollbars=auto, resizable=no,
> copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
>                                       if (window.focus) {targetWin.focus()};
>                                       return targetWin;                       
>         
>                               },
>                               
>                               __generatePDF : function(html){                 
>                 
>                                       var url = 
> "http://127.0.0.1/myProject/build/gen_pdf.php";;
>                                       var req = new qx.io.request.Xhr(url);
>                                       req.setMethod('POST');
>                                       req.setRequestData(html);
>                                       req.addListener("success", function(e) {
>                                         var req = e.getTarget();              
>                         
>                                         var win = 
> this.__openPopup("report.html", "name", 600, 500);
>                                         
> win.document.write(req.getResponse()); //!! here's the problem I
> guess

Ok, I see. No, just pushing the PDF data into a window won't work. One 
way around this would be to *not* return the PDF data with the response, 
but rather store the document on the server and retrun just the URL to 
it. Then you can open this URL in a new window, with the browser's 
normal document handling.

Another option would be to use something like Pdf.js [1].

T.

[1] https://github.com/andreasgal/pdf.js



------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to