Hi,
Some users have asked if it would be possible to preview an uploaded file without having to download it first. All uploaded files are PDF, I would assume to do this a jpg sidecar image would have to be uploaded also?
This might be testing my coding skills a little too much, can you please tell me if this would be possible before I spend too much time on it.
Thanks,
Hi,
You can create a php script (e.g. preview.php) as mentioned here and use it in image src on grid.
$col[“template”] = “<img src=’preview.php?pdf={pdf_url}’ />”;
Assuming pdf_url is column having pdf url link, you can pass pdf link to preview.php and generate thumbnail from php file and used as source of img tag.
Another online solution is to use google drive online pdf viewer.
https://drive.google.com/viewerng/viewer?embedded=true&url=http://domain.com/test.pdf
You can put above link in a column on grid with a label of preview.
$col[“template”] = “<a href=’https://drive.google.com/viewerng/viewer?embedded=true&url={pdf_url}‘>Preview</a>”;