imTigger / webapp-hardware-bridge

Silent print and serial ports for web!
MIT License
139 stars 74 forks source link

Unble to control page size #12

Open geniuskidkanyi opened 4 years ago

geniuskidkanyi commented 4 years ago

when i printing it uses the page size on the printer instead of a dynamic height, is there a way to set height to to dynamic

stiidk commented 4 years ago

I have the same problem.. When printing a PDF receipt, a LOT of blank paper is coming out before the receipt..

I have a workaround that could be nice to add to the configuration somehow. Use the documents height and not the PageFormats height from the default job:

paper.setSize(document.getPage(0).getMediaBox().getWidth(), document.getPage(0).getMediaBox().getHeight()); paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());

imTigger commented 4 years ago

Currently WHB have no ability to control page/paper size. It depend the printer's default setting.

Could you tell what type/model of printer you are using?

stiidk commented 4 years ago

I am using a Star TSP143IIIBI (Bluetooth).

I don't under understand what you mean by WHB? But the code I posted are working locally when i test it, where I use the document size to set the Paper size ( document.getPage(0).getMediaBox().getHeight() ).

stiidk commented 4 years ago

I must have had my head to fare down in the code when I replyed... WHB = webapp-hardware-bridge!!! Doh ;)

tfkproject commented 4 years ago

I'm facing same problem here, blank paper is coming out. How can I handle this snip? (I'm using TCPDF PHP) even not TCPDF, how to use this set? in html page or what? @stiidk

paper.setSize(document.getPage(0).getMediaBox().getWidth(), document.getPage(0).getMediaBox().getHeight()); paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());

mazsa97 commented 1 year ago

Does anyone found a solution for this?