Monday, December 29, 2003

Adobe Illustrator 10 SDK beauties

How to find out which is the name of a particular file format.

You have to acquire the sAIFileFormat suite and then do something like this:

 

 if( sAIFileFormat )
 {
  long count = 0;
  AIErr er = sAIFileFormat->CountFileFormats(&count);
  if( !er )
  {
   for(long i = 0; i < count; i++)
   {
    AIFileFormatHandle fh = NULL;
    er = sAIFileFormat->GetNthFileFormat(i, &fh);
    if( !er )
    {
     char szName[255];

     ZeroMemory(&szName, 255);
     er = sAIFileFormat->GetFileFormatExtension(fh, szName);
     if( !er )
     {
      OutputDebugStringA(szName);
      OutputDebugStringA("\n");
     }
     if( strcmp(szName, "jpg") == 0 )
     {
      char* szNames = NULL;

      er = sAIFileFormat->GetFileFormatName(fh, &szNames);
      if( !er )
      {
       OutputDebugStringA(szNames);
       OutputDebugStringA("\n");
      }
     }
    }
   }
  }
 }

in this case I was interested in the jpeg file format (extension jpg).

 

No comments: