New topic: 

Sending esc codes to a parallel printer

<http://forums.realsoftware.com/viewtopic.php?t=47105>

         Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic          Author  
Message        Josefo          Post subject: Sending esc codes to a parallel 
printerPosted: Wed Feb 27, 2013 5:24 pm                         
Joined: Wed Feb 27, 2013 4:57 pm
Posts: 3                Dear all:

I'm writing a program in Real Studio 2011 r4 (Win XP SP3) using a POS printer, 
an Epson TM-U220PB dot-matrix printer and I'm already printing on it via the 
g.drawstring (characters look very big but it´s working).

Now I need to send ESC CODES to change font and in general to have more control 
about the format of my printing. The problem is that I can't find anywhere an 
example of sending esc codes (epos) to a parallel printer from Real Studio! An 
example would be very appreciated.

I don’t need anything complicated; even direct printing would be great but 
need a way to send the codes to change the font/size.

I already used the PageSetupDIalog dialog to setup the printer; it works 
excellent with almost all of the parameters bot not with the font/font's size 
selection. When trying to configure the printer from window’s control panel 
it let me choose any font from the printer and even print a test page with it 
but it warns me saying that choosing fonts or changing the font size must be 
done from inside my application, not from the control panel, and it only could 
be done sending esc codes.

Please help me !   
                             Top                timhare          Post subject: 
Re: Sending esc codes to a parallel printerPosted: Wed Feb 27, 2013 7:47 pm     
                    
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12088
Location: Portland, OR  USA                A) You don't need to send escape 
codes, just change g.TextSize and/or g.Bold.  The windows driver will do the 
right thing.

B) If you want to print direct, you can declare into winspooldrv.dll.   
                             Top                Josefo          Post subject: 
Re: Sending esc codes to a parallel printerPosted: Wed Feb 27, 2013 8:26 pm     
                    
Joined: Wed Feb 27, 2013 4:57 pm
Posts: 3                Timhare, thanks a lot for your suggestion.

Sincerely I don't have any idea about how to deal with "winspooldrv.dll",  but 
first I'll try your g.TextSize idea because I don't really want to change the 
font, just the size. Actually when I print something from my aplication to the 
printer it uses a font size by default that allows me to print just ... let say 
about 20 characters long by line, but I need to fit 40 characters in an line 
and I know the printer is perfectly capable of doing that because I saw it when 
working with the old software that I'm replacing (developed by someone else in 
FoxPro I must say).

I don't have the printer with me right now but tomorrow's first thing in the 
morning I´ll try. I think that will do it.

Just another thing, do you know how to send a tab? I'm printing a 3 column 
listbox and I would like to keep that format, the first column is "Quantity", 
the second "Article" and the third is "Price", it's a restaurant ticket.

Thanks again !   
                             Top                timhare          Post subject: 
Re: Sending esc codes to a parallel printerPosted: Thu Feb 28, 2013 12:48 am    
                     
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12088
Location: Portland, OR  USA                In RB, everything is graphics.  
Basically pixels.  You specifiy the X and Y coordinates of everything.  
Everything with the same Y coordinate is on a line.  Assuming the default 72 
dots/inch, if you want 6 lines/inch, you would print a line and then add 12 
(72/6) to the Y coordinate for the next line.  To line text up on a "tab stop", 
use the same X coordinate for the data that goes in that column.

For example

Y = 12
X = 0
g.DrawString quantity, X, Y
X = 72  // 1 inch
g.DrawString description, X, Y
X = 252  // 3.5 inch
g.DrawString price, X, Y

Y = Y + 12  // next line
X = 0
g.DrawString quantity2, X, Y
X = 72
g.DrawString description2, X, Y
X = 252
g.DrawString price2, X, Y

Y = Y + 12
//etc   
                             Top                Josefo          Post subject: 
Re: Sending esc codes to a parallel printerPosted: Thu Feb 28, 2013 4:56 pm     
                    
Joined: Wed Feb 27, 2013 4:57 pm
Posts: 3                Now I understand, I'm going to modify my program and I 
will do it this way. Thank you very much, really appreciated! Stay cool!   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to