Thanks for your attention.
I'm a developer from korea. and I need your help
I need some label printing program supports richtext.
so I'm developing with MFC
the program is simple.
edit labels with MFC's richedit control then print it with richedit's displayband method.
I don't use CPrintDialog class.
I open the printer with winspool.
it works with normal label.
I need to set up some properties like backfeeding, cutter, etc.
but I don't want to fix it with printer driver
I want to set up the property with the values that I threw
I give some code
LPDEVMODE GetPrinterMode(LPTSTR pszPrinterName)
{
HANDLE hPrinter;
LPDEVMODE pDevMode;
DWORD dwNeeded, dwRet;
if(!OpenPrinter(pszPrinterName, &hPrinter, NULL))
return NULL;
dwNeeded = DocumentProperties(NULL, hPrinter,pszPrinterName,NULL,NULL,0);
pDevMode = (LPDEVMODE)malloc(dwNeeded);
dwRet = DocumentProperties(NULL, hPrinter, pszPrinterName, pDevMode, NULL, DM_OUT_BUFFER);
if(dwRet !=IDOK)
{
free(pDevMode);
ClosePrinter(hPrinter);
return NULL;
}
ClosePrinter(hPrinter);
return pDevMode;
}
void On Printer()
{
LPDEVMODE pDevMode;
HDC pritnerDC;
pDevMode = GetPrinterMode("ZDesigner ZT410-203dpi ZPL");
printerDC = CreateDC(_T("WINSPOOL"), "ZDesigner ZT410-203dpi ZPL", NULL, pDevMode);
FORMATRANGE frmrange;
int nHorizRes = GetDeviceCaps(printerDC, HORZRES);
int nVertRes = GetDeviceCaps(printerDC, VERTRES);
int nLogPixelsX = GetDeviceCaps(printerDC, LOGPIXELSX);
int nLogPixelsY = GetDeviceCaps(printerDC, LOGPIXELSY);
SetMapMode (printerDC, MM_TEXT);
ZeroMemory(&frmrange, sizeof(frmrange));
frmrange.hdc = frmrange.hdcTarget = printerDC;
frmrange.rcPage.left = 0;
frmrange.rcPage.top = 0;
frmrange.rcPage.right = 500;
frmrange.rcPage.bottom = 500;
frmrange.rc.left = frmrange.rcPage.left;
frmrange.rc.top = frmrange.rcPage.top;
frmrange.rc.right = frmrange.rcPage.right;
frmrange.rc.bottom = frmrange.rcPage.bottom;
frmrange.chrg.cpMin = 0;
frmrange.chrg.cpMax = -1;
m_richedit.FormatRange(&frmrange, true);
DOCINFO di;
ZeroMemory(&di, sizeof(di));
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = "label";
di.lpszOutput = NULL;
StartDoc(printerDC, &di);
StartPage(prinerDC);
m_richedit.DisplayBand(&frmrange.rc);
EndPage(printerDC);
m_richedit.FormatRange(NULL, false);
EndDoc(printerDC);
DeleteDC(pritnerDC);
}
Can I set additional properties with driver?
I need your help. Can I setup some properties without zdesigner printer driver's own property dialog? |
0 Replies