Smart field PDF viewer

Hi Forest,

I have a User collection that has a smart field called file. This smart field recieves a signed url that points to an image or pdf in AWS-S3.
When this signed url points to an image, the behaviour is correct and the smart field shows me that image. But, when this signed url points to a pdf file the behaviour is the following:

  • When i click to the list view, appears a file icon on every row and when i click it, browser throws the “file downloading” --> ok, fine.
  • When i click on the summary view of a document, in that moment the browser throws the file downloading automatically. And when i cancell it, also the document can’t be previewed.

So, my expected behaviour is as when this url points to an image: When i click on the summary view, and this smart field contain a signed url pointing to an PDF file, the browser wouldn’t have to throw the “file downloading” and simply it’d have to show me correctly the pdf file preview in the smart field.

Any idea? Thank you!!

Hi Marc,

What you need is called the widget File viewer.

You can find it there: File viewer documentation

Regards,
Slim

Hi,

I already do this.
As i said, with an image is it working correctly and i see that image. Obviously, with the “File display widget” selected. But when this Smart Field recieves a signed url that points to a pdf file, the behaviour is different…

Any idea? Thanks.

Ok.

Can you please share your forest-schema part is relation with this topic?
Do you think it’s related to the “signed url” value?
Did you try with a simple link to a pdf?

Thanks.

Ok.

On my side I do not reproduce the error: pdf is displayed inline in summary view. The url used was a simple one.
Please provide a not working url for you to have a try.

  1. Forest Admin Schema
{
      "field": "file",
      "type": "String",
      "defaultValue": null,
      "enums": null,
      "integration": null,
      "isFilterable": false,
      "isReadOnly": true,
      "isRequired": false,
      "isSortable": false,
      "isVirtual": true,
      "reference": null,
      "inverseOf": null,
      "validations": []
    },
  1. The signed URL is correct because takes me to the document when click on it. And with images it’s working :frowning:
  2. With a simple link to a pdf file Forest works done.

Thank you.

Ok,

Please provide a “not working url” for you.
I need to reproduce the bug on my side in order to create a bug ticket inside Forest.
Thank you

Sample not working url

Hi again Marc,

Thanks to your link, I reproduced the problem.
It seems we have an issue displaying inline files with this special kind of links, sorry for that.
I’ve just created a ticket in Forest to resolve it.

Thanks again for pointing this.

Okay, thank you!
How can i get notified when this specific issue be solved?

Yes, I’ve added your name in the request, you will be informed.

1 Like

Hey @marc,

I already saw this issue before. But this is due to the link. You have to make sure your link is not a download link but a link to the file.
The link you just shared is downloading a file while it should just open a tab with the file :wink:

Try that and I think this should fix your issue

1 Like

Hi!

Okay, solved. The problem was related to the “Content-Type” that the CloudFront S3 was returning to me (octet). In the pdf files this header must be “application/pdf”. Now Forest behaviour is correct.

Thanks!

2 Likes