Board index » delphi » Problem printer on 600dpi laser printer

Problem printer on 600dpi laser printer

When I set my Lexmark laser printer to 300dpi it works fine.  The font
appears to be the Times Roman 10 point font I have picked from the Font
Dialog.  When I set the printer for 600dpi the font get really small.  Can
anyone help!!!

Thanks in advance.

 

Re:Problem printer on 600dpi laser printer


In article <4g3uhm$...@newsbf02.news.aol.com>, ttsanga...@aol.com
says...

Quote

>When I set my Lexmark laser printer to 300dpi it works fine.  The font
>appears to be the Times Roman 10 point font I have picked from the Font
>Dialog.  When I set the printer for 600dpi the font get really small.  
Can
>anyone help!!!

>Thanks in advance.

Put the following line into your code :

  printer.canvas.font.pixelsperinch := <put your printer's DPI here>;

I haven't found a way to get the DPI info out of the printerdriver,
so you'll have to do this manually (perhaps anyone can help ?)

good luck,

JMS

Re:Problem printer on 600dpi laser printer


Quote
>I haven't found a way to get the DPI info out of the printerdriver,
>so you'll have to do this manually (perhaps anyone can help ?)

   PixelsPerInchX := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
   PixelsPerInchY := GetDeviceCaps(Printer.Handle, LOGPIXELSY);

The Help for printer.canvas.font.pixelsperinch advises that it is not
modfied. The Help suggests using Font.Size and Font.Height.

I have a similar problem to the original questioner.  Sometimes I find 12
pt looks very small and I need to select 36 point to get a reasonable
font size.

I'll take a look at printer.canvas.font.pixelsperinch when this problem
occurs.

John.

Re:Problem printer on 600dpi laser printer


In article <DnA16t....@cix.compulink.co.uk>,

Quote
jatk...@cix.compulink.co.uk ("john atkins") wrote:
>The Help for printer.canvas.font.pixelsperinch advises that it is not
>modfied. The Help suggests using Font.Size and Font.Height.

Font.Size calculates Font.Height using the PixelsPerInch property.

i.e.: Font.Height is the font's height in pixels.

--
=\
 *=- R.Moberg, CD-Player Pro info @ http://www.sn.no/~mobergru/
=/

Re:Problem printer on 600dpi laser printer


Quote
jatk...@cix.compulink.co.uk ("john atkins") wrote:
>>I haven't found a way to get the DPI info out of the printerdriver,
>>so you'll have to do this manually (perhaps anyone can help ?)

>   PixelsPerInchX := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
>   PixelsPerInchY := GetDeviceCaps(Printer.Handle, LOGPIXELSY);

>The Help for printer.canvas.font.pixelsperinch advises that it is not
>modfied. The Help suggests using Font.Size and Font.Height.

>I have a similar problem to the original questioner.  Sometimes I find 12
>pt looks very small and I need to select 36 point to get a reasonable
>font size.

>I'll take a look at printer.canvas.font.pixelsperinch when this problem
>occurs.

The code I used in a program that generated different forms to the
printer was:

    X_Res:= GetDeviceCaps(Printer.Handle,LOGPIXELSX);
    Y_Res:= GetDeviceCaps(Printer.Handle,LOGPIXELSY);

Printer.Canvas.Font.PixelsPerInch:=GetDeviceCaps(Printer.Handle,LOGPIXELSY);

and then after this called Printer.BeginDoc.

--
Sean R. Malloy               | American Non Sequitur
    Naval Medical Center     |       Society
    San Diego, CA 92134-5000 |
mal...@cris.com              | "We may not make sense,
srmal...@snd10.med.navy.mil  |  but we do like pizza"

Re:Problem printer on 600dpi laser printer


Quote
mal...@cris.com (Sean Malloy) wrote:
>jatk...@cix.compulink.co.uk ("john atkins") wrote:
>>>I haven't found a way to get the DPI info out of the printerdriver,
>>>so you'll have to do this manually (perhaps anyone can help ?)

>>   PixelsPerInchX := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
>>   PixelsPerInchY := GetDeviceCaps(Printer.Handle, LOGPIXELSY);

>>The Help for printer.canvas.font.pixelsperinch advises that it is not
>>modfied. The Help suggests using Font.Size and Font.Height.

>>I have a similar problem to the original questioner.  Sometimes I find 12
>>pt looks very small and I need to select 36 point to get a reasonable
>>font size.

>>I'll take a look at printer.canvas.font.pixelsperinch when this problem
>>occurs.
>The code I used in a program that generated different forms to the
>printer was:
>    X_Res:= GetDeviceCaps(Printer.Handle,LOGPIXELSX);
>    Y_Res:= GetDeviceCaps(Printer.Handle,LOGPIXELSY);
>Printer.Canvas.Font.PixelsPerInch:=GetDeviceCaps(Printer.Handle,LOGPIXELSY);
>and then after this called Printer.BeginDoc.
>--
>Sean R. Malloy               | American Non Sequitur
>    Naval Medical Center     |       Society
>    San Diego, CA 92134-5000 |
>mal...@cris.com              | "We may not make sense,
>srmal...@snd10.med.navy.mil  |  but we do like pizza"

A better solution I think is to do the following _after_
selecting/loading the Printer.Canvas.Font. (My thanks to Javier Acuna
for this fix.)

Font.Height := Round(Font.Height *
GetDeviceCaps(Printer.Handle,LOGPIXELSY) / Font.PixelsPerInch);

I don't think setting the PixelsPerInch property does anything.
ReadOnly?

Bruce Houlihan
exnih...@interramp.com

Re:Problem printer on 600dpi laser printer


In article <4hptt9$...@usenet4.interramp.com>,

Quote
exnih...@interramp.com (Bruce) wrote:
>Font.Height := Round(Font.Height *
>GetDeviceCaps(Printer.Handle,LOGPIXELSY) / Font.PixelsPerInch);

Look in the helpfile (for font.height), I think it would better
to replace "Font.PixelsPerInch" with 72 in the above formula.

Size is represented in Points (there are 72 points in an inch)...
(and we don't really wanna depend on Font.PPI having the
*wrong* value in future versions of Delphi, now do we?)

--
=\
 *=- R.Moberg, CD-Player Pro info @ http://www.sn.no/~mobergru/
=/

Other Threads