Copy link to clipboard
Copied
In Adobe Illustrator, is there a way to check the Overprint Preview status (it looks like Overprint Preview is a property of the document) through a script? I have tried catching an error if I try to re-enable it, however that does not work.
try {
app.executeMenuCommand('ink');
alert("on");
} catch (e) {
alert("already enabled");
}
Copy link to clipboard
Copied
For example, it may be possible to determine this by examining the Window title using AppleScript. When overprint preview is used, the title will include that. It would be a good idea to use ends with it as a criterion, in case the document name includes it.
Not sure if it works correctly in an English environment since the actual environment I tested it in is in another language, but it was successful anyway.
on run
set is_overprint_preview to false
tell application "System Events"
tell application process "Adobe Illustrator"
set window_title to title of window 1
if window_title ends with "Overprint Preview) " then
set is_overprint_preview to true
end if
end tell
end tell
return is_overprint_preview
end run
Copy link to clipboard
Copied
@sttk3 When you say the Window title you obviously mean a document window title? When I get the window title in JavaScript it does not include info about overprint preview.
app.activeDocument.name //test.ai
Copy link to clipboard
Copied
I didn't know this until just now, but there is a function that returns the current view mode. This solves the problem.
/**
* @File Returns whether or not overprint preview now
* https://community.adobe.com/t5/illustrator-discussions/how-do-i-check-in-a-script-that-overprint-preview-has-already-been-enabled/td-p/15098023
* @Version 1.0.0
* @author sttk3.com
*/
(function() {
if(app.documents.length <= 0) {return ;}
var doc = app.documents[0] ;
alert(isOverprintPreview(doc)) ;
})() ;
/**
* Returns whether or not overprint preview now
* @Param {Document} doc target document
* @Returns {boolean}
*/
function isOverprintPreview(doc) {
return (doc.getViewMode() === 'OverprintPreview') ;
}
Copy link to clipboard
Copied
What version of Illustrator will getViewMode() work with ? I didn't find any info about getViewMode function.
Copy link to clipboard
Copied
Tried it and it seems to be usable from Illustrator 2023.
Copy link to clipboard
Copied
I checked the pdf documents ADOBE ILLUSTRATOR SCRIPTING REFERENCE: JAVASCRIPT and only the latest versions 2023, 2024, 2025 contain information about getViewMode()
Find more inspiration, events, and resources on the new Adobe Community
Explore Now