I am surprised this is so hard. No recipe in the docs seems to cover this. Here’s roughly 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]; // etc
The error alert says that the first argument to place
isn’t being supplied. This isn’t quite right, of course. There is an argument. The previous line is executing as expected. In the UXP console I can see that the file is being located in the file system. imageFile
is an ArrayBuffer
so it’s not that.
I’ve also tried using fs.openSync
but I get an alert saying that doesn’t exist. It doesn’t seem right, either, to pass an fd
into place
. How do I pass the file into place
?
Thanks in advance for any help. This is a dupe of Placing a graphic from the local file system in In... - Adobe Community - 14661606