Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cut off printer page at certain height with Printer object

Status
Not open for further replies.

sm43

Programmer
Dec 1, 2002
155
US

When printing with the Printer Object - is there a way to cut-off the page at a certain height . for e.g, cut the page off at 3 inches?

Is there ANY way to do it, be it with or without the Printer object?


Saad
 
Have you tried setting the Printer.Height property? For example:
Code:
Printer.Height = (1440 * 3)
 

It's wierd. When I set the Printer.Height to something - it always has a value of 5440 .. It's not getting modified, which may be due to the printer driver .. What's happening is that I have a Custom mini printer that prints on a page that's about 2 inches wide. When I print from a VB program - the printing just keeps on going on & on .. and it never actually cuts the page. That's what I want to do - cut the page at like 3 or 4 or 5 inches - set it to anything desirable . Would the Printer.Height (even I get it to set) actually "cut" the page at that height, or would it simply end the printing at that point.




Also - If I'm printing a Rich Text Box using this:



Do
' Print the page by sending EM_FORMATRANGE message
NextCharPosition = SendMessage(RTF.hWnd, EM_FORMATRANGE, True, fr)
If NextCharPosition >= TextLength Then Exit Do 'If done then exit
fr.chrg.cpMin = NextCharPosition ' Starting position for next page
Printer.NewPage ' Move on to next page
Printer.Print Space(7) ' Re-initialize hDC
fr.hdc = Printer.hdc
fr.hdcTarget = Printer.hdc
Loop


How would I word-wrap it at a certain width?


Thanks.


Saad M
 
Regarding making the printer "cut" the page, the printer's documentation may have a section where control codes are explained in which you might find that a control code or escape sequence cuts the page. If so, you might try sending that value using the Printer.Print command just before the Printer.NewPage.

Regarding wrapping at a certain width, you can use the "rc" element of the FORMATRANGE structure to specify a rectangular region in twips for the output area.
 

It is the TG58 Custom Printer. It is for printing coupons. I can't find a cutoff code in the printer's documentation . I've looked thoroughly. I've also searched online.


Punchinello, yours might be the solution I need though.


Thanks.

Saad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top