0
[JS]About image
New Here
,
/t5/indesign-discussions/js-about-image/td-p/1148029
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/indesign-discussions/js-about-image/m-p/1148030#M339247
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
r = app.activeDocument.pages[0].rectangles.add();
r.geometricBounds = ["4p8", "10p4", "6p0", "21p4"];
r.place (File ("~/Desktop/Master/images/LOGO.pdf"), false);
Peter
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Avi_
AUTHOR
New Here
,
/t5/indesign-discussions/js-about-image/m-p/1148031#M339248
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/indesign-discussions/js-about-image/m-p/1148032#M339249
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
Peter
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Avi_
AUTHOR
New Here
,
/t5/indesign-discussions/js-about-image/m-p/1148033#M339250
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/indesign-discussions/js-about-image/m-p/1148034#M339251
Apr 03, 2008
Apr 03, 2008
Copy link to clipboard
Copied
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
app.pdfPlacePreferences.transparentBackground = true;
Peter
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

