Community Forum

Stop printing when text lines are over

Profile Image 3 Posts 3 Karma
Chathushka99 posted this 07 March 2016

I have created a web based system for generating receipts for stores. these stores have different kind of papers(in terms of size, quality ... etc ). I don't want to go to each store & set paper size manually because those printers are used for other purposes too. But then, what happen is printer process full A4 size(if the default page size is set to A4 in the printer)  paper even without the text. this is a problem when reciept page is smaller than A4. So what I want is when the text lines are over, the printing must be finished too. Is there anyway I can fix it?
P.S: there is a method in java writing text directly to LPT1 port. the printing stops when the text is over. i want the printing to be like that

Profile Image 189 Posts 189 Karma
Jerry posted this 07 March 2016

Hi

 

An interesting issue for you to experiment with.

 

About all I can suggest is that you script some way of measuring the height of the page's content, and flag it into different bands (say) A, B , C, D etc.

 

Then tell ScriptX to set a different paperSize (or paperSource) depending upon the height 'band' your script returns.

 

Anyone got a different / better idea?

 

Jerry

.

Post Edited 07 March 2016

Profile Image 3 Posts 3 Karma
Chathushka99 posted this 16 March 2016

Hi jerry
how would i set a custom paper size? lets say i want the paper to be 20cm wide and 9cm high
thank you in advance

Post Edited 16 March 2016

Profile Image 189 Posts 189 Karma
Jerry posted this 16 March 2016

Well, you can set your own custom size, but I don't think ScriptX will take any notice of it.

 

Check around 'Printer Control' as sampled here:

 

http://scriptxsamples.meadroid.com/Licensed/printControl/Release/DOCTYPE

 

 http://scriptx.meadroid.com/knowledge-bank/technical-reference/printercontrol-factoryprintingprintercontrol.aspx

 

Jerry

Post Edited 16 March 2016

Profile Image 3 Posts 3 Karma
Chathushka99 posted this 04 April 2016

Hi Jerry,
Thank you for the advice. Later i found out  my requirement is called "raw data printing". It could be achieved by Win32 spooler functions. raw data printing is provided by scriptx as a paid feature. it's easy to create and can be deployed as an object. If anybody is interested all you have to do is call to Win32 spooler functions either C#/C++/VB then create object then create .CAB file. it is what happend in Scriptx too. google for much better instructions. most importantly you must enable activeX in IE 11. Hope this was helpful.

Profile Image 189 Posts 189 Karma
Jerry posted this 04 April 2016

Hi

 

I'm glad you worked out how to achieve what you wanted.

 

Jerry