PDF Preview I have a Deck View with the File...

PDF Preview

I have a Deck View with the Files uploaded. Now I would like to have a Preview of the PDF File as the Main Image. Is this possible?

1 17 1,703
  • UX
17 REPLIES 17

Iโ€™m afraid thatโ€™s not possible unless you take a printscreen from that pdf and then use it as a main image.

@Aleksi Do you know any update on this? Perhaps I could use the SNAPSHOT() expression? But how would be the DeepLink to the PDF file?

If you are handy with PHP, you could try using this - https://github.com/spatie/pdf-to-image and saving the image to Gdrive

Thank you @Bellave_Jayaram. Sadly the only thing I know about PHP is how to spell it

Okay thank you. I thought I read about a workaround from Jarrod, but I could not find the Post anymore.

Unfortunately I havenโ€™t seen or found a way how you could achieve this kind of PDF preview.

There seems to be a workaround from @tsuji_koichi

You donโ€™t need to write any script just construct URL. Super easy.

Let me know if it worked out for you.

I couldnโ€™t get this to work, but could really use this functionality within most of my apps. I have everything setup like you described, and am getting back a โ€œNow Capturingโ€ image.

2X_2_2cf7622b84a34f2aa218c72c3bc70354b8a08cba.png

Iโ€™ve been able to grab a thumbnail dynamically using a google apps script on my source spreadsheet to extract the thumbnail via Drive API. Iโ€™ve added a trigger that runs the function every time a new row is added.

Youโ€™d need to adapt this script (and this is still a work in progress), but hope it helps!

function getThumbnailLink() {
  var sheet = SpreadsheetApp.getActive().getSheetByName("Content Resources");
  var urlColumn = sheet.getRange("UrlColumn").getColumn();
  var newRow = sheet.getLastRow();
  var url = sheet.getRange(newRow, urlColumn).getValue();
  var fileId = url.match(/[-\w]{25,}/);
  
  if (fileId) {
    var thumb = Drive.Files.get(fileId);
    var thumbColumn = sheet.getRange("ThumbnailColumn").getColumn();
    var thumbCell = sheet.getRange(newRow, thumbColumn);
    thumbCell.setValue(thumb.thumbnailLink);
  }
  
}

Mark, I canโ€™t thank you enough for reaching out to me with a solution. Very eager to try this out, and will report back once I get time to mess around with it. Thanks again

Karimmc2
Participant V

This would be a great feature Idea

Former Community Member
Not applicable

A PDF viewer is on my list, though I can't give you a timeline.

Thanks!

Thanks

Top Labels in this Space