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, Sean - Tracker, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Tracker Supp-Stefan

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

Events not firing

Post by andrewb » Mon Jun 27, 2016 10:26 pm

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 90 times

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13250
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Events not firing

Post by Tracker Supp-Stefan » Fri Jul 01, 2016 11:43 am

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 » Fri Jul 01, 2016 12:06 pm

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.

Ivan - Tracker Software
Site Admin
Posts: 3584
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Events not firing

Post by Ivan - Tracker Software » Fri Jul 01, 2016 3:14 pm

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 » Sun Jul 03, 2016 11:53 pm

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 96 times

Ivan - Tracker Software
Site Admin
Posts: 3584
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Events not firing

Post by Ivan - Tracker Software » Wed Jul 06, 2016 2:02 pm

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.

Roman - Tracker Supp
Power User
Posts: 259
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp » Wed Jul 06, 2016 2:05 pm

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.
Tracker Software Products

Please ZIP any files uploaded to this forum or they will not be posted !
You may also use a RAR or 7Z archive format

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

Re: Events not firing

Post by andrewb » Wed Jul 06, 2016 10:50 pm

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 56 times

Roman - Tracker Supp
Power User
Posts: 259
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp » Thu Jul 07, 2016 11:32 am

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 59 times
Tracker Software Products

Please ZIP any files uploaded to this forum or they will not be posted !
You may also use a RAR or 7Z archive format

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

Re: Events not firing

Post by andrewb » Thu Jul 07, 2016 10:31 pm

Hi Roman, I have applied the supplied fix but no change, still get the "Printing Progress" window stuck at 0%

Roman - Tracker Supp
Power User
Posts: 259
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp » Fri Jul 08, 2016 2:43 am

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).
Tracker Software Products

Please ZIP any files uploaded to this forum or they will not be posted !
You may also use a RAR or 7Z archive format

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

Re: Events not firing

Post by andrewb » Fri Jul 08, 2016 2:47 am

Yes, I used the C# example provided with API

I am using a VM running Windows Server 2012 - could this be an issue?

Roman - Tracker Supp
Power User
Posts: 259
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp » Fri Jul 08, 2016 3:07 am

Can I have a remote debug session on your machine (see the details here)?
I mean your VM.
Tracker Software Products

Please ZIP any files uploaded to this forum or they will not be posted !
You may also use a RAR or 7Z archive format

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

Re: Events not firing

Post by andrewb » Fri Jul 08, 2016 3:22 am

Yes you can, how do I send my details?

Roman - Tracker Supp
Power User
Posts: 259
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp » Fri Jul 08, 2016 3:32 am

Please e-mail it to me (press "EMAIL" button below my post).
Tracker Software Products

Please ZIP any files uploaded to this forum or they will not be posted !
You may also use a RAR or 7Z archive format

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

Re: Events not firing

Post by andrewb » Fri Jul 08, 2016 3:41 am

Sorry Roman but I don't see an "Email" button, just a "Profile" button

Roman - Tracker Supp
Power User
Posts: 259
Joined: Sun Nov 21, 2004 3:19 pm

Re: Events not firing

Post by Roman - Tracker Supp » Fri Jul 08, 2016 3:56 am

Sorry - it seems I can see it due to my admin privileges on the forum.
I emailed to you.
Tracker Software Products

Please ZIP any files uploaded to this forum or they will not be posted !
You may also use a RAR or 7Z archive format

Post Reply