- Home
- Forum
- Angular - EJ 2
- 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 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
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
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?
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
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
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
- 5 Replies
- 3 Participants
-
RM Ramkumar More
- Sep 17, 2025 09:40 AM UTC
- Oct 1, 2025 08:41 AM UTC