| Dave Cullen 2006-01-24, 7:07 pm |
| I have a VC++ 6.0 application that prints simple text data, and it will
not print to our HP Laserjet 2100 Series printers. All I get is garbage,
i.e. funny symbols like mailboxes and hourglasses. Properly formatted
with spaces etc, but no text.
All my VB apps print to these printers fine. And the VC app prints to
all the other networked printers with no problem. I realize this sounds
like a driver issue, but I don't understand why all the other
applications don't have the same problem.
This is how I use the printer.. someone please tell me if there's
anything nonstandard here that might cause the strangeness:
CDC cdc; // device context object for printer
HDC hdc; // handle to device context
CPrintDialog dlg(TRUE); // Windows Printer Dialog class
CString formatted_page; //contains text data to print
RECT rect = {0,0,0,0}; // RECT structure for page
dlg.DoModal()
hdc = dlg.CreatePrinterDC();
ASSERT(hdc);
// Attach Device Context object to handle
cdc.Attach(hdc);
cdc.StartDoc("Reject Report"); // begin a new print job
// Calculate the cordinates needed to print a page
cdc.DrawText(formatted_page,&rect,DT_CALCRECT);
// Then use the same RECT to print it
cdc.StartPage();
cdc.DrawText(formatted_page,&rect,DT_NOCLIP);
cdc.EndPage();
Thanks
|