Embed Pdf from Google drive with webview

yes, button can trigger a google script to do that

I must hang out for a while. Iā€™ll talk later. Thanks, Uzo.

Try this demo, it uploading directly to my Google drive, and displays in Glide as a image element or inline list, PDF, jpeg. gif or png

It turned out that my initial guess was right, you were using Html and app scripts. Iā€™ve tried it before, with a form like a form with an open link button. Iā€™ll probably try again with the webview component.
You havenā€™t slept, bro?
This is what I got from the internet before.

I feel like we got way off topic here.

So you still have the issue with the HTML display? Based on an earlier post, I thought you had figured that out, so it wasnā€™t an issue for you anymore. I still had the issue myself, so I used a different url structure with the same file ID.

Iā€™m usually the one adding the links to the PDFā€™s, so if one url doesnā€™t work, then I try a different one. I donā€™t have a fully automatic process to handle the url structure. All Iā€™m doing is wrapping whatever url I getā€¦whether the user manually entered the url to an external location, or it was uploaded to glides storage.
However, if you are asking how to handle switching from a /file/d url structure to a /uc?id= url structure, then all you need is a template column to replace that part of the url.

  • First obtain the url for the location of the pdf
  • Create a template column that uses that url as the template source, and then create a replacement to replace /file/d with /uc?id=. This should really only change urls that come from google drive. Nothing will be replaced in any of the other url structures are used, or the file is not being stored in google drive.
  • Create any other replacements in that template column as needed.
  • Finally create another template column to wrap that updated url with the google doc viewer.
1 Like

Yeah, Iā€™ve done it with a regex to extract and a template columns.
I think there is still a way to solve 3 different URL structures because of your previous statement. This means that the user must upload / share a homogeneous URL.

Thank you. Nice to discuss with you.

And there was a discussion that was a little off topic, just to comfort Uzo who was having trouble sleeping :rofl::rofl::rofl:.

1 Like

@Jeff_Hager, as additional info: I just opened a file with a size of 28.4MB, it turns out that Google Doc viewer does not allow preview because the file size is too large. But if you use ā€œ/previewā€ itā€™s still smooth. Thanks.

2 Likes

Good to know. Thanks for the heads up!

1 Like

Hi @Jeff_Hager, @ThinhDinh

Have you ever tried with Adobe? Is it possible?

I havenā€™t tried it before, but looking at there demo site, it appears that the code thatā€™s generated uses javascript which isnā€™t allowed directly in glide. So Iā€™m not sure if you could directly embed into glide using the code thatā€™s generated from their demo site. Plus when I tried, I got the ā€œcould not embedā€ message. You could possibly create your own separate website that uses adobeā€™s embed code, but then itā€™s probably not as dynamic as you would want it to be as if it were within glide. Iā€™m not seeing how adobeā€™s viewer could effectively be used in a glide app.

1 Like

Yeah, I gave up too.

1 Like

Do thisā€¦ Upload your pdfs to a folder in drive and set the folder to public
Get the File Cabinet Extension from Awesome Table - create a new sheet in that folder
In that sheet run the extension on that folder and you will get a list of files - Add a column for book cover and just add the thumbnails as the coverā€¦
Nowā€¦wrap your app around that sheet and now add a glide column called DocsTemplate and in that template column type
https://docs.google.com/viewer?embedded=true&url={document}
substitute {document} with the URL of file inside drive

example I made this wayā€¦ the Works of Kierkegaard
kierkegaard
hope this helpsā€¦

5 Likes

Hi, @Blue_Community, thanks for sharing.
Lastly, I prefer to use URLs that end in ā€œpreviewā€, a URL structure that is already provided by Google and works well.

2 Likes