Print preview problem

Print preview problem

Post by Jarno Tyyne » Fri, 05 Oct 2001 20:34:24

I have run into weird problem with print preview with certain printer.

I have tested this with NT 4 (sp6) and Win95 with few different
printer drivers each. It works OK in all cases except in Win95 with HP
Deskjet 930 series printer driver.

Here is simplified code for what I'm doing

// ptrName is valid printer name

For Win95:

For NT:

if(bPreview) {

Quote:} else {

// Font is already created in this point, so hFont is valid.
// Purpose here is to get height of line

Everything works fine until GetTextExtentPoint32. First it caused
protection fault in printer driver. I updated driver and it doesn't
crash anymore, but values returned in size-structure are insane: = 0  , and = 32767

I have tried using DrawText with DT_CALCRECT instead of
GetTextExtent.... and it returns correct height, but width is still 0
and I need this information elsewhere.

When printing directly (without preview) to printer everything is

Is there bug in printer driver or am I doing something wrong ?

tv. Jarno Tyynel?

"Nothing is as certain as uncertain"


1. Rich Edit Control Printing Problem (like the print preview problem)

I've been using the Windows Rich Edit Control to add RTF to some software.
Problem is that when  I print out, what happens is that the text on the
can be 'clipped'. I know there is a known problem with print preview with
the RichEdit (problem has been around for a while but 'mysteriously' wasnt
for windows 98) - and this is like a less dramatic version of the same
Basically I use the same RichEdit to draw to different areas of the same
by repeatedly loading it with data then FormatRange - ing it to the screen /

I can't see how its a 'clip rect' thats doing if - what I mean is say I have
a control
.. *every* line (not just the longest one) can be 'unfinished' - bits or
even full
letters can be missing.

Its strange cos sometimes it prints fine, then a subtle change somewhere
can cause the problem to appear just in certain places.
Any suggestions? I've searched the newsgroups for a solution and I couldn't
see it - although the search gave the impression the RichEdit is .. erm ..
not quite as bulletproof and robust as it could be..:)
(I've printed from Windows95 and Windows98 to an HP4000TN, the rich edit is
wrapped using an MFC CRichEditCtrl, compiled using MSVC++ 6)
Thanks in advance,

2. Q : How to use winmm.lib for audio capture ?

3. Printing / Print Preview problems

4. Too many dang development platforms to work with!

5. Print and print preview problem (ASSERT error when allocating GDI font resource in OnBeginPrinting)

6. FTP from unix not working

7. Print Preview Problems.

8. Q: Print preview problem

9. Print(Preview) problem

10. ? MFC : print preview problems ?

11. Automated RTF printing & non-editable print preview