[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 480
  • Last Modified:

Suppressing page throw on issuing an EndDoc in VB6

Hi

I am writing a piece of ePos software which prints a receipt to an Epson TM-T60 thermal receipt printer.

There are no drivers available for it, so I am just using Generic / Text Only.

Problem is, when I finish printing the receipt, and send a "Printer.EndDoc" - it throws out a whole load of thermal paper from the printer as if it thinks it's an A4 page.

Any ideas how I can tell it to end printing, but not to spew out all that paper ?

Thanks

Matt
0
milkmon123
Asked:
milkmon123
1 Solution
 
SizeyCommented:
You can set the paper size like this:

Printer.PaperSize = vbPRPSUser
Printer.Height = X
Printer.Width = Y

Where X and Y are numbers indicating the size you require, measured in twips.

There are 567 twips to a centimetre, or 1440 to an inch; so to set the paper size to say 20cm * 10cm you could do this:

Printer.PaperSize = vbPRPSUser
Printer.Height = 20 * 567
Printer.Width = 10 * 567

Apparently some printers will ignore these values (or set them as close as they can within specific limits), and not give you an error message.

Unfortunately I do not have a printer suitable to test with, so you'll have to play around a bit to find out exactly where you should set this - but it should be at or near the start of the printing process.
0
 
rettiseertCommented:
Using Printer.PaperSize makes any difference?
0
 
milkmon123Author Commented:
Hi

Many thanks for the suggestion.

Just tried it...

It comes up with an error when I try to set this using Generic / Text Only.

Thanks anyway...

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
mjwillsCommented:
And the error was?
0
 
milkmon123Author Commented:
This...

    Printer.PaperSize = vbPRPSUser
    Printer.Height = 20 * 567
    Printer.Width = 10 * 567

Gives 'Run time error 380 - invalid property value' at the     Printer.PaperSize = vbPRPSUser line

When I remark this out, and try again...

    'Printer.PaperSize = vbPRPSUser
    Printer.Height = 20 * 567
    Printer.Width = 10 * 567

... I get "Run time error 482 - printer error" at the     Printer.Height = 20 * 567 line.

Hope this helps.

Many thanks

Matt
0
 
SizeyCommented:
I get similar errors, but after a few tests with different printers/drivers have managed to determine that it is due to the printer not accepting the sizes you specify.  It does seem to accept setting PaperSize to specific values (rather than User), but I presume that the paper size of your particular printer is not in the list of options, which can be seen here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vb98/html/vbpropapersize.asp

Apparently you dont need the .Papersize line, as setting the height/width has the same effect.  I would therefore recommend setting the Height/Width to a few different values (up to a maximum of the size of the paper) to see if that works.

If that doesnt work, try installing a similar driver from the same manufacturer (possibly the TM-T90), as this is likely to give much better results, even without setting the paper size.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now