• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to set TIFF Option dialog's attributes value.............

Engaged ,
Jun 19, 2017 Jun 19, 2017

Copy link to clipboard

Copied

Hello Friends,

I am exporting a file as a TIFF file by using this code

AIDictionaryRef abc = NULL;

  const char *fileFormatName = "TIFF";

  err = sAIDocument->WriteDocumentWithOptions(parent_dir, fileFormatName, kFileFormatExport | kFileFormatWriteAs | kFileFormatWrite, NULL, false);

It's exporting properly.

During export it's shows a TIFF Option dialog like this

How to set the this Resolution value without opening this dialog .

What is the code for this.

Please guide me.

Regards

Kundan

TOPICS
SDK

Views

477

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Beginner ,
Sep 22, 2020 Sep 22, 2020

Copy link to clipboard

Copied

LATEST

A little late but better than never, here's how I solved it for our use case. When creating the parameter dictionary for RasterExport(...), we're not given a resolution key to pass in (I'd assume it would be in AITIFFKeys.h with the others but it is not). So, it relies on the resolution you set in the Rasterize(...) step.

 

// If you look at the comments in AIRasterExport.h for RasterExport(...)
	// you'll see that the AIArtHandle doesn't have to be rasterized and that
	// the API will do that for you. Yeah, from what I can see, that's a lie.
	//
	// We'll need to create an ArtSet of the selected art and then
	// rasterize it on the temporary document we create. Rasterize(...) buffers
	// out the rasterization to a new AIArtHandle which we'll use for RasterExport(...)

	AIArtSet artSet;
	sAIArtSet->NewArtSet(&artSet);
	sAIArtSet->SelectedArtSet(artSet);

	AIRealRect rect;
	sAIRasterize->ComputeArtBounds(artSet, &rect, false);
	
	AIColorConvertOptions colorConvertOptions;
	colorConvertOptions.purpose = AIColorConvertOptions::kDefault;

	AIRasterizeSettings settings;
	settings.type = kRasterizeRGB;
	settings.resolution = 96;
	settings.antialiasing = kAIAntialiasNone;
	settings.options = kRasterizeOptionsNone;
	settings.ccoptions = colorConvertOptions;
	settings.preserveSpotColors = true;

	AIArtHandle rasterHandle;

	AIErr error = sAIRasterize->Rasterize(
		artSet,
		&settings,
		&rect,
		AIPaintOrder::kPlaceDefault,
		0,
		&rasterHandle,
		NULL
	);

	// When you manually export as Tif in AI, you'll get a dialog that asks
	// for resolution and other options. AFAIK, we'll have to use the resolution set
	// in the rasterization above since the RasterExport options don't include or expose
	// a key for setting the resolution.

	AIDictionaryRef dict;
	sAIDictionary->CreateDictionary(&dict);
		
	sAIDictionary->SetBooleanEntry(dict, sAIDictionary->Key(kAITIFFLZWCompressionOption), true);
	sAIDictionary->SetIntegerEntry(dict, sAIDictionary->Key(kAITIFFAntiAliasOption), kAIAntialiasNone);
	sAIDictionary->SetIntegerEntry(dict, sAIDictionary->Key(kAITIFFColorModelOption), kAIRGBColorModel);
			
	error =  sAIRasterExport->RasterExport(rasterHandle, filePath, kAIFormatTIFF, dict);

	sAIDictionary->Release(dict);

 

 If you need to export everything on the page, you could do this before creating the ArtSet:

 

sAIActionManager->PlayActionEvent(kAISelectAllAction, kDialogOff, NULL);

 

Hope this helps the next guy.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines