6 Replies Latest reply on May 10, 2018 4:21 AM by Trevorׅ

    Open indd file in c#

    jonasf8343977 Level 1

      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?