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

Can't rasterize object with hole inside

New Here ,
Sep 08, 2014 Sep 08, 2014

Hello everyone.

I've used thisone part of script for rastering objects.

var docPathItems = app.activeDocument.pathItems;

var myDoc = app.activeDocument;

// If a docuement is open

if ( app.documents.length > 0 )

{

  for ( var i=0; i < docPathItems.length ; i++ )

  {

  if (docPathItems.filled == true)

  {

  var rasterizeOptions = new RasterizeOptions;

  rasterizeOptions.antiAliasingMethod = AntiAliasingMethod.ARTOPTIMIZED;

  rasterizeOptions.backgroundBlack = false;

  rasterizeOptions.clippingMask = true;

  //rasterizeOptions.colorModel = RasterizationColorModel.GRAYSCALE;

  rasterizeOptions.convertSpotColors = false;

  rasterizeOptions.convertTextToOutlines = false;

  rasterizeOptions.includeLayers = false;

  rasterizeOptions.padding = 0;

  rasterizeOptions.resolution = 300;

  rasterizeOptions.transparency = true;

  myDoc.rasterize(docPathItems, docPathItems.controlBounds,rasterizeOptions);

  }

  }

}

If object dont have hole inside (for example picture). It work ok.

Screenshot_2.png

BUT if its hole inside (for example picture) - I have error.

Screenshot_3.png

So.. error 

Screenshot_4.png

Screenshot_5.png

Who know what does it mean???

TOPICS
Scripting
495
Translate
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
Valorous Hero ,
Sep 09, 2014 Sep 09, 2014

Is that because it's a Compound Path and doing just one part of it will give an error?  If so, you'd need to do rasterize for the compoundPathItems of the doc 1st, then repeat with the pathItems second.

Translate
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
New Here ,
Sep 24, 2014 Sep 24, 2014

Thank u for answer,

So, How can i find only compundPathItems in cycle?

Translate
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
New Here ,
Sep 24, 2014 Sep 24, 2014
LATEST

Thank u one more time.

I've found how to find only compoundPath objects.

If someone have the same problem, there is code of my decision

var docPathItems = app.activeDocument.pathItems;

var docCompPathItems = app.activeDocument.compoundPathItems;

var myDoc = app.activeDocument;

// If a docuement is open

if ( app.documents.length > 0 )

{

  for ( var i=0; i < docCompPathItems.length ; i++ )

  {

  var rasterizeOptions = new RasterizeOptions;

  rasterizeOptions.padding = 0;

  rasterizeOptions.resolution = 300;

  rasterizeOptions.transparency = true;

  myDoc.rasterize(docCompPathItems, docCompPathItems.controlBounds,rasterizeOptions);

  }

}

Translate
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