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

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

Engaged ,
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

269

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.

Votes

Translate

Translate
Community Expert ,
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 )

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
Engaged ,
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

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
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.

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

Copy link to clipboard

Copied

Thank you very much.

We'll follow your suggestion.

Olivier

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
Explorer ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

LATEST

 

Hi Olivier,

 

I am trying to implement setting endnote programatically, I am inserting endnote with following options

 

        iEndnoteSettings->SetScope(IEndnoteSettings::Scope::kStory);

        iEndnoteSettings->SetPlace(IEndnoteSettings::Place::kPlacegun);

 

So I have IPlaceBehavior for source, I want to add/place this on same Page at bottom as new item but not able to understand how to user ProcessPlace()

 

Can you please explain how to do this, it will be helpful if you can share your code snippet for ProcessPlace

 

I have also posted question on forum for this you can reply there also

 

https://community.adobe.com/t5/indesign-discussions/inserting-endnote-in-indesign-document-programat...

 

Thanks!!

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