开发者

Printing content of IFRAME

I am trying to print the contents in the iframe. The Below code is working fine.

HTML:

  <div id="containerDiv">           
            <p> 
                <table cellpadding="1" width="100%" height="100%" cellspacing="0" border="0">                
                 <tr>
                   <td align="right" ><img src="Images/printer1.png" alt="Print" id="imgprint" onclick="printticket()" style="display:none;cursor:pointer;padding-top:2px;" /></td>
                 </tr>
                 <tr>
                  <td align="center">
                    <iframe id="OverlayDis" name="OverlayDis" scrolling="yes" src="Default1.aspx" allowtransparency="true"
                    runat="server" frameborder="0" style="background-color: white; width: 980px; height: 500px;"></iframe>
                  </td>
                 </tr>
                 <tr>
                   <td align="center"><input type="button" style="background-color:#400000;border:solid 1px black;color:White;font-weight:bold" id="closeLink" href="javascript:void(0);" value="Close"/></td>  
                 </tr>
                </table>
            </p>
        </div>  

JS:

  window.frames["OverlayDis"].focus();
  window.frames["OverlayDis"].print();

But I have problem with font size.the Visible font size is not come in hardcopy.The page have 12px size of all text but the output printing come 8pt and less.

what happening?

 @media print
    {
      body{font-family:verdana; font-size:10px;}
      span.subheader{font-family: Verdana; font-size: 12px; font-weight: bold;}  
      span.sign{float:right;padding-right:20px;padding-top:20px;font-size:12px;font-weight:20px;font-weight: bold;}
    }

    @media scr开发者_开发百科een
    {
      body{font-family:verdana; font-size:10px;}
      span.subheader{font-family: Verdana; font-size: 12px; font-weight: bold;}
      span.sign{float:right;padding-right:20px;padding-top:20px;font-size:12px;font-weight:20px;font-weight: bold;}
    }

I added this style to my page for printing but this is not working still so small font printing..Another thing is i have used lightbox plugin to display for this frame.

var test;
Event.observe(window, 'load', function () {
    test = new Lightbox('containerDiv');
});

function OpenOverlay(url)
{   
    document.getElementById('OverlayDis').src = url;
    test.open();

    Event.observe('closeLink', 'click', function () {
        test.close();
    });
}

What is my mistake?


Use a print stylesheet in the iframe's document.


I change the popup instead of iframe and make print and close Now working!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜