just to complement my previous message (posted yesterday in this forum) I made a simple console application that reproduces the problem that I mentionded. It works fine on Windows NT/2000/XP, but generates a blank PDF in Windows 95/98 (using driver version 2.07).
This is the code:
Code: Select all
// pdftest.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#import "cdintf.dll" no_namespace
#define PDF_NOPROMPT 1 // do not prompt for file name
#define PDF_USEFILENAME 2 // use file name set by SetDefaultFileName else use document name
#define PDF_CONCATENATE 4 // concatenate files, do not overwrite
#define PDF_DISABLECOMPRESSION 8 // disable page content compression
#define PDF_EMBEDFONTS 16// embed fonts used in the input document
#define PDF_256COLORCOMPRESSION 800000
int main(int argc, char* argv[])
{
try
{
CoInitialize (NULL);
ICDIntfPtr ptrPdf;
HRESULT hr = ptrPdf.CreateInstance (__uuidof (CDIntf));
if (FAILED(hr))
{
return 1;
}
ptrPdf->DriverInit (L"PDF Compatible Printer Driver");
ptrPdf->PutResolution (600);
ptrPdf->PutFileNameOptions (PDF_NOPROMPT | PDF_USEFILENAME | PDF_256COLORCOMPRESSION);
ptrPdf->PutDefaultFileName (L"c:\\test.pdf");
HDC hImp = (HDC)ptrPdf->CreateDC ();
SetBkColor (hImp, RGB(255,255,255));
RECT rect;
GetClipBox (hImp, &rect);
DOCINFO di;
::ZeroMemory (&di, sizeof (DOCINFO));
di.cbSize = sizeof (DOCINFO);
di.lpszDocName = "Test";
StartDoc (hImp, &di);
StartPage (hImp);
HPEN hPen = CreatePen (PS_SOLID, 0, RGB (0,0,0));
SelectObject (hImp, hPen);
for (int i = 0 ; i < abs (rect.right - rect.left) / 2; i+=50)
{
for (int j = 0; j < abs (rect.bottom - rect.top) / 2; j += 50)
{
SetPixel (hImp, i, j, RGB (0,0,0)); //if I draw a line insted it works fine, both on windows NT/2000 and 9x..
}
}
EndPage (hImp);
EndDoc (hImp);
DeleteDC( hImp );
DeleteObject (hPen);
return 0;
}
catch (_com_error & e)
{
MessageBox (NULL, (LPCTSTR)e.Description (), "Error", MB_ICONSTOP);
return 1;
}
}
Any suggestions?
Thanks,
Tiago Gehring
tiagog@weg.com.br