find if an opened InDesign document is for print or web

Apr 13, 2020

Copy link to clipboard

Copied

I have the UIDRef of an opened InDesign document, I would like to know if the document is a print or web document. How can use the Getintent() to do that? or is there another way to get this information.

 

Thank you in advance,

Joe

TOPICS
SDK

Views

113

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

find if an opened InDesign document is for print or web

Apr 13, 2020

Copy link to clipboard

Copied

I have the UIDRef of an opened InDesign document, I would like to know if the document is a print or web document. How can use the Getintent() to do that? or is there another way to get this information.

 

Thank you in advance,

Joe

TOPICS
SDK

Views

114

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 13, 2020 0
Apr 13, 2020

Copy link to clipboard

Copied

There is an intent property in document preferences, which returns a number.

1768846448=Print

1768846445=Mobile

1768846455=Web

 

var di = app.documents.item(0).documentPreferences.intent;

if (di == 1768846448) {
	$.writeln("Document intent is set to Print")
}else{
    $.writeln("Document intent is set to Mobile or Web")
}

 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 13, 2020 0
Apr 20, 2020

Copy link to clipboard

Copied

Thank you Rob for your suggestions. I wrote the code below, do you see any issues with it?

 
        InterfacePtr<IPageSetupPrefs> iPageSetupPrefs(static_cast<IPageSetupPrefs *>(::QueryPreferences(IID_              IPAGEPREFERENCES, documentRef)));
 
if (iPageSetupPrefs == nil) {
ASSERT(iPageSetupPrefs);
return false;
}
 
DocumentIntent docIntent = iPageSetupPrefs->GetIntent();

if (docIntent == kPrintIntent) 
     return true;
else
     return false;

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 20, 2020 0