# Webview, pdf, google drive

**URL:** https://community.glideapps.com/t/webview-pdf-google-drive/24161
**Category:** Ask for Help
**Created:** [March 12, 2021, 3:08pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161 "2021-03-12T15:08:46Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [March 12, 2021, 3:08pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/1 "2021-03-12T15:08:46Z")

</div>

Hello,  
I can’t view a pdf from my google drive.  
I did the test with “https//docs.google.com/viewer?embedded=true&url= {document}”  
where {document} is the web link.  
But the result is:  
 ![webview pdf](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/8/98c25c80eb0a7ea497f190a15fb398040fd164e2.png)

It works with the pdf upload in https//storage.googleapis.com / …

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [March 12, 2021, 4:35pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/2 "2021-03-12T16:35:22Z")

</div>

Two things I’m noticing:

- You don’t have a colon after https
- You have a space between url= and {document}

Otherwise I would check to make sure your google drive pdf is publicly shared.

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [March 12, 2021, 4:41pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/3 "2021-03-12T16:41:43Z")

</div>

oh that’s a typo in my post.  
here is the real version

 ![webview pdf col](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/3/0302fc3acf762a1f50be27cd5cfaa136f83b9c48.png)

the first line works with [https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/uPcxis2H9otF68X9jr7A/pub/erRfIkiPOCfI3PSAagtE.pdf](https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/uPcxis2H9otF68X9jr7A/pub/erRfIkiPOCfI3PSAagtE.pdf)

but it doesn’t work with second line [https://drive.google.com/file/d/1vH3mS84YQMJJy4rnYps0P83hhD9MSKhi/view?usp=sharing](https://drive.google.com/file/d/1vH3mS84YQMJJy4rnYps0P83hhD9MSKhi/view?usp=sharing)

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [March 12, 2021, 4:44pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/4 "2021-03-12T16:44:29Z")

</div>

> [@Manu.n](#):
>
> but it doesn’t work with second line [https://drive.google.com/file/d/1vH3mS84YQMJJy4rnYps0P83hhD9MSKhi/view?usp=sharing](https://drive.google.com/file/d/1vH3mS84YQMJJy4rnYps0P83hhD9MSKhi/view?usp=sharing)

 ![Screen Shot 2021-03-13 at 12.44.03 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/9/f95eb6dbaf978a75f6417fc6d9decc2c1203a326.png)

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [March 12, 2021, 4:44pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/5 "2021-03-12T16:44:57Z")

</div>

It’s not a publicly shared link.

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [March 12, 2021, 4:50pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/6 "2021-03-12T16:50:38Z")

</div>

I had redone the public authorization, but that does not change the problem.

![webview pdf auth](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/d/0d1923204ff6857ac9a9322c979f3b1bfea79d2b.png)

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [March 12, 2021, 5:12pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/7 "2021-03-12T17:12:15Z")

</div>

I tried your link in my app, which uses the same google docs wrapper. Seems like it’s seeing it but not rendering it as a pdf. I’ll play around with it and see if I can get it to work. All of my PDF’s are uploaded through the app, so I haven’t ran into this issue before. I’ll get back to you.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/6/36214e32395be3a5c05ca6d496f383684dac2e64.png)

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [March 12, 2021, 5:17pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/8 "2021-03-12T17:17:44Z")

</div>

Merci, jeff

Note, this is a pdf created from a script

```
var html = "<h1> Hello world, Test New PDF Hello manu </h1>"
           + "<p> The quick brown fox jumped over the lazy dog";

  var blob = Utilities.newBlob (html, "text / html", "text.html");
  var pdf = blob.getAs ("application / pdf");

  var file = DriveApp.createFile (pdf) .setName ("text2.pdf");

```

But I also did a test with another “real” pdf file, and it’s the same.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [March 13, 2021, 12:38am UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/9 "2021-03-13T00:38:40Z")

</div>

OK, so I’m not overly familiar with google drives different url structures, but this version works.

`https://drive.google.com/uc?id=1vH3mS84YQMJJy4rnYps0P83hhD9MSKhi`

If your script is writing the file name to the sheet, hopefully you can write the url in the format above. The file ID is the same, but the rest of the url is structured a little different. Just remember that the file has to be placed into a publicly shared folder, or hopefully you can set the permissions as you are generating the PDF.

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [March 13, 2021, 3:06am UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/10 "2021-03-13T03:06:55Z")

</div>

Yes Yes Yes  
Fantastic  
thank you sir

Yes I can format the address from the file id.

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [March 13, 2021, 3:29am UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/11 "2021-03-13T03:29:04Z")

</div>

For information  
Here is the script with the permissions and formatting of the Url.

```
  var html = "<h1> Hello world, Test New PDF Hello manu </h1>"
           + "<p> The quick brown fox jumped over the lazy dog";

  var blob = Utilities.newBlob (html, "text / html", "text.html");
  var pdf = blob.getAs ("application / pdf");
  var file = DriveApp.createFile (pdf) .setName ("text2.pdf");

  file.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);

  var id=file.getId();
  var url = "https://drive.google.com/uc?id=" + id;

  Logger.log(url);
```

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [March 13, 2021, 3:43am UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/12 "2021-03-13T03:43:00Z")

</div>

For information 2

If you want to create a link to save a file on your computer.  
Add “& export = download” at the end of the address

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [March 13, 2021, 4:29am UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/13 "2021-03-13T04:29:23Z")

</div>

Thanks for the script. I like the idea of converting html to a pdf. It’s simple. I might have to explore using this in my app.

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [March 13, 2021, 6:59am UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/14 "2021-03-13T06:59:56Z")

</div>

Yes, but I have some of the HTML is Markdown format, and I’m stuck.  
To be continued …

---

<div class="post-metadata">

### Author: ![Jaybird\_Farrow](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jaybird_farrow/32/135_2.png) [@Jaybird\_Farrow](https://community.glideapps.com/u/Jaybird_Farrow)
#### Post date: [March 29, 2021, 10:39pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/15 "2021-03-29T22:39:34Z")

</div>

Here is how I do it:  
Upload the PDFs to a Google Drive Folder  
Use the Files Cabinet extension to create a list of the files in that folder  
Set the folder share to anyone with link  
Find Replace the URL column for /file/d/ and change /view to /preview for the embed to work  
Now bring it into Glide. Then I either add the pdf cover or generate an image column  
example: [Kierkegaard](https://kierkegaard.glideapp.io)

Hope this helps…

---

<div class="post-metadata">

### Author: ![abalsantana01](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/abalsantana01/32/26011_2.png) [@abalsantana01](https://community.glideapps.com/u/abalsantana01)
#### Post date: [April 15, 2021, 4:36pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/16 "2021-04-15T16:36:08Z")

</div>

Good afternoon friend, congratulations on your app, it was really cool! I’m new to Glide, I would like more details so you can do this operation to view the pdf. Did you use script? Can you help me?

Thank you so much

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [April 15, 2021, 4:45pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/17 "2021-04-15T16:45:23Z")

</div>

Hello,  
No script to display a pdf in Glide.  
You can use a WebView or an image for this operation.

---

<div class="post-metadata">

### Author: ![abalsantana01](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/abalsantana01/32/26011_2.png) [@abalsantana01](https://community.glideapps.com/u/abalsantana01)
#### Post date: [April 15, 2021, 5:12pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/18 "2021-04-15T17:12:29Z")

</div>

So, but in the webview it doesn’t open because it has to be in the paid plan and the image I put an image linked to the link and opened externally and not in the app

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [April 15, 2021, 5:17pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/19 "2021-04-15T17:17:58Z")

</div>

For the image here are the parameters that I use

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/6/1665e6d863800123c246436df0a3543e4af9141a.png)

And here is the FileUrl column

You just need the ID of the file in your google drive.

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/6/b6700d2fef43c48da8b0f39055c57cf49ef5fbbd.png)

---

<div class="post-metadata">

### Author: ![abalsantana01](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/abalsantana01/32/26011_2.png) [@abalsantana01](https://community.glideapps.com/u/abalsantana01)
#### Post date: [April 15, 2021, 5:20pm UTC](https://community.glideapps.com/t/webview-pdf-google-drive/24161/20 "2021-04-15T17:20:51Z")

</div>

Manu.n, veja: [Video](https://drive.google.com/file/d/1Ye2NqlJo-N122d_kR1clRwjx2qYj-lNO/view?usp=sharing)

[Next page](https://community.glideapps.com/t/webview-pdf-google-drive/24161.md?page=2)
