Skip to main content
M.Hasanin
Inspiring
June 15, 2020
Answered

Can i Make user Select JPG Setting from the Origianl InDesign JPG Setting Dialog

  • June 15, 2020
  • 3 replies
  • 668 views
//set properties for export to your needs
 with(app.jpegExportPreferences){ 
antiAlias = true; 
embedColorProfile = false; 
exportResolution = 300; 
jpegColorSpace = JpegColorSpaceEnum.RGB; //JpegColorSpaceEnum.CMYK, JpegColorSpaceEnum.GRAY     r/w    One of RGB, CMYK or Gray 
jpegQuality = JPEGOptionsQuality.HIGH; //JPEGOptionsQuality.LOW, JPEGOptionsQuality.MEDIUM, JPEGOptionsQuality.HIGH, JPEGOptionsQuality.MAXIMUM     r/w    The compression quality. 
jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING; // JPEGOptionsFormat.PROGRESSIVE_ENCODING     r/w    The rendering style. 
simulateOverprint = true; 
} 

I wrote a code for JPG setting but can i make the user to use the original Export JPG Shipped with InDesign? How to Do  that ? Thanks in Advance ?

This topic has been closed for replies.
Correct answer Peter Kahrel

The answer is No, you can't let the user use InDesign's export window. That goes for all windows, not just JPEG export window. You have two options: (1) write a script that recreates InDesign's JPEG export window and (2) let the user create a small text file with the required data, which your script interprets.

 

Option (1) is easy on the user, hard on you. Option (2) is easy on you, a little bit harder on the user.

 

P.

3 replies

Community Expert
June 16, 2020

Hi medos20,

it's a question of design. No need to invoke the same export function for all files you want to export.

Just do the first with user intervention for setting the export preferences, then do the rest of the exports in a different process. As already explained: InDesign will use the settings the user had defined the last time.

 

Regards,
Uwe Laubender

( ACP )

 

Community Expert
June 15, 2020

Hi medos20,

no need to do your own UI.

You can use InDesign's own dialog.

 

There is the argument showingOptions for this in the exportFile method.

Or in method asynchronousExportFile if you prefer this. See into DOM documentation for both methods:

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Rectangle.html#d1e217191__d1e220251

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Rectangle.html#d1e217191__d1e219241

 

Example: If you want to export a selected rectangle on the page of a saved document you could do this:

var doc = app.documents[0];
var newJPEGfile = File( doc.fullName.toString().replace(/\.indd/i, "-"+Date.now()+".jpg" ) );

app.selection[0].exportFile
(
	ExportFormat.JPG ,
	newJPEGfile ,
	true
);

 

Regards,
Uwe Laubender

( ACP )

 

 

M.Hasanin
M.HasaninAuthor
Inspiring
June 15, 2020

Thank you very much , The problem that i want to export punch of files, so if i use this method indesign insist that i have to enter setting for each file!, Thanks a lot

Mohammad Hasanin
Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
June 16, 2020

The answer is No, you can't let the user use InDesign's export window. That goes for all windows, not just JPEG export window. You have two options: (1) write a script that recreates InDesign's JPEG export window and (2) let the user create a small text file with the required data, which your script interprets.

 

Option (1) is easy on the user, hard on you. Option (2) is easy on you, a little bit harder on the user.

 

P.

Community Expert
June 15, 2020

Hi medos20,

if you do not define anything with jpegExportPreferences the export will use the preferences exactly like the user left them. So principally you need nothing to do code side.

 

However, if you want to restore settings you first have to save them to a variable. For that you can use the properties property of the jpegExportPreferences like that:

 

// Fetch the current values:
var userJpegExportPreferences = app.jpegExportPreferences.properties ;

// Set the new values:
app.jpegExportPreferences.properties =
{
	antiAlias : true ,
	embedColorProfile : false ,
	exportResolution : 300 ,
	jpegQuality : JPEGOptionsQuality.HIGH ,
	jpegRenderingStyle  : JPEGOptionsFormat.BASELINE_ENCODING ,
	simulateOverprint : true
};

/*
	Do your JPEG export here.
	... 
	
*/

// Restore the old values:
app.jpegExportPreferences.properties = userJpegExportPreferences ;

 

Regards,
Uwe Laubender

( ACP )

 

 

M.Hasanin
M.HasaninAuthor
Inspiring
June 15, 2020

Thank you very much but i want the user to select the settings from dialog so the script will work dynamically.. i think i have to build custom dialog and connect variables. any way thank you very much for your reply

Mohammad Hasanin