How to open pdf attachment in the viewer from attachmentPanel instead of downloading it

WebViewer Version: 10.0.1

The default behavior of clicking on attached pdf file is to download it. I need to open it in the viewer instead of download it.
Is there any way to alter clicking on attached file behavior.

Regards!

1 Like

Hello Senussi,

We are currently looking into this issue and will get back to you as soon as we have a meaningful response.

All the best,
Bojan

1 Like

Hello Senussi,
Thank you for your patience.
We have added the ability to open attachments in a new tab in multi-tab view mode, in the latest version of the WebViewer (that being version 10.3). You can check the Changelog here:

Also, you can download the latest version here:

And the latest React.js sample here:

Please let us know if there is anything else we can help you with.

1 Like

Hi @bjovanovic

thanks for your answer.
I’ve tried the newer version with multitab enabled, but still same behavior of downloading instead of open in a new tab as mentioned in the release notes. also still i can’t find any changes in the API that makes me able to change that behavior.

1 Like

Hello Senussi,

You can enable multi-tab mode with the following code snippet:

instance.UI.enableFeatures([instance.UI.Feature.MultiTab]);

When you click on a attachment, you should be able to see the new icon, when hovering over it, it should say “View File”. Check the image below:

Im using the latest React sample you can download here:

All the best,
Bojan

@bjovanovic

Thanks for reply.
I meant opening attachment on click on attachment from attachment panel. as it shown in the attached screenshot. that still downloads the attached file on click.

1 Like

We have the same need.

As a workaround for now, we ask our users to add attachments to PDF via annotations, but this doesn’t work with legacy documents or documents made with other tools.

1 Like

Hello Senussi,
We have also tried it with attachmentPanel and it also works, as you can see from the attached video (We have attached a couple of screenshots to a pdf file, but it also works with attached PDF files). We are using latest React.js sample (version 10.3) you can download from here: GitHub - PDFTron/webviewer-react-sample: Sample to demonstrate integrating WebViewer into React
Can you please check if this version solves the issue you are having, if not, can you please provide us with a minimal reproducible sample?

All the best,
Bojan

1 Like