Re: User Mode Printer Driver using GDI API functions
- From: "Zhivko Tabakov" <ztabakov@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 9 Nov 2005 05:29:27 +1000
"Vipin[MVP]" <Vipin@xxxxxxxxxx> wrote in message
news:Od$8YrE5FHA.3592@xxxxxxxxxxxxxxxxxxxxxxx
>I think it may be better to show the code. You can show the snippet and I
>...
Here are the all the modifications that I have done to msplot
(the essential part is SelectClipRgn and ExtTextOut calls in DrvTextOut, the
rest of the code is just to enable me to call these 2 APIs). If either is
omitted DrvTextOut is called correctly for all the text (same if dxes are
NULL).
In "TEXTOUT.C"
....
#include <windows.h>
....
//in the beginning of DrvTextOut()
int *dxes;
unsigned dxesIdx;
const wchar_t txt[] = L"Some text printed with some (40pt) character
spacing.";
//and after pPDev initialization "if (!(pPDev =...){...}" follows:
DBGP(("The DrvTextOut Entry (%d chars, first one is:%c)"
, pstro->cGlyphs, (NULL == pstro->pwszOrg ? ' ' :
(char)*(pstro->pwszOrg))));
dxes = (int*)malloc(pstro->cGlyphs * sizeof(int));
for(dxesIdx = 0; dxesIdx < pstro->cGlyphs; ++dxesIdx)
dxes[dxesIdx] = 40;
SelectClipRgn((HDC)pPDev->hMeta, NULL);
ExtTextOutW((HDC)pPDev->hMeta, 100, 100, 0, NULL, txt,
sizeof(txt)/sizeof(*txt) - 1, dxes);
free(dxes);
return TRUE;
....
In "ENABLE.C"
....
#include "windows.h"
....
//in the beginning of DrvEnableSurface() - create metafile
RECT someRect = {0, 0, 1000, 1000};
HDC hdC = CreateCompatibleDC(NULL);
HDC hdcMeta = CreateEnhMetaFileW(hdC, L"C:\\DelMe.emf", &someRect, NULL);
DeleteDC(hdC);
DBGP(("EnableSurface hMeta(%p)", hdcMeta));
pPDev->hMeta = (HANDLE)hdcMeta;
....
//in the beginning of DrvDisableSurface() - clean up to unlock the file.
HENHMETAFILE hF = CloseEnhMetaFile((HDC)pPDev->hMeta);
DeleteEnhMetaFile(hF);
DBGP(("DrvDisableSurface close hMeta(%p)", pPDev->hMeta));
....
Also in order this to compile the next member need to be added to the
declaration of PDEV in plotters.h:
HANDLE hMeta;
And in order to link Gdi32.lib must be added.
After building the driver (checked build), the problem can be easy
replicated (at least on my machine:) by using
print to file when printing text file from Notepad. The text should be more
then 15 lines and each line
should be about 30 characters. The installed driver should be able to print
text, the last one that I
used is HP DesignJet 250C (D/A1). At least this is the easiest way for me to
replicate it.
In order to check the output the DebugView can be used (I am not familiar
with MSPLOT output format in
order to check the actual output file).
Thank you for the interest.
.
- References:
- User Mode Printer Driver using GDI API functions
- From: Zhivko Tabakov
- Re: User Mode Printer Driver using GDI API functions
- From: Vipin[MVP]
- Re: User Mode Printer Driver using GDI API functions
- From: Zhivko Tabakov
- Re: User Mode Printer Driver using GDI API functions
- From: Vipin[MVP]
- User Mode Printer Driver using GDI API functions
- Prev by Date: GDI does not provide all GLYPH handles for big font size
- Next by Date: MIME/base64 messages
- Previous by thread: Re: User Mode Printer Driver using GDI API functions
- Next by thread: Re: User Mode Printer Driver using GDI API functions
- Index(es):