Click here to Skip to main content
13,055,047 members (61,279 online)
Click here to Skip to main content
Add your own
alternative version


13 bookmarked
Posted 9 Nov 2005

Accessing Adobe InDesign CS COM Objects from .NET

, 9 Nov 2005
Rate this:
Please Sign up or sign in to vote.
An article showing how to access Adobe InDesign CS COM objects from .NET


This article shows how to access Adobe InDesign CS COM objects from .NET.


I needed to make an application that read product information from a database and inserted it in an Adobe InDesign template to create a catalog ready for printing. There is not much information about this subject to be found on the Internet, so I thought I might share this article with you.

Note: Adobe InDesign CS and the InDesign SDK need to be installed on the development computer.

Using the Code

Create a new project in Visual Studio and make a reference to COM object 'Adobe InDesign CS Type Library'. The following code creates an instance of the InDesign application and gets the first textframe on the first page.

// create an InDesign instance
InDesign.Application app = 
    (InDesign.Application) COMCreateObject("InDesign.Application");

// get a reference to the current active document
InDesign.Document doc = app.ActiveDocument;

// get the first page
InDesign.Page page = (InDesign.Page) doc.Pages[1]; //1e pagina

// get the first textframe
InDesign.TextFrame frame = (InDesign.TextFrame) page.TextFrames[1];

// write contents of textframe

// set contents of textframe
frame.Contents = "Andere content";

To create an instance of the InDesign COM object, I use the following code snippet:

/// <span class="code-SummaryComment"><SUMMARY></span>
/// Creates a COM object given its ProgID.
/// <span class="code-SummaryComment"></SUMMARY></span>
/// <span class="code-SummaryComment"><param name="sProgID">The ProgID to create</param></span>
/// <span class="code-SummaryComment"><RETURNS>The newly created object, or null on failure.</RETURNS></span>
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;


  • 9th November, 2005: First publication


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


About the Author

Web Developer
Netherlands Netherlands
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralGreat topic Pin
inwi23-Nov-09 15:27
memberinwi23-Nov-09 15:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 9 Nov 2005
Article Copyright 2005 by elmer_torensma
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid