Hello Ashwin,
I used the sample rendering plug-in provided by ddk. i followed the steps to create a bitmap with the data. The bitmap file is created but without any data. My ImageProcessing function is called only once for any file size that i give for printing. My ImageProcessing function looks like this. Can you comment if i need to change anything.
HRESULT __stdcall IOemUni::ImageProcessing(
PDEVOBJ pdevobj,
PBYTE pSrcBitmap,
PBITMAPINFOHEADER pBitmapInfoHeader,
PBYTE pColorTable,
DWORD dwCallbackID,
PIPPARAMS pIPParams,
OUT PBYTE *ppbResult)
{
RECT Rect;
Rect.left =Rect.top =0;
Rect.bottom = 600;
Rect.right = 800;
HDC compDC = CreateCompatibleDC(NULL);
RECT RectRes;
RectRes.left =RectRes.top =0;
RectRes.bottom= (GetDeviceCaps(compDC , LOGPIXELSY) *
Rect.bottom * 10 )/(254);
RectRes.right = (GetDeviceCaps(compDC, LOGPIXELSX) *
Rect.right * 10) /254;
BITMAPINFO bmi;
BITMAPINFOHEADER *bmih = (BITMAPINFOHEADER *)&bmi;
LPBYTE pBits;
bmih->biSize = sizeof (BITMAPINFOHEADER) ;
bmih->biWidth = RectRes.right;
bmih->biHeight = RectRes.bottom;
bmih->biPlanes = 1 ;
bmih->biBitCount = 24 ;
bmih->biCompression = BI_RGB ;
bmih->biSizeImage = (((RectRes.right * 24 + 31) & ~31)/8)
* RectRes.bottom ;
bmih->biXPelsPerMeter = 0 ;
bmih->biYPelsPerMeter = 0 ;
bmih->biClrUsed = 0 ;
bmih->biClrImportant = 0 ;
HBITMAP hbm = CreateDIBSection (compDC, (BITMAPINFO *) &bmi, 0, (void **)&pBits, NULL, 0) ;
SelectObject(compDC , hbm);
PatBlt(compDC , 0,0,bmih->biWidth , bmih->biHeight , WHITENESS);
BITMAPFILEHEADER hdr;
HANDLE hf = CreateFile(_T(“t1.bmp”),
GENERIC_READ | GENERIC_WRITE,
(DWORD) 0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
hdr.bfType = 0x4d42;
// Compute the size of the entire file.
hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) +
bmih->biSize + bmih->biClrUsed
* sizeof(RGBQUAD) + bmih->biSizeImage);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
// Compute the offset to the array of color indices.
hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) +
bmih->biSize + bmih->biClrUsed
* sizeof (RGBQUAD);
DWORD dwTmp;
// Copy the BITMAPFILEHEADER into the .BMP file.
WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER), (LPDWORD) &dwTmp, NULL);
WriteFile(hf, (LPVOID) bmih, sizeof(BITMAPINFOHEADER) + bmih->biClrUsed * sizeof (RGBQUAD),
(LPDWORD) &dwTmp, ( NULL));
DWORD cb = bmih->biSizeImage;
WriteFile(hf, (LPSTR)pBits, (int) cb, (LPDWORD) &dwTmp,NULL);
CloseHandle(hf);
DeleteDC(compDC);
DeleteObject(hbm);
}
Thanks & Regards,
Sush
Ashwin Needamangala wrote:
No…you should write a rendering plug-in and follow the approach I
outlined in my previous reply.
Regarding your other question:
GDI/EMF — Which component should i implement?
Answer: EMF is the spool file format…so if all you need is a bitmap
image, I don’t see why you need to capture EMF. Also, note that for any
given job, there is no guarantee that EMF is the format used for
spooling…it could be RAW as well.
PCL/PS ---- Which component should i implement?
Answer: Rendering plug-in…for PCL it needs to be a Unidrv based
rendering plug-in and for PS it needs to be a Pscript based plug-in.
Bitmap Image — Which component should i implement?
Answer: Rendering plug-in with ImageProcessing and the approach outlined
in my previous reply.
- Ashwin
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Sushma Yella
Sent: Tuesday, January 04, 2005 10:20 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Virtual Printer Driver -> RAW = (PCL | PS | CAPSL)
?
Thanks chirstoph and aswin for your replies. I need the data as a bitmap
image. By your comments i understood that i need to do this in a custom
print processor. Is this the correct component to be implemented? Any
Suggestions?
Chistoph, I have one more query. How do i capture the following format.
GDI/EMF — Which component should i implement?
PCL/PS ---- Which component should i implement?
Bitmap Image — Which component should i implement?
Thanks & Regards,
Sush
Christoph Lindemann wrote:
I might have misunderstood what you want to accomplish.
What do you mean by “RAW” data? Do you want the data as GDI/EMF,
the printers own mark-up language like PCL or PS, or do you want the
data as bitmap image data?
Regards,
Christoph
-----Original Message-----
From: Sushma Yella [mailto:xxxxx@yahoo.com]
Sent: Monday, January 03, 2005 6:25 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Virtual Printer Driver
Hi Christoph,
Thanks for the information and link. Im trying to
capture the raw data. Can you tell me is this only possible by
extracting the EMF file or can we caputure the data by writing a
rendering plug-in. Any suggestions would help me?
Thanks & Regards,
Sush
Christoph Lindemann
wrote:
Hi Sush,
Extracting EMF data is not supported by
Windows/Microsoft. If you want to do it anyway, you can find
informations on how to do this at http://undocprint.printassociates.com/
Here you can also find a link to a open source project.
Regards,
Christoph Lindemann
-----Original Message-----
From: Sushma Yella
[mailto:xxxxx@yahoo.com]
Sent: Monday, January 03, 2005 2:32 PM
To: Windows System Software Devs
Interest List
Subject: [ntdev] Virtual Printer Driver
Hello All,
A very happy new year to all of you.
I am developing a virtual printer
driver. i used ddk provided sample gpd files to generate my minidriver.
i want to capture the raw data instead of EMF data and send it to file
rather than printer port. I used a rendering plug-in sample
(src/print/oemdll/oemuni) and tried to modify accordingly. i changed the
inf file and included the plug-in dll and installed the drivers. I tried
to trace out by including some debugging messages, but i dint find my
dllentry being called. Do i need to tell my mini driver to include and
load the rendering plug-in also.
Can any one help me out to solve this
problem?
Do i really need to implement a
rendering plug-in?
Is there any sample available to capture
the raw data?
Thanks & Regards,
Sush
Do you Yahoo!?
Yahoo! Mail - Find what you need with
new enhanced search. Learn more.
— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed
to ntdev as: xxxxx@printassociates.com To unsubscribe send
a blank email to xxxxx@lists.osr.com
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as:
xxxxx@yahoo.com
To unsubscribe send a blank email to
xxxxx@lists.osr.com
Do you Yahoo!?
Send holiday email and support a worthy cause. Do good.
— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed
to ntdev as: xxxxx@printassociates.com To unsubscribe send
a blank email to xxxxx@lists.osr.com
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@yahoo.com
To unsubscribe send a blank email to
xxxxx@lists.osr.com
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today! —
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed
to ntdev as: xxxxx@windows.microsoft.com To unsubscribe send a blank
email to xxxxx@lists.osr.com
—
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
---------------------------------
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.