Printing problem: user changes printer resolution , fonts chang

Printing problem: user changes printer resolution , fonts chang

Post by MJN.. » Fri, 26 Jul 1996 04:00:00



I have tried EVERYTHING I can think of and searched high and low for the answer.
The problem is that I have designed a print routine that prints beautifully at
300 dpi, but if user changes print resolution to 150dpi or 75dpi (haven't tried
at higher resolutions) windows substitutes a different font and the report is
almost unreadable. The text in question is printed with
Printer.Canvas.Textout(ect...) or Printer.Canvas.TextRect(ect...) for column
aligned output. Even DrawText(ect...) windows API function does the same thing
although the documentation claims the font will _not_ be changed. It appears
the font is printing to large also, and I've tryed setting the font.size
smaller to account for the resolution change but the font is still substituted.
Using Delphi 1 on Win95. Anyone have a clue?

GetDeviceCaps(ect...) returns the printer capability-does anyone know how to
set resolution to 300dpi, if printer is capable, and override a user's setup?

Eternally grateful for any help...
Miles

 
 
 

Printing problem: user changes printer resolution , fonts chang

Post by Jasper St » Fri, 26 Jul 1996 04:00:00



> I have tried EVERYTHING I can think of and searched high and low for the answer.
> The problem is that I have designed a print routine that prints beautifully at
> 300 dpi, but if user changes print resolution to 150dpi or 75dpi (haven't tried
> at higher resolutions) windows substitutes a different font and the report is
> almost unreadable. The text in question is printed with
> Printer.Canvas.Textout(ect...) or Printer.Canvas.TextRect(ect...) for column
> aligned output. Even DrawText(ect...) windows API function does the same thing
> although the documentation claims the font will _not_ be changed. It appears
> the font is printing to large also, and I've tryed setting the font.size
> smaller to account for the resolution change but the font is still substituted.
> Using Delphi 1 on Win95. Anyone have a clue?

> GetDeviceCaps(ect...) returns the printer capability-does anyone know how to
> set resolution to 300dpi, if printer is capable, and override a user's setup?

This will be an issue for me too, very soon, so I already made some
search on that. Following refrences are in my Win32 online-help, so I
suppose you just need a hint in the right direction. At a very low
level, I found that we should be able to change dmPrintQuality in the
DEVMODE structure pointed to by the PRINTER_INFO_2 structure which we
will get when using GetPrinter and send back with SetPrinter.

As you are further than I am, I didn't test that out yet, but I'd love
some feedback if it works...

Good luck!

 
 
 

Printing problem: user changes printer resolution , fonts chang

Post by William Rouc » Tue, 30 Jul 1996 04:00:00


Quote:> I have tried EVERYTHING I can think of and searched high and low for the answer.
> The problem is that I have designed a print routine that prints beautifully at
> 300 dpi, but if user changes print resolution to 150dpi or 75dpi (haven't tried
> at higher resolutions) windows substitutes a different font and the report is
> almost unreadable. The text in question is printed with
> Printer.Canvas.Textout(ect...) or Printer.Canvas.TextRect(ect...) for column
 <SNIP>
> GetDeviceCaps(ect...) returns the printer capability-does anyone know how to
> set resolution to 300dpi, if printer is capable, and override a user's setup?

I had this problem as well.  Some users were going to print reports to a
networked dot-matrix printer (~150dpi), and others would be printing to
300dpi and 600dpi lasers.  The way I got around the problem was to
create a routine that determined the target printer resolution before
the print job was sent.  Based on that, I determined a DPI "factor" that
I use throughout the job.  If they decide to switch printers from one
report to the other, I wanted to be covered instead of assuming they
would use the same printer for each program run.  Here is my sample
code:

var
   PrinterLine,
   PrinterMargin,
   PrinterLineAdvance,
   VertPixelsPerInch,
   HorzPixelsPerInch,
   PrinterTotalWidth,
   PrinterTab : integer;

 {find printer DPI and adjust printout sizes}
     VertPixelsPerInch := GetDeviceCaps(Printer.Handle, LogPixelsY);
     HorzPixelsPerInch := GetDeviceCaps(Printer.Handle, LogPixelsX);
     PrinterMargin := round(HorzPixelsPerInch * 0.5);    {Half-inch
margin
        based on printer driver}
     PrinterLineAdvance := round(VertPixelsPerInch / 6);  {Four lines
per inch}
     PrinterTotalWidth  := round(7.2 * HorzPixelsPerInch); {width of
page in pixels}
     PrinterTab := round(HorzPixelsPerInch / 4);  {quarter-inch tabs}

This code allows you to use Print.Canvas.TextOut with a margin value
(PrinterMargin), as well as a "Tab" value for printing columned text
(without using Reportsmith!).  Contact me if you have further
questions...

Bill

 
 
 

1. Changing Printer Font when Printing txt files

I'm converting a FPD program that has a routine to print ASCII .txt files to
a printer in two modes:

  "normal" - portrait mode, 80 columns wide
  "compressed" portrait mode,132 columns in a reduced font.

The code used in the DOS program to change the font to "compressed" mode -
(HP LJ printer) was:

 SET PRINT ON
 SET CONSOLE OFF
 ?? CHR(27)+CHR(69)+CHR(27)+"(s0p16.66H"
 SET PRINT OFF
 SET CONSOLE ON
 RUN COPY &MFILE LPT1:
 EJECT

This works fine in FPD2.6

This doesn't work  in VFP5.0a - the font does not change to "compressed
mode".

Does anyone have any suggestions on a way to change the font
(programmatically) when printing ASCII .txt files?

Thanks...

2. calling DOScommand from sprocedures

3. [4.5] Printer/Font Manager Error when changing printers

4. paragraph returns in web publishing

5. Change printed font, and font size

6. BEWARE: OnUpdateRecord Event - Heinous Feature

7. Print a image at printer resolution

8. post to start the pump

9. Printing Problems - Font change and missing data?

10. How to Print in Native Printer Fonts.

11. Changing Font Color Also Changes Font?

12. font and size with printer.print VB4

13. Printer/font manager combination invalid. Printing disabled