MyBB Community Forums

Full Version: Embedd pdf documents to view in threads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I tired this but it doesn't work anymore IDK why, :- https://community.mybb.com/thread-78874.html

I wanted to embed PDF in threads so users can view them directly instead of downloading, as you know virus can be attached into pdf and people can get infected so I wanted to embed pdf to threads so that they can be viewed directly in the browser instead of downloading.

Just like mega.nz pdf viewer, users could just use a [pdf] tag and add embed pdf doccuments into threads.

I tried the following bellow, but either it forces users to download the PDF with the given mycode or shows mega.nz refused connection or scribd refused connection and similar. I am so much confused on how to do it, any help will be appreciated.

(This either force downloads .pdf files directly if I upload it to my webserver, or when used scribd or mega.nz to host the pdf - it gives connection refused error everytime, tried with 5 different host but with same issue)
[Image: 94059399745f2faef6b7db6eef4b1872.png]

Any other way to embed PDF doccument so those can be viewed in threads?
They probably don't allow them to be embedded on other sites, in which case there's nothing you can do about it.
Regular Expression:
\[pdf\](.*?)\[/pdf\]

Replacement:
<iframe src="$1" width="100%" height="700px"></iframe>
^ change height to whatever you want

[attachment=45729]
(2023-01-18, 12:31 PM)Taylor M Wrote: [ -> ]Regular Expression:
\[pdf\](.*?)\[/pdf\]

Replacement:
<iframe src="$1" width="100%" height="700px"></iframe>
^ change height to whatever you want

Is there any way to use google drive links ?

My basic problem is why it always forces users to download the file instead of viewing, is it a problem with the browser or because it is just an iframe?
If they have prevented PDFs from being embedded and forced them to download, you cannot do anything to prevent that, you would need to self host them.
Step 1:
Need to set the PDF document on google drive to be sharable by link (anyone with link can view < this is important or others won't be able to see it).
--> https://support.google.com/docs/answer/2...%3DDesktop

Step 2:
Right click the document and click Preview > More actions (the three vertical dots) > Open in a new window.

Step 3:
On the new open window click More Actions (the three vertical dots) > Embed item.

Step 4:
The URL link in the iframe code it gives is what you will post in [pdf]link[/pdf].



It will look slightly different than other PDF's as its hosted by google but this does the trick.
[attachment=45734]

Feel free to share this on your forum so users can figure it out:
[b]Step 1:[/b]
Need to set the PDF document on google drive to be sharable by link (anyone with link can view < this is important or others won't be able to see it).
--> https://support.google.com/docs/answer/2494822?hl=en&co=GENIE.Platform%3DDesktop

[b]Step 2:[/b]
Right click the document and click Preview > More actions (the three vertical dots) > Open in a new window.

[b]Step 3:[/b]
On the new open window click More Actions (the three vertical dots) > Embed item.

[b]Step 4:[/b]
The URL link in the iframe code it gives is what you will post in [pdf]link[/pdf].