开发者

Star tsp100 printer, make it cut the page (page break)

开发者 https://www.devze.com 2023-02-24 06:29 出处:网络
I\'m writing a receipt printing tool that will print receipts to the Star TSP100 futurePRNT receipt printers.I\'m trying to get it to double print on credit card transactions (customer and business co

I'm writing a receipt printing tool that will print receipts to the Star TSP100 futurePRNT receipt printers. I'm trying to get it to double print on credit card transactions (customer and business copy), but I can't figure out how to get it to make the printer cut it in half. The method I have of printing receipts generates them all at once and send them to the printer.

A receipt is represented by HTML and is all stored within a div with id="receiptBody(1 or 2)"

I surrounded each receiptBody with a table and got it to cut the receipt perfectly on my localhost environment, but when it's pushed out on my server it stops working. This is the structure of my receipt.

<table> <tr> <td>
    <div id="receiptBody1"> ... receipt content ... </div>
</td></tr></table>

<table> <tr> <td>
    <div id="receiptBody2"> ... receipt content ... </div>
</td></tr></table>

I've checked that all the HTML is correct and it prints fine from my server (formatting and content) aside from the printer just not cutting it. I'm not understanding why it cuts it on my localhost though

I'm just wondering if there are other people out there making receipts for this printer through HTML that know how to get it to cut it.

I'm using C# to construct the receipts (using a mvc) and a java applet to print it quickly for to the printer.

Or, if anyone can tell me how to (through javascript) print two copies of the current page. Like make window.print() print two copies as separate print jobs that way the printer a开发者_如何学运维uto cuts them.


Apparently, last time I tried this I forgot to include the always keyword.

<div style="page-break-after:always"></div>

That did end up working after all though. Just have to make sure that div is always closed or else it won't cut. Alternatively, perhaps a safer approach is to use:

<div style="page-break-before:always"></div>

That way if you accidentally forget to close it, I believe it'll still cut the page.

0

精彩评论

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