Events not firing

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
andrewb
User
Posts: 8
Joined: Mon Jun 27, 2016 10:04 pm

Events not firing

Post by andrewb »

I have downloaded and installed the Drivers API (6.0.317.1) onto a Windows 2012 Server. I have opened the C# example in Visual Studio 2015 and can successfully run the code to create a PDF from a text file. However I cannot get any of the events (e.g. OnFileSaved) to fire. They do not log to the form and do not get hit if I put a breakpoint on them.

I have created my own code using the API to create PDF documents from word documents. There are 2 scenarios:
1. Create a single PDF
2. Create a merged PDF from multiple word documents

For the both scenarios I am getting inconsistent results. It appears certain documents are skipped if I create multiple single PDFs in quick succession. When I use the merge method only some of the documents are added. It appears that the code is not waiting for the first print event to finish before moving to the next. I have tried adding a wait event for the printjob ( printJob.WaitForExit();) but this causes the code to take a long time to complete. I have also experimented with using a loop with a sleep event checking of the file has been created.

I would like to use the OnFileSaved event to mitigate this issue but I cannot work out how to get it to fire. Is there some trick to getting these events working in C#?
Attachments
PDFEXchangeCode.zip
Code example
(868 Bytes) Downloaded 202 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17810
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Events not firing

Post by Tracker Supp-Stefan »

Hello andrewb,

I spoke with a colleague working on the Drivers API, and he said that we will check the sample projects - and see why the events are not firing properly in the samples.

In the mean time he also recommended that you can try to use
PDFPrinter.WaitForPrintEvent(event_DocumentSaved)
And wait while the printer finishes generating the PDF File.

Regards,
Stefan
andrewb
User
Posts: 8
Joined: Mon Jun 27, 2016 10:04 pm

Re: Events not firing

Post by andrewb »

Thanks Stefan. I'm not sure how to use the waitforprintevent method. I tried passing in the name of the event but it won't compile.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Events not firing

Post by Ivan - Tracker Software »

I guess it does not compile because you have to use namespace for the enum value:

Code: Select all

PDFPrinter.WaitForPrintEvent(PXCComLib6.event_DocumentSaved)
HTH
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
andrewb
User
Posts: 8
Joined: Mon Jun 27, 2016 10:04 pm

Re: Events not firing

Post by andrewb »

Hi Ivan

I implemented the WaitForPrintEvent however it throws an error - see attached.

Looking at your documentation (PDF-XChange Drivers API SDK 2012 User Manual) it appears this event is unsupported and will return "an E_NOTIMPL error code:" (see attached)
Attachments
WaitForPrintEventError.7z
(52.67 KiB) Downloaded 207 times
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Events not firing

Post by Ivan - Tracker Software »

Unfortunately documentation for this function in not up to date. Actually this method is implemented, and when you call it waits for specified printer event (first method's parameter) for maximum of specified time (second method's parameter, in milliseconds).

If the required event will happen during specified period of time, function will be terminated and will return S_OK.
If the required event will not happen - function will return E_ABORT error code.

It is the situation you got - you specified 1000 milliseconds to wait for event_DocumentSaved, but it didn't happen in that period of time and you got E_ABORT returned from the function.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
User avatar
Roman - Tracker Supp
Site Admin
Posts: 303
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp »

Hello andrewb,

The issue with events has been fixed and will be available in the next release.

In your case WaitForPrintEvent() fails due to used timeout (1 second). I agree the reported error is obscure, it will be more specific in the next release.
andrewb
User
Posts: 8
Joined: Mon Jun 27, 2016 10:04 pm

Re: Events not firing

Post by andrewb »

I have updated the timeout to 30000 milliseconds. It doesn't seem to matter how long I use as a timeout, i still get the E_ABORT error.

As you can see from attached screenshot, when I use WaitForPrintEvent a new window appears "Printing Progress" that sits at 0% done and doesn't change.
Attachments
PDFExchangeE_Abort.7z
(43.62 KiB) Downloaded 175 times
User avatar
Roman - Tracker Supp
Site Admin
Posts: 303
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp »

Andrew, try the attached fix.
Unzip the file to an empty directory and run Fix.cmd as Administrator.

Revert the C# demo source to its original state.
Attachments
pxc_fix.zip
(5.59 MiB) Downloaded 170 times
andrewb
User
Posts: 8
Joined: Mon Jun 27, 2016 10:04 pm

Re: Events not firing

Post by andrewb »

Hi Roman, I have applied the supplied fix but no change, still get the "Printing Progress" window stuck at 0%
User avatar
Roman - Tracker Supp
Site Admin
Posts: 303
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp »

Did you try the unmodified C# demo ("%ProgramFiles%\Tracker Software\PDF-XChange 6 API\Examples\Bin\C#\PDFdriverAPI.exe" )?
Please check if pdfSaver6.exe has been updated ("%ProgramFiles%\Tracker Software\PDF-XChange 6 API\pdfSaver6.exe" must have file version 6.0.317.2).
andrewb
User
Posts: 8
Joined: Mon Jun 27, 2016 10:04 pm

Re: Events not firing

Post by andrewb »

Yes, I used the C# example provided with API

I am using a VM running Windows Server 2012 - could this be an issue?
User avatar
Roman - Tracker Supp
Site Admin
Posts: 303
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp »

Can I have a remote debug session on your machine (see the details here)?
I mean your VM.
andrewb
User
Posts: 8
Joined: Mon Jun 27, 2016 10:04 pm

Re: Events not firing

Post by andrewb »

Yes you can, how do I send my details?
User avatar
Roman - Tracker Supp
Site Admin
Posts: 303
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp »

Please e-mail it to me (press "EMAIL" button below my post).
andrewb
User
Posts: 8
Joined: Mon Jun 27, 2016 10:04 pm

Re: Events not firing

Post by andrewb »

Sorry Roman but I don't see an "Email" button, just a "Profile" button
User avatar
Roman - Tracker Supp
Site Admin
Posts: 303
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp »

Sorry - it seems I can see it due to my admin privileges on the forum.
I emailed to you.
Post Reply