Monday, December 29, 2003

Adobe Illustrator 10 SDK - Jpeg export of the page

How to actually do a Jpeg export.

After having found out which is the correct format name you could use this piece of code:

 

AIErr   error   = kNoErr;
AIActionParamValueRef valueParameterBlock = NULL;
ActionDialogStatus dialogStatus  = kDialogOff;
TCHAR   pszPath[255];
   
error = sAIActionManager->AINewActionParamValue(&valueParameterBlock);
ASSERT(!error );
ASSERT(valueParameterBlock);

error = sAIActionManager->AIActionSetString(valueParameterBlock, kAIExportDocumentNameKey, W2A(pszPath));
ASSERT(!error);

const char* szJPEGFileFormat = "JPEG file format";
error = sAIActionManager->AIActionSetString(valueParameterBlock, kAIExportDocumentFormatKey, szJPEGFileFormat);
ASSERT(!error);
error = sAIActionManager->AIActionSetString(valueParameterBlock, kAIExportDocumentExtensionKey, "jpg");
ASSERT(!error);

error = sAIActionManager->PlayActionEvent( kAIExportDocumentAction, dialogStatus, valueParameterBlock );
ASSERT(!error);

 

 

No comments: