Is any way to find image which is overflow in document editor and set custom size to fit image witin page width

Is any way to find image which is overflow in document editor and set custom size to fit image within page width.
we are facing one issue large size image in not fitting into table width, is nay way to select image i found to set custom width and height 

Image in Angular Document editor component | Syncfusion


5 Replies

SS Sujitha Siva Syncfusion Team September 19, 2025 06:57 AM UTC

Hi Ramkumar More,


Apologies for the delay, In the Document Editor, you can resize the selected image to a custom width and height using the following API:

this.container.documentEditor.selection.imageFormat.resize(width, height)

However, currently there is no built-in support to programmatically detect and select if an image is overflowing beyond the page width. 

Please let us know if you have any questions.


Regards,

Sujitha S



YR Young Richardson September 29, 2025 04:39 AM UTC

You can handle this by checking the image width when it’s inserted. If it exceeds the editor’s page width, programmatically set the width to match editor.pageWidth - editor.defaultMargins. You may also use DocumentEditor.selection.imageFormat.width/height to adjust the size dynamically. Have you tried applying these properties on image insert events?




YR Young Richardson September 29, 2025 04:40 AM UTC

One option is to loop through the images in the document and compare their size against the page width. If an image is larger, you can reset its width and height proportionally to fit within the page. Using imageFormat.width and imageFormat.height is usually enough for this. Do you need a code sample for iterating all images automatically?


https://www.syncfusion.com/forums/197491/is-any-way-to-find-image-which-is-overflow-in-document-editor-and-set-custom-size-to-fit?reply=z2jclb  slope



SS Sujitha Siva Syncfusion Team September 30, 2025 07:13 PM UTC

Hi Young Richardson,

We are currently reviewing your query based on the information provided. We will get back to you with further updates on October 01,2025.

Regards,

Sujitha S




SS Sujitha Siva Syncfusion Team October 1, 2025 08:41 AM UTC

Hi Young Richardson,

Currently, Document Editor does not programmatically retrieve all images from the document for resizing. To ensure that an image fits within a table cell and the page width when inserting it programmatically, you can retrieve the cellPreferredWidth and pageWidth from the current selection and adjust the image width accordingly before inserting the image.

 

Alternatively, you can resize the image after the table has been resized by selecting the image and applying the width. We’ve attached a video for your reference and shared a StackBlitz sample to demonstrate this approach.

Sample: Ijyum1j4 (duplicated) - StackBlitz

 

Please let us know if you require further assistance


Regards,

Sujitha S


Attachment: Fit_Image_925c8c30.zip

Loader.
Up arrow icon