Click here to Skip to main content
15,113,024 members
Articles / Programming Languages / C#
Posted 9 Nov 2005


14 bookmarked

Accessing Adobe InDesign CS COM Objects from .NET

Rate me:
Please Sign up or sign in to vote.
3.00/5 (11 votes)
9 Nov 2005CPOL
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

Comments and Discussions

QuestionMuch simpler way to insert DB content into InDesign document Pin
Gabriel Glowacki9-Nov-19 6:12
professionalGabriel Glowacki9-Nov-19 6:12 
QuestionError de conversión Pin
Member 1415852418-Mar-19 6:15
MemberMember 1415852418-Mar-19 6:15 
Questionc# Indesign.pageitem? err Pin
adcny22-Aug-16 21:32
Memberadcny22-Aug-16 21:32 
QuestionWeb Application Pin
qadirv9-May-12 3:27
Memberqadirv9-May-12 3:27 
Questionhi Pin
dinakar9026-Mar-12 5:22
Memberdinakar9026-Mar-12 5:22 
Questionend of statement expected error Pin
dinakar9026-Mar-12 5:20
Memberdinakar9026-Mar-12 5:20 
Generalhi Pin
Hal201230-Nov-10 19:36
MemberHal201230-Nov-10 19:36 
Generalconverting indesign EPS file to indesign Pin
vidyas198215-Aug-10 23:39
Membervidyas198215-Aug-10 23:39 
GeneralFormatting text Pin
Christian Gad13-Jan-10 23:00
MemberChristian Gad13-Jan-10 23:00 
GeneralGreat topic Pin
inwi23-Nov-09 16:27
Memberinwi23-Nov-09 16:27 
GeneralThanks Pin
Gary Stafford7-Feb-07 16:00
MemberGary Stafford7-Feb-07 16:00 
QuestionC# and InDesign Pin
K. Zimny12-Sep-06 10:31
MemberK. Zimny12-Sep-06 10:31 
Hi Elmer,
I'm interesting to get more information about how to publish data from a database into InDesign.
I'm C# developer, but I don't have experiences with InDesign. Did you finish you project? Can you give me more details to such kind of interface? How can I publish data? Did you develop a plugin for that in C#? How did you pass the data from C# (Application??) into InDesign? Many Thanks.
AnswerRe: C# and InDesign Pin
elmer_torensma12-Sep-06 22:10
Memberelmer_torensma12-Sep-06 22:10 
GeneralRe: C# and InDesign Pin
pasaulis4-May-07 3:53
Memberpasaulis4-May-07 3:53 
GeneralRe: C# and InDesign Pin
amin_khan6-Oct-07 22:24
Memberamin_khan6-Oct-07 22:24 
QuestionRe: C# and InDesign Pin
Member 36519878-Dec-08 22:36
MemberMember 36519878-Dec-08 22:36 
AnswerRe: C# and InDesign Pin
Hal201230-Nov-10 20:15
MemberHal201230-Nov-10 20:15 

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.