OLE interface does not work

After update to PDF creator 3.1.1 OLE object used by software do not generate .pdf file. Was any change or aproach for OLE Interface in comparison to version 2.?

Hi,

there were some small changes to the COM interface which might be causing the issue, which file are you currently referencing? Are you using any of the SMTP/FTP actions to send the created files somewhere (these now use accounts)? Are you sure the software originally used PDFCreator 2.x? If it used 1.x, the interface was completely rewritten and it will require major adjustments or even an entire rewrite to make everything work again.

Best regards

Robin

Dear Robin,

We dont use FTP/SMTP.

Just checked that PdfCreator 3.0.2. works well with our software, 3.1.1 does not,

We just Print to pdf printer and, then using OLE object do:

            w8 =   vPDFC.OleFunction<int>("WaitForJob",5)  ;

            if(w8)
            {

                    nextJob = vPDFC.OlePropertyGet("NextJob");
                    printsucces = true;
                    count = 5;

                    nextJob.OleFunction("SetProfileByGuid","DefaultGuid");
                    Screen->Cursor = crHourGlass;
                     nextJob.OleFunction("SetProfileSetting","ShowProgress","true");
                     if(!openViewer)
                             nextJob.OleFunction("SetProfileSetting","OpenViewer","false");
                     else
                             nextJob.OleFunction("SetProfileSetting","OpenViewer","true");
                    nextJob.OleFunction("ConvertTo",FileName);

                    Screen->Cursor = crDefault;

            return  printsucces;

Problem is, this code was working before.
Idea was that using PdfCreator wegenerate pdf-s under specified path

After 3.1.1 pdf is generated in folder:

%user%AppData\Local\Temp\PDFCreator\Temp\Job_kibbs5l5\tempoutput\output.pdf

And if we provided flag to open it after generation, it is not displayed.

I modified code, to see more details, like:

                Variant count =   vPDFC.OlePropertyGet("Count")  ;  // Under Debug I see that count is 1

                nextJob = vPDFC.OlePropertyGet("NextJob");

                nextJob.OleFunction("SetProfileByGuid","DefaultGuid");
                Screen->Cursor = crHourGlass;
                nextJob.OleFunction("SetProfileSetting","ShowProgress","true");
                if(!openViewer)
                    nextJob.OleFunction("SetProfileSetting","OpenViewer","false");
                else
                    nextJob.OleFunction("SetProfileSetting","OpenViewer","true");

                Variant PrintJobInfo=nextJob.OlePropertyGet("PrintJobInfo")  ;
                Variant PrintJobName=PrintJobInfo.OlePropertyGet("PrintJobName")  ; // I checked JobName is exactly my one
                WideString JobName=PrintJobName; 

                WideString wFileName=AnsiString(FileName);
                Screen->Cursor = crDefault;
                nextJob.OleFunction("ConvertTo",wFileName); // File name is with path like "C:\myfolder\myfilename.pdf"
                do
                {   isFinished = nextJob.OlePropertyGet("IsFinished");
                }
                while(!isFinished); // Checked, Is Finished =1
                
                Variant isSuccessful = nextJob.OlePropertyGet("IsSuccessful"); // Successful is 0
                Variant OutputFiles=nextJob.OlePropertyGet("GetOutputFiles");
                Variant vcoutf=OutputFiles.OlePropertyGet("Count"); // count is 0

                int ic=vcoutf;
                WideString woutname;
                Variant voutname;
                for(int i=0;i<ic;i++)
                {   voutname=OutputFiles.OleFunction("GetFilename",i);
                }

So, I confused. That works with 3.0 and does not with 3.1.1.

Just instelled 3.1.2. Same storry. If I compiled Cpp example CppCOMTest all works fine with it.

But I crteated .dll with code form example:

BSTR StrToBstr(std::string str)
{
std::wstring ws(str.begin(), str.end());
BSTR bs = SysAllocStringLen(ws.data(), ws.size());

return bs;

}

BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CoInitialize(0);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
CoUninitialize();
break;
}
return TRUE;
}
using namespace PDFCreator_COM;

//Function declarations
extern ā€œCā€
{

__declspec(dllexport) BOOL  PASCAL  CONVERT2PDF(LPCSTR pFileName)
{
	BOOL bres = false;
	IQueuePtr qPtr(__uuidof(Queue));
	MessageBox(NULL, TEXT("Quee"), TEXT("pdf dll"), MB_OK);

	try
	{
		if (qPtr != NULL)


			if (qPtr->WaitForJob(10))
			{
				if (qPtr->Count)
				{
					IPrintJobPtr printJob = qPtr->NextJob;

					printJob->SetProfileByGuid("DefaultGuid");

					printJob->ConvertTo(StrToBstr(pFileName));//createFileName("2PDF"));
					MessageBox(NULL, TEXT("Filenameset"), TEXT("pdf dll"), MB_OK);
					

					bres = true;
				}
			}
	}
	catch (...)
	{

	}
	return bres;
}

}

Before that code my App is printing to PDFCreator printer.
By running I get MessageBox 1 and 2
But ā€¦ pdf is generated by path:

%user%AppData\Local\Temp\PDFCreator\Temp\Job_somenumber\tempoutput\output.pdf