F
fa6bc41f-9362-46545
Guest
Hello,
Thanks for reading this question. I will try to be as detailed as I can
I have a print driver written by a previous developer in C++. The driver converts the input (word doc, adobe,...) any document to PCL. This PCL gets converted to TIFF. The users are complaining that the final TIFF Image is fuzzy. This issue might have existed since 13 years and I have become to unfortunate one to hopefully fix it.
I was able to capture the PCL emitted by the driver and upload it to 3rd party TIFF viewers like ghost PCL. It seems blurry even in 3rd party viewers, which took me to the conclusion that driver is the problem. Then I went about finding code in the driver, which actually rasterzies the input image of text. I am unable find code where rasterization is happening.
The header or text seems to be printing clearly but, the body is weird. The header is printing at a 300dpi but the body is probably at 75dpi. On another thought now it almost looks like the input to the driver is already "fuzzed" .
This is the only code related to Text . Could it be possible that perhaps PFN_DrvTextOut inside winddi.h already does rasterization?
pOemPDEV->m_pfnDrvTextOut
typedef BOOL (APIENTRY *PFN_DrvTextOut)(SURFOBJ *,STROBJ *,FONTOBJ *,CLIPOBJ *,RECTL *,RECTL *,BRUSHOBJ *,BRUSHOBJ *,POINTL *,MIX);
#if defined(IMPL_TEXTOUT) // 23
case INDEX_DrvTextOut:
m_pfnDrvTextOut = (PFN_DrvTextOut)pfn;
break;
#endif
Secondly can someone tell me what this code means? Is there anyway I can hard code the resolution to 300dpi? I say hardcode because for test purposes now. I don't see any settings in the print driver properties where the resolution could be set to 300.
// Add all Raster Header Lines
if (!firstPage)
{
// Add a Form Feed
char bufFormFeed[2];
StringCchPrintfA(bufFormFeed, 2, "%c", 12); // 1 char
MoveMemory(pOemPDEV->pBufStart + dwOffset, bufFormFeed, 2);
dwOffset += 1;
}
// Position cursor at X0, Y0
char bufXY[8];
StringCchPrintfA(bufXY, 8, "%c%s", 27, "*p0x0Y"); // 7 chars
MoveMemory(pOemPDEV->pBufStart + dwOffset, bufXY, 8);
dwOffset += 7;
// Start Raster Graphics
char bufStartRas[6];
StringCchPrintfA(bufStartRas, 6, "%c%s", 27, "*r1A"); // 5 chars
MoveMemory(pOemPDEV->pBufStart + dwOffset, bufStartRas, 6);
dwOffset += 5;
// Raster Encoding - Run-Length Encoding
char bufRasEncoding[6];
StringCchPrintfA(bufRasEncoding, 6, "%c%s", 27, "*b1M"); // 5 chars
MoveMemory(pOemPDEV->pBufStart + dwOffset, bufRasEncoding, 6);
dwOffset += 5;
If all the above code can't be changed, can someone suggest to improve the resolution of driver rasterized images in C++? The base code for the project is this
microsoft/Windows-driver-samples
Thank you
Sun
Continue reading...
Thanks for reading this question. I will try to be as detailed as I can
I have a print driver written by a previous developer in C++. The driver converts the input (word doc, adobe,...) any document to PCL. This PCL gets converted to TIFF. The users are complaining that the final TIFF Image is fuzzy. This issue might have existed since 13 years and I have become to unfortunate one to hopefully fix it.
I was able to capture the PCL emitted by the driver and upload it to 3rd party TIFF viewers like ghost PCL. It seems blurry even in 3rd party viewers, which took me to the conclusion that driver is the problem. Then I went about finding code in the driver, which actually rasterzies the input image of text. I am unable find code where rasterization is happening.
The header or text seems to be printing clearly but, the body is weird. The header is printing at a 300dpi but the body is probably at 75dpi. On another thought now it almost looks like the input to the driver is already "fuzzed" .
This is the only code related to Text . Could it be possible that perhaps PFN_DrvTextOut inside winddi.h already does rasterization?
pOemPDEV->m_pfnDrvTextOut
typedef BOOL (APIENTRY *PFN_DrvTextOut)(SURFOBJ *,STROBJ *,FONTOBJ *,CLIPOBJ *,RECTL *,RECTL *,BRUSHOBJ *,BRUSHOBJ *,POINTL *,MIX);
#if defined(IMPL_TEXTOUT) // 23
case INDEX_DrvTextOut:
m_pfnDrvTextOut = (PFN_DrvTextOut)pfn;
break;
#endif
Secondly can someone tell me what this code means? Is there anyway I can hard code the resolution to 300dpi? I say hardcode because for test purposes now. I don't see any settings in the print driver properties where the resolution could be set to 300.
// Add all Raster Header Lines
if (!firstPage)
{
// Add a Form Feed
char bufFormFeed[2];
StringCchPrintfA(bufFormFeed, 2, "%c", 12); // 1 char
MoveMemory(pOemPDEV->pBufStart + dwOffset, bufFormFeed, 2);
dwOffset += 1;
}
// Position cursor at X0, Y0
char bufXY[8];
StringCchPrintfA(bufXY, 8, "%c%s", 27, "*p0x0Y"); // 7 chars
MoveMemory(pOemPDEV->pBufStart + dwOffset, bufXY, 8);
dwOffset += 7;
// Start Raster Graphics
char bufStartRas[6];
StringCchPrintfA(bufStartRas, 6, "%c%s", 27, "*r1A"); // 5 chars
MoveMemory(pOemPDEV->pBufStart + dwOffset, bufStartRas, 6);
dwOffset += 5;
// Raster Encoding - Run-Length Encoding
char bufRasEncoding[6];
StringCchPrintfA(bufRasEncoding, 6, "%c%s", 27, "*b1M"); // 5 chars
MoveMemory(pOemPDEV->pBufStart + dwOffset, bufRasEncoding, 6);
dwOffset += 5;
If all the above code can't be changed, can someone suggest to improve the resolution of driver rasterized images in C++? The base code for the project is this
microsoft/Windows-driver-samples
Thank you
Sun
Continue reading...