Printer GDI driver can't print out bitmap using MS WORD and PAINT

Printer GDI driver can't print out bitmap using MS WORD and PAINT

Post by Zhengqi Ha » Fri, 21 Feb 2003 05:05:14



Hello All

My printer  only support 1BPP GDI managed monochrome
format.
On win2k platform, Our GDI driver using  
EngAssociateSurface(pdev->hsurf, (HDEV)pdev->hdev,
HOOK_COPYBITS|HOOK_STRETCHBLT|HOOK_BITBLT|HOOK_STRETCHBLTRO
P|HOOK_PLGBLT|HOOK_PAINT|HOOK_TRANSPARENTBLT);

and also implement these function by just call
EngCopyBits,EngStretchBlt,EngBitBlt,EngStretchBltRop,
EngPlgBlt,EngPaint,EngTransparentBlt to let GDI engine
work for us.

I have tested my driver and find sth as follow:

Using Imaging application in start->program->accessary-

Quote:>Imaging to print BW bitmap, It hooks into DrvCopyBits and

print out.
Using IE5 ,It hooks into BitBlt ,CopyBits, StretchBlt,
StretchBltRop and can print out something .(because I can
not find one webpage which has BW bitmap on it, So I am
not sure it has printed out BW bitmap in correct way).

Using start->program->accessary->paint , It did not hook
any GDI function ,nothing print out.

using MS WORD , It merely hooks drvEscape and only print
out text ,the bitmap object on the doc was printed out as
void.

in my code, the gdiinfo->ulVersion = 0x500;

Thanks in advance for any help

Hao

 
 
 

Printer GDI driver can't print out bitmap using MS WORD and PAINT

Post by Dan Negresc » Sat, 22 Feb 2003 22:32:14


Hao,

This group is about GDI programming but more on the application side (well, I think so)
then driver development side.

More appropriate ones could be:
microsoft.public.development.device.drivers
microsoft.public.win32.programmer.kernel
microsoft.public.ddk.win2000.printer.video
microsoft.public.ddk.win9x.printer.subsystems

Anyway, regarding your question, could you tell us what are the flags
and values that were used to set the GDIINFO and DEVINFO structures
(in the DrvEnablePDEV function).
You do create a default palette, do you ? You should create one using EngCreatePalette
and setting the return value into the hpalDefault member of the DEVINFO structure.

Also, the recommended way (see MSDN ) for hooking the DDI functions on Win2K
(and up) platforms is using EngModifySurface not EngAssociateSurface which shall be
used on WinNT 4 platforms.

Regards,
Dan.

Quote:> Hello All

> My printer  only support 1BPP GDI managed monochrome
> format.
> On win2k platform, Our GDI driver using
> EngAssociateSurface(pdev->hsurf, (HDEV)pdev->hdev,
> HOOK_COPYBITS|HOOK_STRETCHBLT|HOOK_BITBLT|HOOK_STRETCHBLTRO
> P|HOOK_PLGBLT|HOOK_PAINT|HOOK_TRANSPARENTBLT);

> and also implement these function by just call
> EngCopyBits,EngStretchBlt,EngBitBlt,EngStretchBltRop,
> EngPlgBlt,EngPaint,EngTransparentBlt to let GDI engine
> work for us.

> I have tested my driver and find sth as follow:

> Using Imaging application in start->program->accessary-
> >Imaging to print BW bitmap, It hooks into DrvCopyBits and
> print out.
> Using IE5 ,It hooks into BitBlt ,CopyBits, StretchBlt,
> StretchBltRop and can print out something .(because I can
> not find one webpage which has BW bitmap on it, So I am
> not sure it has printed out BW bitmap in correct way).

> Using start->program->accessary->paint , It did not hook
> any GDI function ,nothing print out.

> using MS WORD , It merely hooks drvEscape and only print
> out text ,the bitmap object on the doc was printed out as
> void.

> in my code, the gdiinfo->ulVersion = 0x500;

> Thanks in advance for any help

> Hao


 
 
 

Printer GDI driver can't print out bitmap using MS WORD and PAINT

Post by Zhengqi Ha » Wed, 26 Feb 2003 04:33:28


Thanks DAN

I have fixed this bug.
The problem is My printer only support monochrome mode,
So, We have to use code :
        DevColor[1] = RGB(255,255,255);
        DevColor[0] = RGB(0,0,0);
        cPens = 2;

        if (!(pDevInfo->hpalDefault =
                                EngCreatePalette
(PAL_INDEXED, cPens,DevColor, 0, 0, 0))) {

            return(FALSE);}

instead of using  RGB Palette.

and also in DevInfo structure Init,
We have to use it like :

 pDevInfo->flGraphicsCaps =  
GCAPS_OPAQUERECT|GCAPS_BEZIERS|GCAPS_GEOMETRICWIDE|

GCAPS_ALTERNATEFILL|GCAPS_WINDINGFILL|GCAPS_HALFTONE;

Thanks Dan , Your suggestion is correct.

but I still do not know how to use EngModifySurface
under GDI managed surface. here is my code .
I don't know how to set  6 and 7 Parameter
in EngModifySurface call ,
It always fail.

 pdev->hsurf = (HSURF)EngCreateBitmap(sizlDev,
BYTES_PER_LINE,BMF_1BPP, BMF_TOPDOWN, NULL);

EngModifySurface(pdev->hsurf, (HDEV)pdev->hdev,
                                HOOK_COPYBITS,          
                                NULL,                  
                                NULL,                  
                ((SURFOBJ*)(pdev->hsurf))->pvScan0,      
                ((SURFOBJ*)(pdev->hsurf))->lDelta,        
                                NULL                    

                         );

Quote:>-----Original Message-----
>Hao,

>This group is about GDI programming but more on the

application side (well, I think so)
Quote:>then driver development side.

>More appropriate ones could be:
>microsoft.public.development.device.drivers
>microsoft.public.win32.programmer.kernel
>microsoft.public.ddk.win2000.printer.video
>microsoft.public.ddk.win9x.printer.subsystems

>Anyway, regarding your question, could you tell us what
are the flags
>and values that were used to set the GDIINFO and DEVINFO
structures
>(in the DrvEnablePDEV function).
>You do create a default palette, do you ? You should

create one using EngCreatePalette
Quote:>and setting the return value into the hpalDefault member

of the DEVINFO structure.
Quote:

>Also, the recommended way (see MSDN ) for hooking the DDI
functions on Win2K
>(and up) platforms is using EngModifySurface not

EngAssociateSurface which shall be
Quote:>used on WinNT 4 platforms.

>Regards,
>Dan.

>> Hello All

>> My printer  only support 1BPP GDI managed monochrome
>> format.
>> On win2k platform, Our GDI driver using
>> EngAssociateSurface(pdev->hsurf, (HDEV)pdev->hdev,

HOOK_COPYBITS|HOOK_STRETCHBLT|HOOK_BITBLT|HOOK_STRETCHBLTRO
Quote:>> P|HOOK_PLGBLT|HOOK_PAINT|HOOK_TRANSPARENTBLT);

>> and also implement these function by just call
>> EngCopyBits,EngStretchBlt,EngBitBlt,EngStretchBltRop,
>> EngPlgBlt,EngPaint,EngTransparentBlt to let GDI engine
>> work for us.

>> I have tested my driver and find sth as follow:

>> Using Imaging application in start->program->accessary-
>> >Imaging to print BW bitmap, It hooks into DrvCopyBits
and
>> print out.
>> Using IE5 ,It hooks into BitBlt ,CopyBits, StretchBlt,
>> StretchBltRop and can print out something .(because I
can
>> not find one webpage which has BW bitmap on it, So I am
>> not sure it has printed out BW bitmap in correct way).

>> Using start->program->accessary->paint , It did not hook
>> any GDI function ,nothing print out.

>> using MS WORD , It merely hooks drvEscape and only print
>> out text ,the bitmap object on the doc was printed out
as
>> void.

>> in my code, the gdiinfo->ulVersion = 0x500;

>> Thanks in advance for any help

>> Hao

>.

 
 
 

Printer GDI driver can't print out bitmap using MS WORD and PAINT

Post by Dan Negresc » Wed, 26 Feb 2003 17:59:07


Hao,

EngModifySurface allows the driver to modify a *device-managed surface* and
inform GDI of this surface's attributes. Your code creates a *GDI-managed surface*
through the call to EngCreateBitmap, and IMO that could be the reason why
EngModifySurface fails.
You should create a *device-managed surface* by calling  EngCreateDeviceBitmap
or EngCreateDeviceSurface and pass the return value to the EngModifySurface function
(the *HSURF  hsurf* parameter).

Read this MSDN topic that explains how to prepare the surface:
http://msdn.microsoft.com/library/en-us/graphics/hh/graphics/ddifncs_...

Regards,
Dan.

Quote:> Thanks DAN

> I have fixed this bug.
> The problem is My printer only support monochrome mode,
> So, We have to use code :
> DevColor[1] = RGB(255,255,255);
> DevColor[0] = RGB(0,0,0);
> cPens = 2;

> if (!(pDevInfo->hpalDefault =
>                                 EngCreatePalette
> (PAL_INDEXED, cPens,DevColor, 0, 0, 0))) {

>             return(FALSE);}

> instead of using  RGB Palette.

> and also in DevInfo structure Init,
> We have to use it like :

>  pDevInfo->flGraphicsCaps =
> GCAPS_OPAQUERECT|GCAPS_BEZIERS|GCAPS_GEOMETRICWIDE|

> GCAPS_ALTERNATEFILL|GCAPS_WINDINGFILL|GCAPS_HALFTONE;

> Thanks Dan , Your suggestion is correct.

> but I still do not know how to use EngModifySurface
> under GDI managed surface. here is my code .
> I don't know how to set  6 and 7 Parameter
> in EngModifySurface call ,
> It always fail.

>  pdev->hsurf = (HSURF)EngCreateBitmap(sizlDev,
> BYTES_PER_LINE,BMF_1BPP, BMF_TOPDOWN, NULL);

> EngModifySurface(pdev->hsurf, (HDEV)pdev->hdev,
>                                 HOOK_COPYBITS,
> NULL,
>                 NULL,
> ((SURFOBJ*)(pdev->hsurf))->pvScan0,
> ((SURFOBJ*)(pdev->hsurf))->lDelta,
> NULL

> );

> >-----Original Message-----
> >Hao,

> >This group is about GDI programming but more on the
> application side (well, I think so)
> >then driver development side.

> >More appropriate ones could be:
> >microsoft.public.development.device.drivers
> >microsoft.public.win32.programmer.kernel
> >microsoft.public.ddk.win2000.printer.video
> >microsoft.public.ddk.win9x.printer.subsystems

> >Anyway, regarding your question, could you tell us what
> are the flags
> >and values that were used to set the GDIINFO and DEVINFO
> structures
> >(in the DrvEnablePDEV function).
> >You do create a default palette, do you ? You should
> create one using EngCreatePalette
> >and setting the return value into the hpalDefault member
> of the DEVINFO structure.

> >Also, the recommended way (see MSDN ) for hooking the DDI
> functions on Win2K
> >(and up) platforms is using EngModifySurface not
> EngAssociateSurface which shall be
> >used on WinNT 4 platforms.

> >Regards,
> >Dan.

> >> Hello All

> >> My printer  only support 1BPP GDI managed monochrome
> >> format.
> >> On win2k platform, Our GDI driver using
> >> EngAssociateSurface(pdev->hsurf, (HDEV)pdev->hdev,

> HOOK_COPYBITS|HOOK_STRETCHBLT|HOOK_BITBLT|HOOK_STRETCHBLTRO
> >> P|HOOK_PLGBLT|HOOK_PAINT|HOOK_TRANSPARENTBLT);

> >> and also implement these function by just call
> >> EngCopyBits,EngStretchBlt,EngBitBlt,EngStretchBltRop,
> >> EngPlgBlt,EngPaint,EngTransparentBlt to let GDI engine
> >> work for us.

> >> I have tested my driver and find sth as follow:

> >> Using Imaging application in start->program->accessary-
> >> >Imaging to print BW bitmap, It hooks into DrvCopyBits
> and
> >> print out.
> >> Using IE5 ,It hooks into BitBlt ,CopyBits, StretchBlt,
> >> StretchBltRop and can print out something .(because I
> can
> >> not find one webpage which has BW bitmap on it, So I am
> >> not sure it has printed out BW bitmap in correct way).

> >> Using start->program->accessary->paint , It did not hook
> >> any GDI function ,nothing print out.

> >> using MS WORD , It merely hooks drvEscape and only print
> >> out text ,the bitmap object on the doc was printed out
> as
> >> void.

> >> in my code, the gdiinfo->ulVersion = 0x500;

> >> Thanks in advance for any help

> >> Hao

> >.

 
 
 

1. Printing envelop using ms-word and HP Laser printer

I am trying to print envelop using ms-word 2.0 and HP laser printer,
but the address is not printed at the proper place.

Does anybody know how to print envelop under ms-word 2.0?
I was using manual feed. Manual feed is done from the middle
of the tray in HP laser printer. MS-Word 2.0 prints at the
begining of the tray. Doe it require some kind of setup?

I will appretiate your help. Thanks.

Munzer

2. Bus speed on CPU vs NIC speed.

3. Printer Pool - Print to multiple printers usings 1 print driver?

4. Canonical Domain Names Question

5. Q: printer driver, Word 97 and bitmaps

6. Missing faxes

7. GDI not rendering/halftoning bitmap in kernel-print-driver

8. uuencoder (decoder) wanted!

9. Question: Win2k Printer Driver Resolution Change induces odd result when Printing from WORD

10. no print out of bitmap with W98 using GDI

11. Accessing MS Word's print command inside a Visual C++ program

12. Using Unitool to modify a sample of a generic printer driver 'txtonly.dll'

13. printing bitmap to laser printer using TPW 7.0 (OWL)