0% found this document useful (0 votes)
37 views1 page

Solutions 9

This document discusses several ways to access an IDocument interface in InDesign, including: 1. Getting the document associated with a database by calling IDataBase::GetRootUID. 2. Getting the document associated with an IActiveContext by calling IActiveContext::GetContextDocument. 3. Getting the front document by calling ILayoutUIUtils::GetFrontDocument. It also provides an overview of how to create a new document by calling IDocumentCommands::CreateNewCommand and populating the INewDocCmdData command data.

Uploaded by

Charana Studios
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

Solutions 9

This document discusses several ways to access an IDocument interface in InDesign, including: 1. Getting the document associated with a database by calling IDataBase::GetRootUID. 2. Getting the document associated with an IActiveContext by calling IActiveContext::GetContextDocument. 3. Getting the front document by calling ILayoutUIUtils::GetFrontDocument. It also provides an overview of how to create a new document by calling IDocumentCommands::CreateNewCommand and populating the INewDocCmdData command data.

Uploaded by

Charana Studios
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CHAPTER 1: Layout Documents 9

To iterate through documents, use IDocumentList to list the documents that are open in the application.
See “Iterating through documents”.

If you have an IDataBase pointer, call IDataBase::GetRootUID. The document associated with a database (if
any) can be discovered using code like the following:
InterfacePtr<IDocument> document(db, db->GetRootUID(), UseDefaultIID());

if (document != nil) // use the document interface

If you have a UIDRef:

1. Call UIDRef::GetDataBase to discover the IDataBase pointer.

2. Use the pointer to acquire the document as described above.

If you have an interface pointer for any interface on a UID-based object (for example, an IHierarchy
interface):

1. Call the PersistUtils function ::GetDataBase to discover the IDataBase pointer.

2. Use the pointer to acquire the document as described above.

If you have an IActiveContext interface, call IActiveContext::GetContextDocument. The document


associated with this context (if any) can be found using code like the following:
IDocument* document = activeContext->GetContextDocument();
if (document != nil) // use the document interface

If you have a layout view, call ILayoutControlData::GetDocument. For details, in the “Layout Fundamentals”
chapter of Adobe InDesign Programming Guide, see “The Layout Window and View” section. This call often
is used by trackers (ITracker).

To work with the document the user is editing, call ILayoutUIUtils::GetFrontDocument.

Related API

IDocument

Creating a document
Creating a document with a setup of your own choice

You can create a document and specify the number of pages, page size, and so on that the new document
should have.

Solution

1. To create the command, call IDocumentCommands::CreateNewCommand.

2. Populate the command’s INewDocCmdData data interface to describe the desired set-up.

3. Process the command.

Sample Code

 SDKLayoutHelper::CreateDocument

You might also like