Copy link to clipboard
Copied
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,
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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,
Copy link to clipboard
Copied
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.