Indesign export pages to JPEG using export for web

I am trying to export each page of an indesign file to jpeg. I have accomplished this by running a loop using the pageCount for the document and setting the “export range” for the JPEGExportPreferences to that page I am trying to export.

Code:


	set y to 1
	
	repeat with x from 1 to PageCount
		set this_page to (name of page x of myDocument) as integer
		
		if this_page < 10 then set page_string to "000" & (name of page x of myDocument)
		if this_page > 9 and this_page < 100 then set page_string to "00" & (name of page x of myDocument)
		if this_page > 99 and this_page < 1000 then set page_string to "0" & (name of page x of myDocument)
		if this_page > 999 then set page_string to (name of page x of myDocument)
		set filepath to (myFolder & page_string & ".jpg")
		--display dialog filepath
		
		set j to name of page x of myDocument
		set Page String of myJPEG_Prefs to (y as string)
		export document 1 format JPG to filepath without showing options
		
		--export for web page x of document 1 to filepath   [i]//Does not work. Probably need to be just getting the object, but I really need to flatten all objects in the page and export the page for web.[/i]

		
		set y to (y + 1)
		
	end repeat

Problem? I get a huge file because it is not compressing the tiff that is pulled into the page as a graphic in an object.
I need these pages exported using the “export for web” method. I cannot figure out the syntax for this. Any help would be greatly appreciated.

Hi,

before starting the export you have to set up the JPEG export preferences, see the properties here

True enough, and thanks for the response. I had set the export preferences


	--JPEG Preference Settings
	set myJPEG_Prefs to JPEG export preferences
	tell myJPEG_Prefs
		set resolution to 72
		set JPEG Quality to maximum
		set JPEG export range to export range
		set JPEG Rendering style to baseline encoding
	end tell

but I am really not interested in using the standard “export” I really want to use the “export for web” for which I have and know how to set the preferences. What I am having trouble with is the syntax for export for web.


	set myWebPeg_Prefs to export for web preferences
	tell myWebPeg_Prefs
		set JPEG options format to baseline encoding
		set JPEG options quality to high
	end tell

Hi,

I gues “export for web” is the xhtml-export for dreamweaver …

If the jpg-Export really doesn’t fit you’re needs, you could buildt a workflow which exports each site as pdf to a hotfolder → folderaction converts to jpg …

Have a sunny day :slight_smile:

Hans-Gerd Claßen