Refresh PDF Viewer programatically

New Here ,
Feb 03, 2021 Feb 03, 2021

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,

TOPICS
PDF Embed API

Views

258

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 03, 2021 Feb 03, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 10, 2021 Feb 10, 2021

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,

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 10, 2021 Feb 10, 2021

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines