"The data area passed to a system call is too small".
The solution with the NUL port is not valid, since my printer is already connected to the NUL port.
Any idea ??

Code: Select all
HANDLE hPDFPrinter;
HFONT font, oldFont;
HDC dc;
DOCINFO di;
hPDFPrinter = DriverInit("Algol PDF Printer");
if (hPDFPrinter == NULL)
{
hPDFPrinter = PDFDriverInit("Algol PDF Printer");
hPDFPrinter = DriverInit("Algol PDF Printer");
if (hPDFPrinter == NULL)
return;
}
EnablePrinter(hPDFPrinter,"ALGOL S.r.l.","07EFCDA .....");
dc = CreateDC("WINSPOOL","Algol PDF Printer", NULL, NULL );
if (dc == NULL)
return;
memset( &di, 0, sizeof(di) );
di.cbSize = sizeof( di );
di.lpszDocName = "Test document";
di.lpszOutput = "c:\\test.pdf";
EnablePrinter(hPDFPrinter,"ALGOL S.r.l.","07EFCDA .....");
int iRetValue = StartDoc( dc, &di ); // API ERROR 122
StartPage( dc );
MoveToEx( dc, 100, 100, NULL );
LineTo( dc, 400, 100 );
MoveToEx( dc, 100, 100, NULL );
LineTo( dc, 100, 400 );
font = CreateFont( -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _T("Verdana") );
oldFont = (HFONT)SelectObject( dc, font );
TextOut( dc, 100, 100, _T("Hi There"), 8 );
if ( oldFont )
SelectObject( dc, oldFont );
DeleteObject( font );
font = CreateFont( -24, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, _T("Wingdings") );
oldFont = (HFONT)SelectObject( dc, font );
TextOut( dc, 100, 200, _T("Hi There"), 8 );
if ( oldFont )
SelectObject( dc, oldFont );
DeleteObject( font );
EndPage( dc );
EndDoc( dc );
DeleteDC( dc );
Code: Select all
HFONT font, oldFont;
HDC dc;
DOCINFO di;
int iRetValue;
dc = CreateDC("WINSPOOL","Algol PDF Test",NULL,NULL);
if (dc == NULL)
return;
memset( &di, 0, sizeof(di) );
di.cbSize = sizeof( di );
di.lpszDocName = "Test document";
di.lpszOutput = NULL;
iRetValue = EnablePrinter(m_hPDFPrinter,PDFGENERATOR_ACTIVECOMPANY,PDFGENERATOR_ACTIVEKEY);
iRetValue = SetFileNameOptions(m_hPDFPrinter,NoPrompt + UseFileName);
iRetValue = SetDefaultFileName(m_hPDFPrinter,PDFGENERATOR_PDFFILE);
// EnablePrinter , SetFileNameOptions and SetDefaultFileName are OK with return 1
iRetValue = StartDoc( dc, &di );
// ERROR on StartDoc : return -1
how do I open this??? I filled form on http://www.amyuni.com/en/support/techsupport.html ,you should open a support ticket with our support department.