Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to read InDesign(.indd) file in c#. I have installed adobe InDesignCS6.
I have added COM reference of 'Adobe InDesign CS6 Type Library' in my c# application.
Code snippet is as follows.

[STAThread]
static void Main(string[] args)
{
InDesign.Application app = (InDesign.Application)COMCreateObject("InDesign.Application");
Document doc = app.ActiveDocument;
Page page = doc.Pages[1];
TextFrame frame = page.TextFrames[1];
Console.WriteLine(frame.Contents.ToString());
}

public static object COMCreateObject(string sProgID)
{
// We get the type using just the ProgID
Type oType = Type.GetTypeFromProgID(sProgID);
if (oType != null)
{
return Activator.CreateInstance(oType);
}

return null;
}

But the first line itself throwing an following error while type casting output of COMCreateObject method into InDesign.Application type.

Error :
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)).

Kindly help me. Its urgent.
Posted
Updated 29-Oct-14 6:03am
v2
Comments
BillWoodruff 29-Oct-14 9:20am    
Programming with InDesign is very specialized; you may be more likely to get help on the Adobe forum where this is discussed:

https://forums.adobe.com/community/indesign/indesign_sdk
Richard MacCutchan 29-Oct-14 12:04pm    
The message is clearly telling you what the problem is. Check the documentation and UUID values for the library.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900