Reputation: 1529
I'm currently using Adobe's Acrobat Interop library (v1.1) in a single threaded fashion to batch edit multiple PDF documents across several volumes. This is a major bottleneck in my program, and, as the project has matured, I've become tempted to parallelize parts of this.
However, it seems that before I can continue I need to create multiple Acrobat processes so as to not have multiple threads locking on the single instance of the application. I know one can adjust Adobe's single-process behavior by using the /n switch in the shell, but given the way it's instantiated within .NET:
Type type = Type.GetFromProgID("AcroExch.PDDoc");
CAcroPDDoc app = (CAcroPDDoc)Activator.CreateInstance(type);
I can't really find a way to force it into multiple instances. I've tried every registry hack under the sun, but those only seem to affect the way Acrobat launches from within the shell. As far as I've been able to tell, there are no parameters for the COM constructor, either.
I was hoping that someone could point me in the right direction. Thanks!
Upvotes: 2
Views: 1594
Reputation: 15197
Acrobat is expossed as a single threaded COM, and that is the wall that is limiting your application to spawn multiple threads. The only work around I can think of is to process files on separate processes.
So,
a) Put your logic inside a console application, and spawn it multiple times in parallel
b) Use a native PDF processor, like ABC Pdf (not free!) or iTextSharp (free)
Upvotes: 2