Events not firing
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
Events not firing
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#?
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 228 times
- Tracker Supp-Stefan
- Site Admin
- Posts: 17907
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Events not firing
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
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
Re: Events not firing
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: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: Events not firing
I guess it does not compile because you have to use namespace for the enum value:
HTH
Code: Select all
PDFPrinter.WaitForPrintEvent(PXCComLib6.event_DocumentSaved)
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.
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.
Re: Events not firing
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)
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 237 times
- Ivan - Tracker Software
- Site Admin
- Posts: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: Events not firing
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.
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.
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
- Site Admin
- Posts: 306
- Joined: Sun Nov 21, 2004 3:19 pm
Re: Events not firing
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.
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.
Re: Events not firing
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.
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 202 times
- Roman - Tracker Supp
- Site Admin
- Posts: 306
- Joined: Sun Nov 21, 2004 3:19 pm
Re: Events not firing
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.
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 205 times
Re: Events not firing
Hi Roman, I have applied the supplied fix but no change, still get the "Printing Progress" window stuck at 0%
- Roman - Tracker Supp
- Site Admin
- Posts: 306
- Joined: Sun Nov 21, 2004 3:19 pm
Re: Events not firing
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).
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).
Re: Events not firing
Yes, I used the C# example provided with API
I am using a VM running Windows Server 2012 - could this be an issue?
I am using a VM running Windows Server 2012 - could this be an issue?
- Roman - Tracker Supp
- Site Admin
- Posts: 306
- Joined: Sun Nov 21, 2004 3:19 pm
Re: Events not firing
Can I have a remote debug session on your machine (see the details here)?
I mean your VM.
I mean your VM.
Re: Events not firing
Yes you can, how do I send my details?
- Roman - Tracker Supp
- Site Admin
- Posts: 306
- Joined: Sun Nov 21, 2004 3:19 pm
Re: Events not firing
Please e-mail it to me (press "EMAIL" button below my post).
Re: Events not firing
Sorry Roman but I don't see an "Email" button, just a "Profile" button
- Roman - Tracker Supp
- Site Admin
- Posts: 306
- Joined: Sun Nov 21, 2004 3:19 pm
Re: Events not firing
Sorry - it seems I can see it due to my admin privileges on the forum.
I emailed to you.
I emailed to you.