English 中文(简体)
铬:不打印正文内容
原标题:Chrome: doesn t print javascript content

(这是通过Grease/Tampermonkey)

此处为使用 Chrome beta 浏览器的 skiosk 打印函数 :

$("#autoCheckOrder button").click ( function () {
    var newWin      = window.open (""); 
    newWin.document.write ( "<!DOCTYPE html>" );
    newWin.document.write( "<html>" );
    newWin.document.write( "<head>" );
    newWin.document.write( "<title>" );
    newWin.document.write( "</title>" );
    newWin.document.write( "<style>" );
    newWin.document.write( "@media print { " );
    newWin.document.write( "body { " );
    newWin.document.write( "background-color: white;" );
    newWin.document.write( "width: 55mm;" );
    newWin.document.write( "position: absolute;" );
    newWin.document.write( "top: 0;" );
    newWin.document.write( "left: 0;" );
    newWin.document.write( "padding: 0px;" );
    newWin.document.write( "font-size: 14px;" );
    newWin.document.write( "line-height: 18px;" );
    newWin.document.write( "}" );
    newWin.document.write( "}" );
    newWin.document.write( "</style>" );
    newWin.document.write( "</head>" );
    newWin.document.write( "<body>" );
    newWin.document.write ( loanHTML ); 
    newWin.document.write( "</body>" );
    newWin.document.write( "</html>" );
    if(newWin.print()) {
        newWin.close();
    } else {
        newWin.close();
    }
});

It grabs a table from the a page listing all items, then creates a receipt . The receipt is then printed. This worked perfectly for a while, now it only prints the first item.

我尝试过以下方法,但完全没有结果:

  • Using page-break-after: always
  • Placing receipt in div with the above CSS rule
  • Reinstalling the printer
  • Paper reduction settings for printer

疯狂的是,它曾经完美地打印所有项目,现在却没有。我甚至从备份中重新安装了脚本,只是为了确定。

不知道从这里往何处去。 所有内容都在打印预览中显示, 但只有第一个项目指纹。 页眉和页脚设置只会让事情变得更糟糕, 而不是更好 。

<强> UPDATE

我更改了发往打印机的 HTML, 并且它有效 。 仍然不确定它是否完全有效, 但它正在打印 。 如果它停止打印, 我会知道要修什么。 感谢您的输入!

最佳回答

我看到的唯一可信的解释是 您的贷款HTML变量是空的或未定义的 。

http://jsfidle.net/waitinforrastrain/bMzUt/2/" rel="nofollow" >http://jsfidle.net/waitinfortradrain/bMzUt/2/

评论va 借出HTML 的线,再运行一次,你会明白我的意思。

问题回答

暂无回答




相关问题
Redirect to cache URL in Chrome browser

self.location = cache: + self.location I want to redirect from "[URL]" to "cache:[URL]". I just want this code to work in Chrome browser.

我如何更新/重载 Chrome延?

I m在4号 Chrome(目前为4.0.249.0)中开发一个延伸点,显示用户在地位酒吧中的形象。 Ive设计了一个供用户使用的备选办法网页......

Setting Opacity in CSS For Chrome

I ve tried the following: (this is actually for fancybox, as the overlay does not show in chrome/safari: $("#fancy_overlay").css({<br /> background-color : opts....

Chrome Blocking Javascript, Google Wave, Google Gadgets

Project: Developing a gadget template for Google Wave which will allow my Flash movies to interact with the Wave api. I had to adapt the existing Flex application so that it would work with ...

image height using jquery in chrome problem

$( img ).height() returns 0 in chrome, but it returns the actual height in IE and firefox. Whats the actual method to get the height of the image in chrome?

jQuery block moving

I wanna move a div block to the top, so I coded like this: CSS part: .movingPart{ margin-top:80px; } jQuery part: $(document).ready(function() { $( #btn ).click(function() { $( .movingPart )....

Table cells bad rendering with Google Chrome/Webkit

On the following code, COL1A and COL3A are not 50% height with Chrome or Webkit. It works fine with IE7 and Firefox. <table border="1"> <tr> <td height="100%">COL 1A</td>...

热门标签