Skip to main content
Participating Frequently
Feb 3, 2021 9:00 AM UTC
Question

Refresh PDF Viewer programatically

Hello,

 

Is there a way to refresh/reload the PDF Embed API Viewer rather than calling location.reload?

We are rendering PDF and allow users to create annotations, If we detect changes from other users, we will then reload the pdf.

 

 

Thanks,

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Joel Geraci
Community Expert
Community Expert
Feb 3, 2021 5:40 PM UTC

You don't need to reload the PDF. You can add the annotations created by the other users to the current view using the addAnnotations API.

Translate
Participating Frequently
Feb 10, 2021 1:46 PM UTC

Hello Joel,

 

It is also possible that the pdf content will be updated by other users. So we really need to refresh that whole pdf content. We are storing the annotations on database so there is no problem refreshing them also.

 

Basically, we are rendering pdf with form fields which the values can be updated by our other application.

 

 

Thanks,

 

Translate
Joel Geraci
Community Expert
Community Expert
Feb 10, 2021 4:15 PM UTC

Ok - Unfortunately, there's no way to do field locking in a way that will prevent two users from editing a field at the same time. Because the pdf ByteArray is client-side, I don't see this becoming a feature any time soon.

If you want to periodically refresh the PDF, just set the viewer object to null and then just create a new one as normal. You might want to first capture the scroll position and current tool so that you can then set those in the new PDF so it appears to have been refreshed rather than replaced.

Translate