12/18/2023 0 Comments Pdf into google docIf you intend to use the viewer with pdf’s stored in glide or any other website except google drive, then I’m not aware of any other method that will allow you to nicely view a PDF inside of a webview component. Test both and see which one works the best. But if you do, then it might be worth setting up your table to have a column with the url wrapped using the same method I use and another column that appends the preview to the end. If you intend to store all of your files in google drive, then keep in mind google’s usage limitations and the fact that it’s not truly meant to be a web host for files. Keep in mind that my user base is only one or two users, so having to back up and reopen the webview is not a big deal for us. I could probably poke at it all day with varying results depending on where the file is stored, and which method I used to display it in a web view. I wouldn’t say that my tests are conclusive. I continued testing, and I did get the webview to fail once or twice with a drive stored file and using the wrapping method. 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 th…Īs of right now, I don’t typically store files in google drive if I don’t have to. The file ID is the same, but the rest of the url is structured a little different. If your script is writing the file name to the sheet, hopefully you can write the url in the format above. OK, so I’m not overly familiar with google drives different url structures, but this version works. I think this was a solution for me at the time. I remember dealing with that a long time ago. I’m guessing it’s a cache issue somewhere.Īs a third test, I tried using the wrapping method with the pdf stored in drive and I started getting the html text issue that you had. I really don’t know if it’s something on my end with my old phone, or something on googles end because it has to retrieve the file from an outside source before displaying it in it’s own viewer. Using the wrapping method, I probably get a failure for the PDF to load 1 out of every 5 tries (completely closing the app after each try). Using the preview method did appear to be much more reliable as far as consistently opening the viewer in a webview component every single time. With that said, I did run a test with the same PDF, but I used my wrapping method with a PDF stored in glide storage and compared it to a PDF stored in google drive that used the preview method. So, with that, it does appear to be a little more involved to clean up the url before appending ‘/preview’ to get it to work with a webview component. I had to remove the ‘view?usp=sharing’ part before appending ‘/preview’. It seems that I got the ‘cannot be embedded’ message if I directly appended ‘/preview’ to the end of the url, that I got from google drive when I retrieved the shared url. One thing I noticed is that if you use the ‘/Preview’ method, then you have to manipulate the URL. Ultimately, it appears to be the same viewer regardless if you wrap the url, or append the preview. I had to modify my app a little bit to test this, since it’s designed to use the wrapping method exclusively if the url contains ‘PDF’, or ‘Drive’.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |