简体   繁体   English

使用JavaScript和C#打印POS收据

[英]Print pos receipt using javascript and c#

I wonder is there any way to print the pos receipt through javascript and c# mvc, the most important condition is cannot redirect page or refresh the current page. 我想知道有没有办法通过javascript和c#mvc打印pos收据,最重要的条件是无法重定向页面或刷新当前页面。 I cannot find any reference online, anybody can suggest me? 我在网上找不到任何参考,有人可以建议我吗? Or javascript totally cannot done something like this? 还是javascript完全不能做这样的事情? I do not want to use print.js cause it will pop out a page and let user to choose which printer to use. 我不想使用print.js,因为它将弹出一个页面并让用户选择要使用的打印机。

Short Answer: No. 简短答案:不。

When you want to print something in a browser, well you may use different approaches like window.print() however no matter which method you do, finally you are just asking the browser to do the print (sending the print command), so it is something that depends on browser and if it insists on showing print options before printing, you can do nothing about it and you can not go beyond what it gives access to you, and what it doesn't. 当您想在浏览器中打印某些内容时,可以使用诸如window.print()类的不同方法,但是无论您采用哪种方法,最终您都只是在要求浏览器进行打印(发送打印命令),因此是取决于浏览器的内容,如果它坚持在打印之前显示打印选项,则您将无能为力,并且不能超出它能为您提供的访问权限,也不能超越它所不能提供的访问权限。

So this is something related to how the browser functions and its limitations and has nothing to do with javascript or c#. 因此,这与浏览器的功能及其局限性有关,与javascript或c#无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM