Click to See Complete Forum and Search --> : Windows Printing Problem


Hajo Lemcke
October 3rd, 1999, 12:46 PM
I'm trying to print something like a multipage HTML-text on different MS-Windows systems while creating different font types. Code starts as:

HDC hdc ;
//----- Create printer descriptor
hdc = CreateDC ( pDriver, pDevice, pPort, NULL );
if ( hdc == NULL )
{
sprintf ( TmpMsg, "- CreateDC('%s', '%s', '%s', NULL) ="
" %d = Fehler", pDriver, pDevice, pPort, GetLastError ());
return ( FE_ERROR ) ; // No default printer
}

//----- Obtain some printer info
xres = GetDeviceCaps ( hdc, HORZRES ) ;
yres = GetDeviceCaps ( hdc, VERTRES ) ;



So far it works. But here the problem seems to start:

//----- Prepare DOCINFO structure
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = NULL ;
di.lpszOutput = NULL ;

//----- Start document
jobid = StartDoc ( Out.hdc, &di );



This works under Windows 95 including the following calls to "TextOut" but produces only a file with the name of the printer. This file (HP Laserjet 6 PCL) includes PJL commands for a laserjet, but will not be send to the printer after calling "EndDoc()".

Under Windows NT 4.0.3 this call "StartDoc()" returns 0. A call to "GetLastError()" returns 3, meaning "Path not found". This does not make ANY sense to me.

PLS HELP