Question
Problem Programmatically Placing Images with Placed or Raster Suites
We have some code that currently uses the Raster suite to place art. The code actually works but it seems to make Illustrator unstable. If you "undo" following the art placement, Illustrator crashes without any warning. The call that causes problems is "AIRaster->ResolveRasterLink". If this call is omitted, then "undo" does not crash the application. Of course, the image data isn't read either.
The latest version of the API docs (the HTML version not the PDF version) has the following comment on "AIRaster->SetRasterLink":
Direct linking of images is deprecated but still supported. All linked objects should be created using the AIPlacedSuite.
So I tried using the AIPlaced suite instead. Specifically, I used the "AIPlaced->ExecPlaceRequest" method. I would really like to use the kVanillaPlace value of "AIPlaceRequestData.m_lPlaceMode". This seems to half work but the ExecPlaceRequest method returns an error value and method calls with the m_hNewArt handle give an error in Illustrator about a pure virtual method call. I've also tried the kForceReplace and kQueryReplace modes but they don't work either. The kCreateNewArt mode seems to work but it doesn't read any data. It seems to just be a call to AIArt->NewArt.
Can anyone confirm or deny the behavior I'm seeing with either or both of AIRaster or AIPlaced? Does anyone have a workaround?
The latest version of the API docs (the HTML version not the PDF version) has the following comment on "AIRaster->SetRasterLink":
Direct linking of images is deprecated but still supported. All linked objects should be created using the AIPlacedSuite.
So I tried using the AIPlaced suite instead. Specifically, I used the "AIPlaced->ExecPlaceRequest" method. I would really like to use the kVanillaPlace value of "AIPlaceRequestData.m_lPlaceMode". This seems to half work but the ExecPlaceRequest method returns an error value and method calls with the m_hNewArt handle give an error in Illustrator about a pure virtual method call. I've also tried the kForceReplace and kQueryReplace modes but they don't work either. The kCreateNewArt mode seems to work but it doesn't read any data. It seems to just be a call to AIArt->NewArt.
Can anyone confirm or deny the behavior I'm seeing with either or both of AIRaster or AIPlaced? Does anyone have a workaround?