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

Document Info

Contributor ,
Nov 27, 2018 Nov 27, 2018

Copy link to clipboard

Copied

Hi,

     I am trying to read document info using javascript.  Can read path and text items but how can i found embedded items?

     Also how can get the properties of document info using javascript?

Thanks,

Sudha K

TOPICS
Scripting

Views

757

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

correct answers 1 Correct answer

Valorous Hero , Nov 27, 2018 Nov 27, 2018

If you have a document with one placed image, and another copy of the same placed image but you clicked the "Embed" button, the embedded image becomes what is called the "RasterItem".

Do this experiment with the two kinds of art mentioned above and run this snippet to see the "typename" property of those items.

#target illustrator

function test(){

    var doc = app.activeDocument;

    var thisItem;

    for(var i = 0; i < doc.pageItems.length; i++){

        thisItem = doc.pageItems;

        alert(thisIte

...

Votes

Translate

Translate
Adobe
Valorous Hero ,
Nov 27, 2018 Nov 27, 2018

Copy link to clipboard

Copied

If you have a document with one placed image, and another copy of the same placed image but you clicked the "Embed" button, the embedded image becomes what is called the "RasterItem".

Do this experiment with the two kinds of art mentioned above and run this snippet to see the "typename" property of those items.

#target illustrator

function test(){

    var doc = app.activeDocument;

    var thisItem;

    for(var i = 0; i < doc.pageItems.length; i++){

        thisItem = doc.pageItems;

        alert(thisItem.typename);

    };

};

test();

As you will see, your placed item will be called "PlacedItem" and your embedded one will be called "RasterItem".

Does this help you on the right track?

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
Contributor ,
Nov 28, 2018 Nov 28, 2018

Copy link to clipboard

Copied

Hi,

     Thank you...

     Yes, its showing as you said.... I have placed same image as you said. Embedded images are returning as type "RasterItem" and other one is returning "PlacedItem" how?. Both are same kind of images only know..

     All embedded images are Raster items?  What i am assuming is all non-editable files (ie., photos) are raster images is it right?

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
Valorous Hero ,
Nov 28, 2018 Nov 28, 2018

Copy link to clipboard

Copied

Yes, when you embed a PlacedItem, it turns into a RasterItem - in the Illustrator's UI you can visually see the difference when the "X" that goes through the placed image disappears once the Embed button is clicked.

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
Contributor ,
Nov 28, 2018 Nov 28, 2018

Copy link to clipboard

Copied

Ok... Thank you...

All non editable images are raster art?

How can i get the other info of document info details? clipping mast objects and other information...

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
Contributor ,
Nov 28, 2018 Nov 28, 2018

Copy link to clipboard

Copied

I can found the clipping art using the below syntax.

    if(pathItem.clipping == ture)

         alert("Clipped object")

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
Contributor ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

LATEST

Hi you can collect all information of all items using the pageItems[] to return .typename like this:

#target illustrator

#targetengine main

var allItems = app.activeDocument.pageItems;

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

    alert(allItems.typename);

};

Try...

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