×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

Help please. (java) details inside

Thank in advance first.

Following it the problem:
1. I have one html shown
2. I want this: when user click a button, then go server side to generate a pdf file, and automatically show the IE print dialog.

My current way is this:
1. when use clicks the button, let one iframe change its src
iframe1.src='pdfGeneratorURL?...'
2. on iframe set onload='printPDF()';
3.
function printPDF(){
var dc=document.getElementById(iFrame');
alert(dc);
var acrobat = dc.contentWindow.document.applets["objPdf"];
alert(acrobat);
if (acrobat != null && acrobat != undefined){
acrobat.Print();
}
}

OK it works on w2000, but not WinXP, the 2 alert() works fine, but just dont print....

HELP guys please.
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / Help please. (java) details inside
    Thank in advance first.

    Following it the problem:
    1. I have one html shown
    2. I want this: when user click a button, then go server side to generate a pdf file, and automatically show the IE print dialog.

    My current way is this:
    1. when use clicks the button, let one iframe change its src
    iframe1.src='pdfGeneratorURL?...'
    2. on iframe set onload='printPDF()';
    3.
    function printPDF(){
    var dc=document.getElementById(iFrame');
    alert(dc);
    var acrobat = dc.contentWindow.document.applets["objPdf"];
    alert(acrobat);
    if (acrobat != null && acrobat != undefined){
    acrobat.Print();
    }
    }

    OK it works on w2000, but not WinXP, the 2 alert() works fine, but just dont print....

    HELP guys please.
    • I need to know why and if there is other ways to do it. Thx
      • another question is why i change src of pdf object, then ie crashed? src inside
        in html:
        <object id="objPdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" style="height:100; width:101">
        <param name="src" value="s1.pdf"/>
        </object>

        in js:
        var acrobat = document.applets["objPdf"];
        acrobat.src="s1.pdf";
      • I really need help please... tried several ways, just doest work on winXP.fine with win2000
        • up
      • even this will not works in win xp...
        in html:
        <object id="objPdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" style="height:0; width:0">
        </object>

        in js:
        var acrobat = document.applets["objPdf"];
        acrobat.src="printAbc.do";
        acrobat.Print();

        ???help please...
      • guys, any1 knows winxp is really restraint and blocks lots of java script?
      • any1 works with winxp sp2 ie using lots javascript? sad.. tried lots ways, none works
    • 难怪没人帮你 - 这问题跟Java有啥关系?
      • well, kind of typo, but .you can help?
    • OK , let me clarify this: this is a Javascript and PDF related question.
      • actually pdf is generated (server side all ok), but IE just doest show me the print dialog.
        In another html, I load the pdf first (same way), then let use click a button (the only difference)
        Then the print dialog shows....

        I did another test:
        Load the pdf in a iframe, then use click a checkbox ... still doest work. sad....

        All those tests just work on win2000......
        • desides, I set the size of pdf object is 200,200, in Winxp, the pdf doest show up.
          One of my teammate using acrobat 7.0 and pop up something like 'not found %PDF%"...
          • Besides.. (oops)