Help with printing

Help with printing

Post by Rick Prin » Thu, 13 Oct 1994 18:02:32



I'm trying to build a print function with Borland C/C++ 4.0
I have code example to automatically scan the win.ini file
and use the 'default' printer, however I want to be able to
build a 'standard' form on disk. For example, I want to be
able to say that the 'standard' form is 78 char wide x 60
lines long. So that no matter what printer (dot matrix,
hp-laser, etc.) the user has, that the form (file on disk) is
passed to the printer to be printed, it will always print
78 char's X 60 lines. Is there a way to force something
like this, say using the ANSI_FIXED_FONT? I'm finding that
on a hp laser 4 that I'm getting 78 char's x 48 lines
(filling the page) and then on an old ibm dot matrix
printer I get 78 chars X 53 lines. Is this possible without
having to know what type printer a user might have to print
the same information per page (78 char's X 60 lines) no
matter what printer they may be using? Any idea's with
a 'c' code (not 'c++') example out there?

Thanks in advance

Rick Prince

 
 
 

Help with printing

Post by John Gra » Fri, 14 Oct 1994 08:34:52



>I'm trying to build a print function with Borland C/C++ 4.0
>I have code example to automatically scan the win.ini file
>and use the 'default' printer, however I want to be able to

        A better way is to use the PrintDlg() COMMDLG function
        with PD_RETURNDEFAULT.  This gets you info/hdc for
        the default printer (non-interactively).

Quote:>build a 'standard' form on disk. For example, I want to be
>able to say that the 'standard' form is 78 char wide x 60
>lines long. So that no matter what printer (dot matrix,
>hp-laser, etc.) the user has, that the form (file on disk) is
>passed to the printer to be printed, it will always print
>78 char's X 60 lines. Is there a way to force something
>like this, say using the ANSI_FIXED_FONT? I'm finding that
>on a hp laser 4 that I'm getting 78 char's x 48 lines
>(filling the page) and then on an old ibm dot matrix
>printer I get 78 chars X 53 lines. Is this possible without
>having to know what type printer a user might have to print
>the same information per page (78 char's X 60 lines) no
>matter what printer they may be using? Any idea's with
>a 'c' code (not 'c++') example out there?

        Read up a bit more on fonts.  If you specify a font in
        'points', then you use GetDeviceCaps(..) to retrieve
        information to scale your 'points' to device co-ordinates,
        this allows you to print the same sizem regardless of
        device resolution.

        Now that you've got your character height the same for all
        devices, it's simply a matter of fitting it all in to
        the available paper size.  You're probably doing that, but
        the varying character height is messing up your calculations.

        You will also have to deal with the fact that each printer
        has different hardware margins, so even if you use the same
        size paper, you may not be able to fit the same no. of lines
        on different printers.

        BTW, lose the \r in your posts - they clutter the screen.
--

Airborne Geophysics
Geological Survey of Canada, Ottawa