1. Educate me on Printing

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?

new topic     » topic index » view message » categorize

2. Re: Educate me on Printing

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Educate me on Printing

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.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Educate me on Printing

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: Educate me on Printing

OK, I'll play with the stuff you suggest. Thanks for taking the time.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Educate me on Printing

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

new topic     » goto parent     » topic index » view message » categorize

7. Re: Educate me on Printing

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

new topic     » goto parent     » topic index » view message » categorize

8. Re: Educate me on Printing

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

new topic     » goto parent     » topic index » view message » categorize

9. Re: Educate me on Printing

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

new topic     » goto parent     » topic index » view message » categorize

10. Re: Educate me on Printing

Thanks Andy, I've downloaded it and will take a look at it.

new topic     » goto parent     » topic index » view message » categorize

11. Re: Educate me on Printing

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.

new topic     » goto parent     » topic index » view message » categorize

12. Re: Educate me on Printing

Thanks Derek. That apparently is exactly my problem. I'll look into using
getPrinterCaps.

new topic     » goto parent     » topic index » view message » categorize

13. Re: Educate me on Printing

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

new topic     » goto parent     » topic index » view message » categorize

14. Re: Educate me on Printing

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.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu