I'm developing plug-in for Acrobat/Reader(C++) and with recent 19.012.20034 update I start receiving different pointer to PDDoc on PDDocDidSave and PDDocDidClose events which was fork fine until update to latest version.
I'm using a map to store PDDoc pointers on PDDocDidOpen and then I use it to determine which document opened through my procedure.
Should I use PDDocAcquire or it is a bug?
Use something else to ID the Docs, such as the DocID or Path. Both are unique to the particular PDF.
Hello, i tried using PDDocGetID but for every document I got id = 16 and also when I perform this call to obtain PDDoc ID DiDSave event fired twice and on second time it just crushed application.
PDDocGetID returns an array. If you say it's returning 16, it sounds as if you are comparing the number of bytes in the array, rather than the array itself.
Thank you for clarification. I was rewrite it.
But Acrobat still constantly crashing when i try to call function through COM object on PDDocDidClose event.
Also i got wrong PDDocID on DidSave event when pressing Fill and Sign but when I got control on PDDocDidClose callback the ids the same and everything goes fine until I want to make some call through COM(This call works fine on simple save (Ctrl+S), when just closing document (Press X on document title)).
The odd thing is that it had been working for three years and now my old code is broken.
Signing inherently saves the file, but perhaps in the latest version it also closes and reopens the file for some reason. May be an enhancement to security, which is always messing us about.
By the way do you also monitor for DocDidClose event? I would expect that to be called, or it's a bug.
I made a few test and on a simple SaveAs and Close as a result I got the same ids for two documents.
On a simple SaveAs, Save, Close all COM calls works fine.
But when I press on Fill and Sign same behaviour present for PDDocID and as a plus COM calls crushes application.
"By the way do you also monitor for DocDidClose event? I would expect that to be called, or it's a bug."
Yes, i subscribed on this two events and they are called in a row.
I didn't see DidOpen event because it stops working on DidClose because of COM calls in case of Fill and Sign.
So I remove part of code which was written to obtain PDDocID and left old one which rely on PDDoc pointers with which i can aline with opened documents in Acrobat with my collection.
In case SaveAs I don't see DidOpen event.
Does the call work ok if you call a 'SaveAs' as the first signature calls a SaveAs (I think) and a SaveAs, closes and reopens the document, which would invalidate the DocID.