Copy link to clipboard
Copied
Can I open a indd file whitin c# and print/make a pdf of it´s content? I`ve installed VS2010 and InDesign aswell. I have a reference to "Adobe InDesign CC 2018 Type Library" in Visual Studio. My code is asfollows.
using InDesign;
// Create application instance
Type type = Type.GetTypeFromProgID("InDesign.Application");
Application application = (Application)Activator.CreateInstance(type);
Then I get the error message: {System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'InDesign.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{ABD4CBB2-0CFE-11D1-801D-0060B03C02E4}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Is it possible to do what I´m trying to do?
Copy link to clipboard
Copied
Hi Jonas:
I'm going to move this over to the InDesign Scripting forum for you.
~Barb
Copy link to clipboard
Copied
Can I follow the answer in this forum or must I change forum?
Copy link to clipboard
Copied
Hi Jonas:
You don't have to do a thing. This is already in the Scripting forum—any responses will appear directly below our exchanges.
~Barb
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I feel like I´ve miss something in my installation. Is it correct to just install InDesign CC and VS2010 sp1. Then make a reference in VS2010 to "Adobe InDesign CC 2018 Type Library". Is that all or do I need to install some SDK or CS6 kit???
Copy link to clipboard
Copied
I have 0 experience with c# so I can't help with the specifics but I have scripted InDesign as a COM object. You shouldn't have any problem with it.
Did you try regenerating the .tb file?
Try creating the COM object by path and not ID see if that works.