FIrstly, thnx for the reply.I'll explain the problem clearly below: I have a CAD environtment, UGNX(Unigraphicd NX) and i have a part displayed on the current opened window.I have to capure the contents of the current opened window(i.e., the image of the current opend window) of my UGNX session and put it into a PDF file.This is am trying to do, the file printing option which has PDF complete as one of the printing formats using PrintDLg function in win32 sdk.The result that i am getting is a blank pdf file.I dont seem to undertnd the problem.Can you plse have a look at my code below and tell me where i am going wrong.Plse do reply. Thnk You. Sample Code: HDC GetPrinterDC(HWND hWndParent) { PRINTDLG pdlg; // Initialize the PRINTDLG structure. memset( &pdlg, 0, sizeof( PRINTDLG ) ); pdlg.lStructSize = sizeof( PRINTDLG ); DEVMODE hDevMode; // Set the flag to return printer DC. pdlg.Flags = PD_RETURNDEFAULT | PD_RETURNDC; pdlg.hwndOwner = hWndParent; DEVMODE hDmode; PrintDlg( &pdlg ); // hDC member of the PRINTDLG structure contains // the printer DC. return pdlg.hDC; } void InitDocStruct( DOCINFO* di, char* docname) { // Always zero it before using it. memset( di, 0, sizeof( DOCINFO ) ); // Fill in the required members. di->cbSize = sizeof( DOCINFO ); di->lpszDocName = "test"; } HINSTANCE hInstance; BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { hInstance = (HINSTANCE)hModule; return TRUE; } extern "C" DllExport void ufusr( char *parm, int *returnCode, int rlen ) { int nErr = 0; HWND hWnd = NULL; HDC hDC; DOCINFO di; nErr = UF_initialize(); if (nErr != 0) { uc1601 ("Failed to initialise UG session", 1); return; } hWnd = GetActiveWindow(); if (hWnd != NULL) { hDC = GetPrinterDC(hWnd); if( !hDC) { MessageBox(NULL, "Error creating DC", "Error", MB_APPLMODAL | MB_OK ); } InitDocStruct( &di, "Test"); StartDoc( hDC, &di ); //// Print one page. StartPage( hDC ); //DrawStuff( hDC ); EndPage( hDC ); //// Indicate end of document. EndDoc( hDC ); // Clean up DeleteDC( hDC ); } nErr = UF_terminate(); }