打印预览中不显示条形码 - javascript 打印方法

Barcode not display in Print Preview - javascript print method

我想生成带有条形码的订单收据,但条形码未显示在 html 页面上的打印预览中。 它在我的本地服务器上运行良好。但是在实时服务器上它不起作用。

出于打印目的,我使用了 Javascript 方法。对于使用字体 B39MHR.TTF

的条形码

Javascript代码==>

var divToPrint = document.getElementById("manifest");
newWin = window.open("");
newWin.document.write("<link rel=\"stylesheet\" href=\"css/style.css\" type=\"text/css\" media=\"print\"/>");
newWin.document.write('<style type="text/css">  @font-face {font-family: \'B39MHR\';src: url(\'font/B39MHR.TTF\');} .barcodefnt {font-family: B39MHR; font-size: 19px;text-align: center;font-family: \'B39MHR\';src: url(\'font/B39MHR.TTF\')}}</style>');
newWin.document.write(divToPrint.outerHTML);
newWin.print();
newWin.close();

如果能得到一些帮助,我将不胜感激。提前致谢。

我已经尝试了很多解决方案,但用普通的 javascript 是不可能的。 JQPrint 插件在这个问题上对我有用。

为此必须只包含 jquery.jqprint-0.3.js javascript 文件和单行 javascript 代码如下,

$('#sectionID').jqprint(); // sectionID is ID of the section