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

[JS]About image

New Here ,
Apr 02, 2008 Apr 02, 2008

Copy link to clipboard

Copied

Hello,

My name is avi.
I want to place an image in my document. I tried all the things but i am not able to do this.
I create a logo in Illustrator then i exported it to pdf.So i have my logo in pdf file.
I want to place that logo in a document with the geometricBounds = ["4p8", "10p4", "6p0", "21p4"]
I tried following script but it is not

var myImage = new Image();
myImage.geometricBounds = ["4p8", "10p4", "6p0", "21p4"];
myImage = Image.place(File("~/Desktop/Master/images/LOGO.pdf"),false);

Can anybody tell me what is wrong in above script.
If above script do not work please tell me the other way to place the image in an document.

I am using CS3,mac,javascript.

Thank you
TOPICS
Scripting

Views

552

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
Community Expert ,
Apr 03, 2008 Apr 03, 2008

Copy link to clipboard

Copied

You create a new image object, but you also need to use the add() method somewhere to add it to the document. But you can't add() images like that. Instead, add a rectangle (as a container for the image), then place the image in it. Something like this:

r = app.activeDocument.pages[0].rectangles.add();
r.geometricBounds = ["4p8", "10p4", "6p0", "21p4"];
r.place (File ("~/Desktop/Master/images/LOGO.pdf"), false);

Peter

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
New Here ,
Apr 03, 2008 Apr 03, 2008

Copy link to clipboard

Copied

Hello peter

when i am trying your script. i am getting a black rectangular box. I am not getting any logo on my document. In my opinion it is taking default background color as black.

To solve this problem i tried to make second parameter of place as true
r.place (File ("~/Desktop/Master/images/LOGO.pdf"), true);
If you make true in place of false it will ask you option when you run the script. In that option transparent background is checked. I do not know why he is taking black as backgroung color. Please help me.

Thank you

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
Community Expert ,
Apr 03, 2008 Apr 03, 2008

Copy link to clipboard

Copied

Have a loom at the pdfPlacePreference properties. I've never used them, but it looks as if that's what you need.

Peter

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
New Here ,
Apr 03, 2008 Apr 03, 2008

Copy link to clipboard

Copied

Where should i use pdfPlacePreference. I did not get what do you want to say.
Can you help me to write the script for this. I trying for last two day and did not come with good way to solve the problem.

Thank you

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
Community Expert ,
Apr 03, 2008 Apr 03, 2008

Copy link to clipboard

Copied

LATEST
A bit of rummaging around in the OMV (or any equivalent) shows that pdfPlacePreferences is a property of the application. Add therefore this line to your script:

app.pdfPlacePreferences.transparentBackground = true;

Peter

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