No zoomToFitWidth functionality on resize

If a zoomToFitWidth configured annotation widget is resized (e.g. parent iframe resize) it will not fit the document to the new width.

If I click on the “Fit width” button in the toolbar after a resize the document keeps it’s old width.

If I call $("#annotation-widget").groupdocsAnnotation(“setWidth”, newWidth); on a window resize event the FitWidth works when I click the FitWidth button.



There seems to be no way to retrigger a “zoomToFitWidth” after a resize. There is only a “zoomIn”, “zoomOut” and “setZoom” parameter in JavaScript.



Is there a way to ensure the FitWidth functionality on resize?

If not, there should be one! :slight_smile:

Hello,


Thank you for your request. We have tried to reproduce the issue with such widget code:
<%= new WidgetFactory()
.Annotation()
.AccessRights(Groupdocs.Common.AnnotationReviewerRights.All)
.ElementId(“annotation-widget”)
.FilePath(“Quick_Start_Guide_To_Using_GroupDocs.pdf”)
.ZoomToFitWidth(true)
.ToHtmlString() %>
and all work well. The document initially zoomed to fit width and then if to change the zoom level and click “Fit width” button in the toolbar the document re-sized correctly.

Could you please share with us your widget code and JavaScript code which you use that we can check it on our side.

Thank you.

Hello,



the annotation widget is embedded in an IFrame and instantiated with this code:

new WidgetFactory()

.Annotation()

.ElementId(“annotation-widget”)

.HighlightColor(0xfff600)

.StrikeOutColor(0xFF0000)

.EnableTextSelection(true)

.EnableTooltips(true)

.ShowPaging(false)

.ShowThumbnails(false)

.ZoomToFitWidth(true)

.EnableUndo(false)

.ShowFileExplorer(false)

.ShowToolbar(false)

.ClickableAnnotations(false)

.AccessRights(AnnotationReviewerRights.CanView | AnnotationReviewerRights.CanDownload | AnnotationReviewerRights.CanExport);



If the IFrame is resized, the GroupDocs-Wrapper (class=groupdocs_viewer_wrapper in DOM) fits that size, but not the content (class=inner doc_viewer in DOM). The content keeps it’s old size and adds scrollbars or stays shrinked (not full width).



That’s the issue I have with version 1.9.0.

Hello,


This happens because of using iframe - the iframe content is an another web page and you can’t manipulate with it from the web page on which you have iframe. The only work around for it is to use ajax instead of iframe. The ajax request will get Annotation code (which generated by the widget) and then embed it in to your web page.

If you need more help with it please let me know.

Best regards.

Hello Pavel,



sure I can. The annotation-widget is a div inside the IFrame (not called by src url) and I have a onResize event on the iframe window object (inside the iframe).

The Iframe has an absolute width that is changed by code outside the iframe (this will change the annotation-widget wrapper size, too).



But the real problem still is, that GroupDocs.Annotation 1.9.0 content will not auto fitWidth on an annotation-widget (wrapper) resize.

The content keeps it’s old width (with scrollbars added).



That’s bad. Is there a way around?

Hi again,


Could you please share with me the project example or at least full code of the web page that I can reproduce the same workflow on ,y local and then I will be able to look for some workaround for you.

Thank you.

Hi,



that’s not necessary. Just use the current “GroupDocs.Demo.Annotation.Webforms” Projekt of the “GroupDocs.Annotation_2.1.0-NET-Examples.zip” examples.



Remove “.Width(600).Height(800)” from the widget and you will see that the content width will not fit, if you click “Fit width” after a browser resize.

The widget content keeps its initial width and gets scrollbars on smaller browser window and will only fit width to the initial width - not the current changed one.

Hi,


Thank you for coming back. Yes, know I was able to reproduce the issue. I have created a bug ticket for it and our Product team will resolve it.

Best regards.