PdfViewerEvents and Eventcallback issues with PDF Viewer

For the following, only PageChanged is invoked by PDF Viewer. DocumentLoaded is not invoked when the document loads and ZoomChanged is not invoked when the zoom is changed.

Snippet
<SfPdfViewerServer @ref="PdfViewer" Height="700px" Width="100%">
 
    <PdfViewerEvents DocumentLoaded="@DocumentLoaded" />
    <PdfViewerEvents ZoomChanged="@ZoomChangeEvent" />
    <PdfViewerEvents PageChanged="@PageChangeEvent" />
 
</SfPdfViewerServer>
 
@code {
 
    public void DocumentLoaded(LoadEventArgs value)
    {
        string name;
        name = value.DocumentName;
    }
 
    public void ZoomChangeEvent(ZoomChangeEventArgs value)
    {
        int zoom;
        zoom = value.CurrentZoomValue;
    }
 
    public void PageChangeEvent(PageChangeEventArgs value)
    {
        int page;
        page = value.CurrentPageNumber;
    }
 
}


For the following, ZoomChanged and PageChanged do not get invoked if the zoom or page are changed.

<SfPdfViewerServer @ref="PdfViewer" Height="700px" Width="100%"

                   ZoomValueChanged="@ZoomChanged" CurrentPageNumberChanged="@PageChanged">
 
</SfPdfViewerServer>
 
@code {
 
 
    public void ZoomChanged(int value)
    {
        int zoom;
        zoom = value;
    }
 
    public void PageChanged(int value)
    {
        int page;
        page = value;
    }
}

Please advise what needs to be done to get these to work.


9 Replies 1 reply marked as answer

SK Shamini Kiruba Sobers Syncfusion Team April 25, 2022 06:22 PM UTC

Hi Dennis,


We are checking your query to reproduce the reported issues. We will update the details on April 26, 2022.


Regards,

Shamini



SK Shamini Kiruba Sobers Syncfusion Team April 26, 2022 12:20 PM UTC

Hi Dennis,


Query

Response

For the following, only PageChanged is invoked by PDF Viewer. DocumentLoaded is not invoked when the document loads and ZoomChanged is not invoked when the zoom is changed.

We were able to reproduce the issue “DocumentLoaded and ZoomChanged events are not working in 20.x versions”. We will validate the issue and update further details on April 28, 2022.

For the following, ZoomChanged and PageChanged do not get invoked if the zoom or page are changed.

Instead of event callbacks, we suggest using the ZoomChanged and PageChanged events with which you can get the current zoom value (once when the above issue is resolved) and the current page number respectively.


Regards,

Shamini



SK Shamini Kiruba Sobers Syncfusion Team April 28, 2022 01:44 PM UTC

Hi Dennis,


We have improved the PDF Viewer component architecture from the 2022 Volume 1 release. So we need to invoke all the PDF Viewer events in a single tag. We suggest you invoke the multiple events in a single events tag instead of the multiple events tags. Please find the code snippet below.

Code snippet:

<PdfViewerEvents DocumentLoaded="@DocumentLoaded"  ZoomChanged="@ZoomChangeEvent" PageChanged="@PageChangeEvent" />


Regards,

Shamini



DM Dennis M April 29, 2022 05:17 AM UTC

Hi Shamini, 

Thanks for the fix. What is the version number for 2022 Volume 1 release?

Thanks,

Dennis



SK Shamini Kiruba Sobers Syncfusion Team May 2, 2022 05:39 AM UTC



DM Dennis M May 3, 2022 12:09 AM UTC

Hi Shamini,

Thanks for confirming. I think I may have misunderstood earlier that the issue was fixed in 2022 Volume 1. Based on the version number, I was already using a later version.

Am I correct to think understand the following issue has not been fixed yet?  DocumentLoaded and ZoomChanged events are not working in 20.x versions


Regards,

Dennis



SK Shamini Kiruba Sobers Syncfusion Team May 3, 2022 06:28 AM UTC

Hi Dennis,


As mentioned in our earlier update, we have improved the PDF Viewer component architecture from the 2022 Volume 1 release (i.e., 20.x versions). Hence, it is not an issue but the usage level change and we suggest invoking the multiple events in a single event tag instead of the multiple events tags as below to resolve the reported issue.


<PdfViewerEvents DocumentLoaded="@DocumentLoaded"  ZoomChanged="@ZoomChangeEvent" PageChanged="@PageChangeEvent" />


Regards,

Shamini


Marked as answer

DM Dennis M May 3, 2022 11:54 PM UTC

Hi Shamini,

I confirm when adding a single PdfViewerEvents as you showed, it work.

Regards,

Dennis



SK Shamini Kiruba Sobers Syncfusion Team May 4, 2022 03:24 AM UTC

Hi Dennis,


Thanks for the update.


Regards,

Shamini


Loader.
Up arrow icon