BB code for PDF Attachment

Get help developing custom BBCodes or request one.
User avatar
LuigiMdg
Registered User
Posts: 143
Joined: Sat Jan 10, 2015 9:12 pm
Contact:

BB code for PDF Attachment

Post by LuigiMdg »

Hi..
I've added the code for PDF viewer in text editor, but it for just for external PDF..
I can edit this to work also with attachments?

Now the BB code is:

Code: Select all

[pdf]{RELATIVE_URL}[/pdf]
And the code is:

Code: Select all

<iframe src="http://docs.google.com/gview?url={RELATIVE_URL}&embedded=true" style="width:100%; height:500px;" frameborder="0"></iframe>
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 5871
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: BB code for PDF Attachment

Post by thecoalman »

Edit- removed original answer as I misinterpreted your question.

---------------------------------------------------------

That Ifrrame is is going to be loading Javascript. It could be adopted for PDF's attachments on your own forum but you would need the Javascipt loaded for it to function.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
jan_2017
Registered User
Posts: 161
Joined: Sun May 07, 2017 3:39 pm

Re: BB code for PDF Attachment

Post by jan_2017 »

I see source code only instead the content.
Screenshot_20180523-110534.png
no pdf Preview :(
User avatar
Puchahawa
Registered User
Posts: 769
Joined: Sat Jan 01, 2011 10:33 pm
Name: Randy

Re: BB code for PDF Attachment

Post by Puchahawa »

I've used this with good success. Basically same as above but minor change (URL vs relative URL). Height and width can be adjusted to your preference. Just need FULL URL of the pdf file down to .pdf. :)

BBCode usage

Code: Select all

[pdf]{URL}[/pdf]
HTML replacement

Code: Select all

<iframe src="{URL}" style="width:725px; height:800px;" frameborder="0"></iframe>
If this doesn't work for you, you may want to try this extension. It's one of Dmzx's that allows you to upload the file and gives you a direct link to it that you would put into the bbcode. I used that and it works well. Requires a minor edit to allow the pdf file. see 2nd and 3rd posts that topic.
Avatar courtesy of artist Faith Coyotë
User avatar
jan_2017
Registered User
Posts: 161
Joined: Sun May 07, 2017 3:39 pm

Re: BB code for PDF Attachment

Post by jan_2017 »

Very Thanks.

It works :D

Thank you for code !

Bye Jan
User avatar
LuigiMdg
Registered User
Posts: 143
Joined: Sat Jan 10, 2015 9:12 pm
Contact:

Re: BB code for PDF Attachment

Post by LuigiMdg »

With your code, if you have http you have problem with https.. And if is https you have problem with http.. With Google you can use http or https and include all type, http and https ;)
User avatar
Tastenplayer
Registered User
Posts: 999
Joined: Thu Jul 03, 2014 9:20 pm
Location: Village in the middle of Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer »

LuigiMdg wrote: Mon May 21, 2018 12:18 am Hi..
I've added the code for PDF viewer in text editor, but it for just for external PDF..
I can edit this to work also with attachments?

Now the BB code is:

Code: Select all

[pdf]{RELATIVE_URL}[/pdf]
And the code is:

Code: Select all

<iframe src="http://docs.google.com/gview?url={RELATIVE_URL}&embedded=true" style="width:100%; height:500px;" frameborder="0"></iframe>
Today I added some BBCodes to the new Styleforum (In a forum, with special BBCodes for searchers).
With this code, Firefox does not display a pdf with URL https in my forum anymore. I had to replace http with https in the code. Only now the PDF is displayed.

Image
Image
In my keyboard forum, I upload all pdf files as an attachment anyway :) Or as a link if necessary.
More of my styles you can find in my phpBB Style Board & More
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school.
🎨 All my styles are updated to 3.3.8 and can be downloaded here
User avatar
Tastenplayer
Registered User
Posts: 999
Joined: Thu Jul 03, 2014 9:20 pm
Location: Village in the middle of Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer »

This code, found at phpBB-fr, has worked for me for pdf with https and with http. But only in local TB. Nothing is shown in the online forum. Very funny. Is this due to the server settings :? Or maybe because the local board is unencrypted?

http://forums.phpbb-fr.com/extensions-d ... 07153.html
***
pdf code-fr.png
More of my styles you can find in my phpBB Style Board & More
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school.
🎨 All my styles are updated to 3.3.8 and can be downloaded here
User avatar
Tastenplayer
Registered User
Posts: 999
Joined: Thu Jul 03, 2014 9:20 pm
Location: Village in the middle of Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer »

Today Mr. Google finally gave me the correct solution (sometimes it takes a while until the content is loaded) ;)

http://forums.phpbb-fr.com/extensions-d ... 11810.html
bbcode documents.jpg
[document]{URL}[/document]

Code: Select all

<div style="position: relative; overflow: hidden; height: 0; padding-bottom: 100%;">
<object style="position: absolute; left: 0; top: 0; width: 100%; height: 100%" data="//docs.google.com/viewer?url={URL}&embedded=true"></object>
</div>
[document]URL of the document[/document]

But is this GDPR compliant if it runs via google? In the data protection regulation one would have to mention this in any case, if one uses this BBCode in his forum.
More of my styles you can find in my phpBB Style Board & More
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school.
🎨 All my styles are updated to 3.3.8 and can be downloaded here
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BB code for PDF Attachment

Post by 3Di »

If you chnage the previous bbcode to

Code: Select all

<iframe src="//docs.google.com/gview?url={RELATIVE_URL}&embedded=true" style="width:100%; height:500px;" frameborder="0"></iframe>
Should work since it doesn't specify http or https.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Tastenplayer
Registered User
Posts: 999
Joined: Thu Jul 03, 2014 9:20 pm
Location: Village in the middle of Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer »

This shows only the link addresses in all my forums :)
More of my styles you can find in my phpBB Style Board & More
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school.
🎨 All my styles are updated to 3.3.8 and can be downloaded here
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BB code for PDF Attachment

Post by 3Di »

[pdf]{RELATIVE_URL}[/pdf]

and

<iframe src="//docs.google.com/gview?url={RELATIVE_URL}&embedded=true" style="width:100%; height:500px;" frameborder="0"></iframe>
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Tastenplayer
Registered User
Posts: 999
Joined: Thu Jul 03, 2014 9:20 pm
Location: Village in the middle of Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer »

That's right! Both urls are being reported.
I had given document instead of pdf :lol:

Thank you for this code.

I think the code for all files is quite good, but it loads a bit slowly.

However, depending on the server, you may have to click Update several times to display the file.
Uploading a file attachment is definitely better (if there are few or you have enough GBs available)
Last edited by Tastenplayer on Mon May 13, 2019 2:18 pm, edited 1 time in total.
More of my styles you can find in my phpBB Style Board & More
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school.
🎨 All my styles are updated to 3.3.8 and can be downloaded here
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BB code for PDF Attachment

Post by 3Di »

Gimme please an URL to a PDF so I can test.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Tastenplayer
Registered User
Posts: 999
Joined: Thu Jul 03, 2014 9:20 pm
Location: Village in the middle of Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer »

More of my styles you can find in my phpBB Style Board & More
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school.
🎨 All my styles are updated to 3.3.8 and can be downloaded here
Post Reply

Return to “Custom BBCode Development and Requests”