'System.Runtime.InteropServices.COMException' error on indesign interop

0

Im trying make automated page design with Adobe InDesign CC.

this is my code in C# :

public class HomeController : Controller
{
    public ActionResult Index()
    {
        object missing = Type.Missing;
        Type type = Type.GetTypeFromProgID("InDesign.Application");
        if (type == null)
        {
            throw new Exception("Adobe InDesign CC is not installed");
        }
        _Application app = (_Application)Activator.CreateInstance(type);
        Document document = (Document)app.Documents.Add(true, missing);
        Page page = (Page)document.Pages[1];
        TextFrame textFrame = page.TextFrames.Add(missing,
           idLocationOptions.idUnknown, missing);
        textFrame.GeometricBounds = new string[] { "6p", "6p", "24p", "24p" };
        textFrame.Contents = "Hello from .Net!";
        return View();
    }

now when i run it gives this error to me :

An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll but was not handled in user code

Additional information: Retrieving the COM class factory for component with CLSID {FB6F0F4B-0467-4F63-88EC-3960B8E1B3EE} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

error happens in line :

_Application app = (_Application)Activator.CreateInstance(type);

this is the screenshot :

enter image description here

also , when i run this code , Adobe Indesign getting opened but do nothing happend until error shows up.

c#
com
interop
adobe-indesign
asked on Stack Overflow Dec 10, 2014 by Ahad Porkar

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0