Previous Thread
Next Thread
Print Thread
Hop To
#265342 06/08/2022 7:47 PM
Joined: Oct 2007
Posts: 306
Likes: 5
Enthusiast
OP Online Content
Enthusiast
Joined: Oct 2007
Posts: 306
Likes: 5
I recently discovered that there is a show pdf feature that allows viewers to see the pdf inline. However, when I try to view it in Safari I get an error message: No preview available. When I try to view it in Chrome, I get a blank window. I searched for the problem here and found a discussion on it. Both browsers could view the pdfs in that thread. https://www.ubbcentral.com/forums/u...ords/pdf/Search/true/show-pdf#Post263230

I tested the page on my iPhone 11 (using DuckDuckGo), and some of the pdfs show the No Preview Available error and some show blank pages. I also tested on a Windows 10 box with both Chrome and Edge, and had similar results.

Is there a php extension that is required for these to work?

My sig has our present setup.


The Stovebolt Geek
https://www.stovebolt.com/ubbthreads/ubbthreads.php

x86_64 GNU/Linux
UBBThreads 7.7.5
Web Server Apache/2.4.6
PHP Version 7.4.30
MySQL Version 5.7.38
Database Size 1.72 GB
Joined: Apr 2004
Posts: 1,910
Likes: 140
UBB.threads Developer
Offline
UBB.threads Developer
Joined: Apr 2004
Posts: 1,910
Likes: 140
The PDF viewer uses Google Docs to inline your forum's hosted PDFs on demand.

This is the URL that is accessed when clicking the "Show PDF"
//docs.google.com/gview?url=https://www.EXAMPLE.com/forums/files/3182.pdf&embedded=true

1. your browser must not be blocking access to the 3rd party website, google.com.
iirc, DuckDuckGo browser blocks this unless you've updated a setting to allow access to google services.
iirc, Configuring any other browser's Privacy & Security settings from "Standard" (default) to "Strict" will also disable access to 3rd party websites in the same way that it disables access to ads and embedded content where its domain does not match the source's domain.

2. your forum must be using Full URLs, so that the URL can be opened by the PDF viewer.
Control Panel > Paths & Database

3. it may be a docs.google "hiccup." try refreshing the page. yes. seriously.
could easily happen when trying to display the PDF before it has had a chance to upload to google's servers. if anything is delayed within the process, you might be notified with an option to view it directly on google's website or that it could not be displayed at all. a large PDF may cause this.

Attached Images
Attached PDF document
pdf-sample.pdf (7.76 KB, 6 downloads)
Last edited by isaac; 06/08/2022 8:11 PM. Reason: attached an example pdf file

Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Work In Progress: soon
isaac @ id242.com // my forum @ CelicaHobby.com
1 member likes this: Gizmo
Joined: Oct 2007
Posts: 306
Likes: 5
Enthusiast
OP Online Content
Enthusiast
Joined: Oct 2007
Posts: 306
Likes: 5
It can't be a browser problem, because I can view the pdfs in the ubbcentral thread using the same browsers, and I can view the pdf you uploaded to this thread using the same browser. I changed this value: Full URL or Relative URL to Forum Directory from Relative to Full, and now I just get a blank page. Perhaps that's because the pdf hasn't yet been uploaded to Google Docs.

Last edited by Baldeagle; 06/08/2022 8:34 PM.

The Stovebolt Geek
https://www.stovebolt.com/ubbthreads/ubbthreads.php

x86_64 GNU/Linux
UBBThreads 7.7.5
Web Server Apache/2.4.6
PHP Version 7.4.30
MySQL Version 5.7.38
Database Size 1.72 GB
Joined: Oct 2007
Posts: 306
Likes: 5
Enthusiast
OP Online Content
Enthusiast
Joined: Oct 2007
Posts: 306
Likes: 5
Would it make difference if the file is in a different place? Here's the URL when I try to preview the pdf in Google Docs:
Code
https://docs.google.com/viewerng/viewer?url=https://www.stovebolt.com/ubbthreads/uploads/attachments//43462.pdf

And here's the URL when you download the file:
Code
https://www.stovebolt.com/ubbthreads/ubbthreads.php/ubb/download/Number/43462/filename/canon333bc9.enrd.doj.gov_Exchange_09-09-2011_00-44-23.pdf

Last edited by isaac; 06/08/2022 11:22 PM. Reason: added code tags to prevent the urls from being parsed

The Stovebolt Geek
https://www.stovebolt.com/ubbthreads/ubbthreads.php

x86_64 GNU/Linux
UBBThreads 7.7.5
Web Server Apache/2.4.6
PHP Version 7.4.30
MySQL Version 5.7.38
Database Size 1.72 GB
Joined: Apr 2004
Posts: 1,910
Likes: 140
UBB.threads Developer
Offline
UBB.threads Developer
Joined: Apr 2004
Posts: 1,910
Likes: 140
Originally Posted by Baldeagle
Would it make difference if the file is in a different place?

The Full URL used (and its matching PATH) are what you've declared in Control Panel > Paths & Database > Attachments

[Linked Image]

Changing this information will have no affect on the real-time URL that is sent to google, except you'll need update directory paths on your server to reflect the new changes.

BTW, you have a typo in your URL. It looks like you have added a backslash where one should not be. Look at your Attachments > Full URL to Attachment Storage Directory and remove the trailing slash, so it looks like the example given in the configuration directions.

Originally Posted by Baldeagle
Here's the URL when I try to preview the pdf in Google Docs:
Code
https://docs.google.com/viewerng/viewer?url=https://www.stovebolt.com/ubbthreads/uploads/attachments//43462.pdf

This could explain why some browsers will correct your error and display the file. while another browser will do exactly what it is told to do, and is presenting you with the error.

Last edited by isaac; 06/08/2022 11:25 PM.

Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Work In Progress: soon
isaac @ id242.com // my forum @ CelicaHobby.com
Joined: Oct 2007
Posts: 306
Likes: 5
Enthusiast
OP Online Content
Enthusiast
Joined: Oct 2007
Posts: 306
Likes: 5
I had a trailing forward slash at the end of the absolute path. That is what was causing the double forward slash in the URL. I restarted Apache, and now I'm getting a blank page instead of the no preview available error. Update: So much for that. Now I'm back to no preview available.

The Google URL now is
Code
https://docs.google.com/viewerng/viewer?url=https://www.stovebolt.com/ubbthreads/uploads/attachments/43462.pdf

I have confirmed that the file exists and has RW perms.

Last edited by Baldeagle; 06/08/2022 11:57 PM.

The Stovebolt Geek
https://www.stovebolt.com/ubbthreads/ubbthreads.php

x86_64 GNU/Linux
UBBThreads 7.7.5
Web Server Apache/2.4.6
PHP Version 7.4.30
MySQL Version 5.7.38
Database Size 1.72 GB
Joined: Jun 2006
Posts: 16,180
Likes: 101
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 16,180
Likes: 101
The requested file doesn't exist:
https://www.stovebolt.com/ubbthreads/uploads/attachments/43462.pdf

So it is throwing a blank screen.

There is a reason between the two urls; one is the permission matrix (allowing users to download files) and the other is a public url to the pdf since google is a guest and cannot access ubb.threads urls that'd require being logged in.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Oct 2007
Posts: 306
Likes: 5
Enthusiast
OP Online Content
Enthusiast
Joined: Oct 2007
Posts: 306
Likes: 5
I have the following in the conf file for the website:
Code
    <Directory "/usr/local/www/html/ubbthreads/uploads">
                Options Indexes
        </Directory>
There actually IS a directory named uploads in that location, but it's not the location of the directory where the pdf is.
I think that might be the problem.

Attached Images
Screen Shot 2022-06-08 at 11.06.22 PM.png

The Stovebolt Geek
https://www.stovebolt.com/ubbthreads/ubbthreads.php

x86_64 GNU/Linux
UBBThreads 7.7.5
Web Server Apache/2.4.6
PHP Version 7.4.30
MySQL Version 5.7.38
Database Size 1.72 GB
Joined: Oct 2007
Posts: 306
Likes: 5
Enthusiast
OP Online Content
Enthusiast
Joined: Oct 2007
Posts: 306
Likes: 5
OK. This is clearly my problem. I need to fix the webserver so it will display that directory. Thanks for all the suggestions that helped me focus on where the problem actually is.


The Stovebolt Geek
https://www.stovebolt.com/ubbthreads/ubbthreads.php

x86_64 GNU/Linux
UBBThreads 7.7.5
Web Server Apache/2.4.6
PHP Version 7.4.30
MySQL Version 5.7.38
Database Size 1.72 GB
Joined: Oct 2007
Posts: 306
Likes: 5
Enthusiast
OP Online Content
Enthusiast
Joined: Oct 2007
Posts: 306
Likes: 5
In case anyone reads this in the future, I had the url of the directory set to /ubbthreads/uploads/attachments, but the physical location of the files was in /var/ubbthreads/uploads. I had to create an Alias directive in the apache conf file to tell the server what the url should be. Then I had to create a directory config with the correct permissions so that the files could be displayed.

All of this was caused by my moving the directory from uploads/attachments under DocumentRoot to /var/ubbthreads/uploads for space reasons but not thinking through that the server needed to be told where that directory was now and had to have the correct permissions in order for it to work.

IOW, an ID10T problem.

It works fine now.


The Stovebolt Geek
https://www.stovebolt.com/ubbthreads/ubbthreads.php

x86_64 GNU/Linux
UBBThreads 7.7.5
Web Server Apache/2.4.6
PHP Version 7.4.30
MySQL Version 5.7.38
Database Size 1.72 GB

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Help! Broken UBB
by JPFolks - 06/27/2022 3:43 PM
Odd question on view source.
by Ruben - 06/26/2022 3:52 PM
Google tag manager. question.
by Ruben - 06/25/2022 11:11 AM
May I steal your code?
by Baldeagle - 06/23/2022 3:58 PM
Possible bug?
by Baldeagle - 06/19/2022 9:00 PM
Who's Online Now
4 members (Ruben, Gizmo, 1QuickSI, Baldeagle), 57 guests, and 64 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
gallery test
gallery test
by Mors, September 23
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 7.7.5