Skip to main content
New Participant
May 9, 2018
Question

Open indd file in c#

  • May 9, 2018
  • 2 replies
  • 3330 views

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?

This topic has been closed for replies.

2 replies

New Participant
May 9, 2018

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???

Trevor:
Braniac
May 10, 2018

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.

Braniac
May 9, 2018

Hi Jonas:

I'm going to move this over to the InDesign Scripting forum for you.

~Barb

New Participant
May 9, 2018

Can I follow the answer in this forum or must I change forum?

Braniac
May 9, 2018

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