需要帮助jquery打印 [英] Need help with jquery printing
问题描述
我正在尝试调整或更改一行编码,允许我使用第三方应用在Android上打印收据。第三方应用程序仅了解以下代码。提前致谢。
function sendToQuickPrinter(){
var text = test printerBig title;
var textEncoded = encodeURI (text);
window 。 location .href = quickprinter:// + textEncoded;
}
我如何结合使用上面和下面的代码,以便quickprinter://了解容器和能力打印到我的收据而不使用任何其他文件。再次感谢
jQuery( 。invoice-print-button-container)。on( click,function(){
var printWindow = window.open( , PRINT, height = 400,width = 600);
printWindow.document.write( + jQuery( 。[invoice-order-id)。 text()+ );
printWindow.document.write( );
printWindow.document.write( 跨度>);
printWindow.document.write( + jQuery( 。[invoice-main-wrapper)。html()+ );
printWindow.document.write( );
printWindow.document.close(); // IE> = 10
printWindow.focus(); // IE> = 10 * - /
printWindow.addEventListener( load,function(){
printWindow.print();
printWindow。 close();
},true);
返回 true;
});
我的尝试:
我尝试了以下代码,但收据纸已经出来,但它没有显示我需要的容器信息。
jQuery( .prinit-print-button-container)。on( 点击, function (){
var printWindow = window .open( , PRINT, height = 400,width = 600);
printWindow。 document .write( + jQuery( .jayry-order-id)。text()+ );
printWindow。 document .write( 跨度>);
printWindow。 document .write( 跨度>);
printWindow。 document .write( + jQuery( 。invoice-main-wrapper)。html()+ < span class =code-string> );
printWindow。 document .write( 跨度>);
var textEncoded = encodeURI (printWindow。 document 跨度> .WRITE);
window 。 location .href = quickprinter:// + textEncode; `
如何将以下html行插入jquery?感谢您提前获得建议/帮助
< html > < head > < title > + jQuery(。invoice-order-id)。text()+< / title >
< link media =' all' href =' + posStylesheetUr l +' type =' text / css' rel < span class =code-keyword> =' 样式表' >
< / head > < span class =code-keyword>< body >
< div class =' invoice-container' > < div class =' invoice- main-wrapper' > + jQuery(。invoice-main-wrapper)。html()+< / div > < / div >
< / body > < / html >
如何将上述html代码插入以下编码中,我需要在编码前解码吗?打印机实际上在文件上显示了用于var文本的html代码。
jQuery( .invoice-print-button-container)。on( click, function (){
var text =( 此处为打印机测试文本 + 更多文字 + ' «/ body>< / html>');
window 。 location .href = quickprinter:// + text;
});
i am trying to tweak or change a line of coding that allows me to print to a receipt on Android using a third party app. The third party app only understands the below code. Thanks in advance.
function sendToQuickPrinter(){
var text = "test printerBig title";
var textEncoded = encodeURI(text);
window.location.href="quickprinter://"+textEncoded;
}
How can i use both above and bottom code combined so that the quickprinter:// understands the container and able to print onto my receipt without using any additional files. Thanks again
jQuery(".invoice-print-button-container").on("click", function(){
var printWindow = window.open("", "PRINT", "height=400,width=600");
printWindow.document.write(""+ jQuery(".invoice-order-id").text() + "");
printWindow.document.write("");
printWindow.document.write("");
printWindow.document.write(""+jQuery(".invoice-main-wrapper").html()+"");
printWindow.document.write("");
printWindow.document.close(); // necessary for IE >= 10
printWindow.focus(); // necessary for IE >= 10*-/
printWindow.addEventListener("load", function(){
printWindow.print();
printWindow.close();
}, true);
return true;
});
What I have tried:
I have tried the below code but the receipt paper comes out but it doesn't display the container information that i need.
jQuery(".invoice-print-button-container").on("click", function(){
var printWindow = window.open("", "PRINT", "height=400,width=600");
printWindow.document.write(""+ jQuery(".invoice-order-id").text() + "");
printWindow.document.write("");
printWindow.document.write("");
printWindow.document.write(""+jQuery(".invoice-main-wrapper").html()+"");
printWindow.document.write("");
var textEncoded = encodeURI(printWindow.document.write);
window.location.href="quickprinter://"+textEncode;`
how can i insert the following html lines into jquery? Thanks for the advice/help in advance
<html><head><title>"+ jQuery(".invoice-order-id").text() + "</title> <link media='all' href='"+posStylesheetUrl+"' type='text/css' rel='stylesheet'> </head><body> <div class='invoice-container'><div class='invoice-main-wrapper'>"+jQuery(".invoice-main-wrapper").html()+"</div></div> </body></html>
How can i insert the above html codes into the below coding, do i need to decode before i encode? The printer actually showing the html code on the paper for var text.
jQuery(".invoice-print-button-container").on("click", function(){ var text = ("test text here for printer"+"more text"+'≪/body></html>'); window.location.href="quickprinter://"+text; });
这篇关于需要帮助jquery打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!