1. Educate me on Printing
- Posted by George Walters <gwalters at ?c?rr.com> Oct 17, 2007
- 547 views
I thought I new how to print in windows using Win32 but apparently I don't know...or I'm missing the point all together. I've been using this fontSize = getFontSize( Printer ) -- get the font metrics and spacing down the page like this line += 1 setPosition(Printer,0,line*fontSize[2]) wPuts(Printer,"stuff") where line is the line number down the page The problem is I get different spacing from printer to printer as you go down. the page. The laser does one thing and the inkjet is different. So I can't fill in forms consistently (like labels for addresses etc) Can someone explain how to make a printer output the same from one to the other?
2. Re: Educate me on Printing
- Posted by Bernie Ryan <xotron at ?luefro?.com> Oct 17, 2007
- 535 views
George Walters wrote: > > > I thought I new how to print in windows using Win32 but apparently I don't > know...or I'm missing the point all together. > > I've been using this > > fontSize = getFontSize( Printer ) -- get the font metrics > > and spacing down the page like this > > line += 1 > setPosition(Printer,0,line*fontSize[2]) > wPuts(Printer,"stuff") > > where line is the line number down the page > > The problem is I get different spacing from printer to printer as you go down. > the page. The laser does one thing and the inkjet is different. So I can't > fill > in forms consistently (like labels for addresses etc) > > Can someone explain how to make a printer output the same from one to the > other? Use PCL code. Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
3. Re: Educate me on Printing
- Posted by George Walters <gwalters at sc.??.com> Oct 17, 2007
- 530 views
Bernie, what is wrong with the code I showed? I'd like to understand what is going on.... why do I need to use PCL code... some printers don't understand PCL code and I would like my code to be printer independent.
4. Re: Educate me on Printing
- Posted by Bernie Ryan <xotron at blue??og.com> Oct 17, 2007
- 521 views
George Walters wrote: > > Bernie, what is wrong with the code I showed? I'd like to understand what > is going on.... why do I need to use PCL code... some printers don't > understand > PCL code and I would like my code to be printer independent. George: There is nothing wrong with your code. Your original printer had a line distance spacing that just worked out without changing printer settings. The problem is because all impact printers had a fixed mechanical distance between lines and inside they had switches that the user could set to change this distance between lines but it require opening the printer's case to change theses settings. So manufactures decided to make the printers programmable with escape sequences so the customer didn't need to open the printers case to change settings. HP came out with a PRINTER CONTROL LANGAUGE ( PCL ) and allot of manufactures decided to have something similar to it. If a printer does not support PCL they will still have someway of printer control codes. The codes for specific printers can be found your customer's manual. You can find the codes for most printers out on the WEB. HERE is something you can do to try using the laser printer. NOTE: you have to send the sequence to tell the printer how change settings but I don't remember if you have to use puts or print or wputs you will have to experiment.
constant -- LINES PER INCH SEQUENCES lns_per_inch_2 = {#027,#038,#108,#050,#068}, lns_per_inch_3 = {#027,#038,#108,#050,#068}, lns_per_inch_4 = {#027,#038,#108,#052,#068}, lns_per_inch_6 = {#027,#038,#108,#054,#068}, lns_per_inch_8 = {#027,#038,#108,#056,#068}, lns_per_inch_12 = {#027,#038,#108,#049,#050,#088}, lns_per_inch_16 = {#027,#038,#108,#049,#050,#088}, lns_per_inch_24 = {#027,#038,#108,#050,#052,#088}, lns_per_inch_48 = {#027,#038,#108,#052,#056,#088}, -- Setup laser printer's LINES PER INCH by measuring labels. -- and then print your labels. -- this sequence sets a one inch label to have 8 lines -- or a two inch label to 16 lines. -- Send this command once then print a label. print(printer,lns_per_inch_8) -- Then print label.
Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
5. Re: Educate me on Printing
- Posted by George Walters <gwalters at sc.rr?c?m> Oct 17, 2007
- 540 views
OK, I'll play with the stuff you suggest. Thanks for taking the time.
6. Re: Educate me on Printing
- Posted by Matt Lewis <matthewwalkerlewis at gmail.c??> Oct 17, 2007
- 528 views
- Last edited Oct 18, 2007
George Walters wrote: > > The problem is I get different spacing from printer to printer as you go down. > the page. The laser does one thing and the inkjet is different. So I can't > fill > in forms consistently (like labels for addresses etc) > > Can someone explain how to make a printer output the same from one to the > other? Here are a couple of links that might help: http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnargdi/html/msdn_mapping.asp http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnaraccessdev/html/ODC_MicrosoftOfficeDeveloperForumControllingYourPrinterinMicrosoftAccess.asp I suspect that you have some kind of DPI/scaling difference between the different printers. I don't know enough about printing to say much more than that, though. Matt
7. Re: Educate me on Printing
- Posted by Derek Parnell <ddparnell at ?igpond.?om> Oct 17, 2007
- 549 views
- Last edited Oct 18, 2007
George Walters wrote: > > > I thought I new how to print in windows using Win32 but apparently I don't > know...or I'm missing the point all together. > > I've been using this > > fontSize = getFontSize( Printer ) -- get the font metrics > > and spacing down the page like this > > line += 1 > setPosition(Printer,0,line*fontSize[2]) > wPuts(Printer,"stuff") > > where line is the line number down the page > > The problem is I get different spacing from printer to printer as you go down. > the page. The laser does one thing and the inkjet is different. So I can't > fill > in forms consistently (like labels for addresses etc) > > Can someone explain how to make a printer output the same from one to the > other? The problem with the code above is that you are using pixels as the unit of measure rather than inches or millimeters. The problem with pixels is that each device uses a different size for a pixel. As things like labels are measured in inches/mm you need to convert the distance between labels from inches/mm to pixels for the specific device you are printing to. I suggest that you research the GetDeviceCaps API call as this will give you the required data to perform the conversion calculations. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
8. Re: Educate me on Printing
- Posted by don cole <doncole at pac?ell.ne?> Oct 18, 2007
- 518 views
George Walters wrote: > > > I thought I new how to print in windows using Win32 but apparently I don't > know...or I'm missing the point all together. > > I've been using this > > fontSize = getFontSize( Printer ) -- get the font metrics > > and spacing down the page like this > > line += 1 > setPosition(Printer,0,line*fontSize[2]) > wPuts(Printer,"stuff") > > where line is the line number down the page > > The problem is I get different spacing from printer to printer as you go down. > the page. The laser does one thing and the inkjet is different. So I can't > fill > in forms consistently (like labels for addresses etc) > > Can someone explain how to make a printer output the same from one to the > other? Hello George, I sent you two Avery label programs. And I never heard from you. Did you test them? If you did then you see that each has two columns. Computer Generated and Tweak. You can change the tweak of: top label space between labels, left liable spaces between,etc... Because when all is said and done things don't always work perfect. Printers (pressmen) call it registration. Once the tweak is set you don't have to change it again. Of course if you change printers then you might have to re-tweak. Don Cole
9. Re: Educate me on Printing
- Posted by Andy Drummond <andy at kest?eltele.?om> Oct 18, 2007
- 534 views
George Walters wrote: > > > I thought I new how to print in windows using Win32 but apparently I don't > know...or I'm missing the point all together. > > I've been using this > > fontSize = getFontSize( Printer ) -- get the font metrics > > and spacing down the page like this > > line += 1 > setPosition(Printer,0,line*fontSize[2]) > wPuts(Printer,"stuff") > > where line is the line number down the page > > The problem is I get different spacing from printer to printer as you go down. > the page. The laser does one thing and the inkjet is different. So I can't > fill > in forms consistently (like labels for addresses etc) > > Can someone explain how to make a printer output the same from one to the > other? George, I used to find printing a real pain. If you look at the archive you will find a library called grprint.ew which I produced to get around this. You specify locations of printing in inches or millimetres as you prefer, and it takes care of printer characteristics. You can print lines and text at various angles etc etc - download it and you will see. It includes a demo routine at the end so you can see how to drive it. I think this will meet your needs... Andy Drummond
10. Re: Educate me on Printing
- Posted by George Walters <gwalters at sc.rr.??m> Oct 18, 2007
- 527 views
Thanks Andy, I've downloaded it and will take a look at it.
11. Re: Educate me on Printing
- Posted by George Walters <gwalters at sc.r?.?om> Oct 18, 2007
- 527 views
Thanks Don. I did get your email and I did reply, but perhaps it got filtered out along the way. I've been reading it and trying to figure out your code.
12. Re: Educate me on Printing
- Posted by George Walters <gwalters at sc?rr.?om> Oct 18, 2007
- 551 views
Thanks Derek. That apparently is exactly my problem. I'll look into using getPrinterCaps.
13. Re: Educate me on Printing
- Posted by don cole <doncole at pa?bell.?et> Oct 19, 2007
- 544 views
George Walters wrote: > > Thanks Don. I did get your email and I did reply, but perhaps it got filtered > out along the way. I've been reading it and trying to figure out your code. Hello George, As Matt, Derek and others have mentioned it is very difficult to calculate pixels, inches, millimeters to labels and different printers. That's why I tweak to final settings. It uses a print preview so you can tweak without wasting labels. I'm using #05467 Avery Labels. Which are dots 4 columns buy 6 rows. I don't know what labels your are using but the routine draw_circles() draws the outline of the labels. You have to change this to draw your labels. I never saw a reply from you. It could have been zapped. Don Cole Don Cole
14. Re: Educate me on Printing
- Posted by George Walters <gwalters at sc?r?.com> Oct 19, 2007
- 551 views
With your help and the help of others I've found and fixed the problem I was having...printing labels, checks, etc. I also now understand better what is going on. The basic problem was when windows API call returned the pixel count of the printer it was the pixel count of the printable area of the paper... not the 8-1/2 X 11 I thought. Making this scale change fixed my issue. And you are right there may still be some tweaking because not all printers feed the paper and start printing at the same point down the page. I'll look at your Avery label 05467. It might also be usefu.... Thanks for the help.