Copy link to clipboard
Copied
I am surprised this is so hard. No recipe in the docs seems to cover this. Here's what I am trying to do:
const imageFrame = targetPage.rectangles.add();
const imageFile = fs.readFileSync(`${DATA_FOLDER_PATH}/${imageFileName}`);
const placedImage = imageFrame.place(imageFile);
imageFrame.geometricBounds = [yStart, xStart, yEnd, xEnd];
The error alert says that the first argument to place isn't being supplied. This isn't quite right, of course. In the console I can see that the file is being located in the file system. `imageFile` is an `ArrayBuffer` so it's not that. How do I pass the File into `place`?
Thanks in advance for any help.
Copy link to clipboard
Copied
I don't have an answer for this, just wanted to mention that for UXP questions you may also want to join these forums:
Copy link to clipboard
Copied
Hi @B3NJ_M_N ,
I would test method place() with a simple JPEG file.
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
I'm not JS expert, but why do you have quotes around:
const imageFile = fs.readFileSync(`${DATA_FOLDER_PATH}/${imageFileName}`);
Can you build this string as a variable and then pass this variable? So you can use alert() or something for debugging?
Copy link to clipboard
Copied
The answer was provided here:
https://forums.creativeclouddeveloper.com/t/how-to-place-image-from-file-system-in-uxp-indesign-scri...