Using the SDK to change a frame's contents from Text to Image

Contributor ,
Jul 21, 2022 Jul 21, 2022

Copy link to clipboard

Copied

Hello,

In our plugin we sometimes need to change a text frame to an image frame.

Currently, using the SDK, we save the text frame's size, position, and the layer on which it is, and the create an picture frame of the same size, position and on the same layer (and then delete the text frame). This works, but limits us to transparent rectangular picture frames.

Is there a way, using the SDK, to change a text frame's contents from text to picture ?

We are able to do it for an empty text frame, but as soon as the text frame has had any text in it, it becomes impossible to change it to a picture frame.

Very best regards,

Olivier

TOPICS
How to , SDK

Views

89

Likes

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

Guide , Jul 23, 2022 Jul 23, 2022

You can load the place gun via ImportAndLoadPlaceGun, pick up the item via GetFirstPlaceGunItemUID. Both the image (source) and the existing spline item (target) have an IPlaceBehavior, use the source's ProcessPlace(). If the spline already has an image, use the target's ProcessReplace() instead.

Likes

Translate

Translate
Adobe Community Professional ,
Jul 21, 2022 Jul 21, 2022

Copy link to clipboard

Copied

@Olivier Beltrami said:
"We are able to do it for an empty text frame, but as soon as the text frame has had any text in it, it becomes impossible to change it to a picture frame."

 

Hi Olivier,

just a remark about this behavior: it follows exactly the behavior of the same function in the GUI.

If a text frame contains text the option to convert it to a graphic frame is grayed out.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

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 ,
Jul 22, 2022 Jul 22, 2022

Copy link to clipboard

Copied

Hi Uwe,

Thank you very much @Laubender .

I now clear the frame of existing text and my frames' content type is now modifiable in the UI.

However, I am not able to find any API call to import/place an image into an existing frame. All the ones I see, such as SDKLayoutHelper::PlaceFileInFrame() create a new frame. Is there an API call to place a graphic into an existing frame ?

Very best regards,

Olivier

Likes

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
Guide ,
Jul 23, 2022 Jul 23, 2022

Copy link to clipboard

Copied

You can load the place gun via ImportAndLoadPlaceGun, pick up the item via GetFirstPlaceGunItemUID. Both the image (source) and the existing spline item (target) have an IPlaceBehavior, use the source's ProcessPlace(). If the spline already has an image, use the target's ProcessReplace() instead.

Likes

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 ,
Jul 23, 2022 Jul 23, 2022

Copy link to clipboard

Copied

LATEST

Thank you very much.

We'll follow your suggestion.

Olivier

Likes

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