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

[JS CS3/CS4] Making embedded graphic "inline"

Guest
Jun 22, 2009 Jun 22, 2009

Hi,

I want to take a graphic that is in a separate (labeled) graphic frame and move it within some text as an anchored object.

I can do this easily by geting the link from the image and placing it at my insertion point.

var myImage = app.documents[0].pageItems.item("photo1").images[0];
myInsertionPoint.place(myImage.itemLink.filePath);

BUT how do I do this if my original graphic is embedded and the linked file no longer available?

Do I have to unembed thegraphic to a temporary location, use my script above and then embed and remove the original or is there a simpler way?

I expect to be told that I shouldn't be embedding graphics but this what I have to work with.

Thanks

Simon Kemp.

TOPICS
Scripting
699
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
LEGEND ,
Jun 22, 2009 Jun 22, 2009

You can export it as a snippet, or library asset.

Harbs

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
Guest
Jun 22, 2009 Jun 22, 2009

OK, that approach makes sense, thanks.

However, I cannot find any method for exporting snippets in the ESTK Object Model Viewer or if I search this forum.

Is this obvious or can you give me an example.

Thanks

Simon.

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
Mentor ,
May 28, 2010 May 28, 2010
LATEST

I just had a similar problem.

I have no idea whether my solution works in CS3.

( function() {

     var doc = app.activeDocument;

     // the image page item

     var r = doc.rectangles.item(0);

     // the destination textframe to hold the inline

     var tf = doc.textFrames.item(0);

     // it should already be tagged.

     // create a nested, blank tag

     var xe = tf.associatedXMLElement.xmlElements.add("bla");

     // copy the rect as inline

     xe.placeIntoInlineCopy(r,true);

} )();

Dirk

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