BB code for PDF Attachment

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

BB code for PDF Attachment

Post by LuigiMdg » 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>

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 3332
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: BB code for PDF Attachment

Post by thecoalman » Mon May 21, 2018 12:45 am

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: 148
Joined: Sun May 07, 2017 3:39 pm

Re: BB code for PDF Attachment

Post by jan_2017 » Wed May 23, 2018 9:06 am

I see source code only instead the content.
Screenshot_20180523-110534.png
no pdf Preview :(

User avatar
Puchahawa
Registered User
Posts: 768
Joined: Sat Jan 01, 2011 10:33 pm
Name: Randy

Re: BB code for PDF Attachment

Post by Puchahawa » Wed May 23, 2018 5:21 pm

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: 148
Joined: Sun May 07, 2017 3:39 pm

Re: BB code for PDF Attachment

Post by jan_2017 » Wed May 23, 2018 7:36 pm

Very Thanks.

It works :D

Thank you for code !

Bye Jan

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

Re: BB code for PDF Attachment

Post by LuigiMdg » Fri Jun 15, 2018 10:30 am

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: 374
Joined: Thu Jul 03, 2014 9:20 pm
Location: Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer » Sun May 12, 2019 3:49 pm

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.
My phpBB Style Board & MoreFlowerPower 3.2.8 Screenshots & Download
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.

User avatar
Tastenplayer
Registered User
Posts: 374
Joined: Thu Jul 03, 2014 9:20 pm
Location: Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer » Sun May 12, 2019 6:52 pm

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
My phpBB Style Board & MoreFlowerPower 3.2.8 Screenshots & Download
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.

User avatar
Tastenplayer
Registered User
Posts: 374
Joined: Thu Jul 03, 2014 9:20 pm
Location: Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer » Mon May 13, 2019 1:01 pm

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.
My phpBB Style Board & MoreFlowerPower 3.2.8 Screenshots & Download
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.

User avatar
3Di
Former Team Member
Posts: 14346
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BB code for PDF Attachment

Post by 3Di » Mon May 13, 2019 1:17 pm

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.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

User avatar
Tastenplayer
Registered User
Posts: 374
Joined: Thu Jul 03, 2014 9:20 pm
Location: Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer » Mon May 13, 2019 1:51 pm

This shows only the link addresses in all my forums :)
My phpBB Style Board & MoreFlowerPower 3.2.8 Screenshots & Download
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.

User avatar
3Di
Former Team Member
Posts: 14346
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BB code for PDF Attachment

Post by 3Di » Mon May 13, 2019 1:59 pm

[pdf]{RELATIVE_URL}[/pdf]

and

<iframe src="//docs.google.com/gview?url={RELATIVE_URL}&embedded=true" style="width:100%; height:500px;" frameborder="0"></iframe>
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

User avatar
Tastenplayer
Registered User
Posts: 374
Joined: Thu Jul 03, 2014 9:20 pm
Location: Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer » Mon May 13, 2019 2:07 pm

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.
My phpBB Style Board & MoreFlowerPower 3.2.8 Screenshots & Download
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.

User avatar
3Di
Former Team Member
Posts: 14346
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BB code for PDF Attachment

Post by 3Di » Mon May 13, 2019 2:12 pm

Gimme please an URL to a PDF so I can test.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

User avatar
Tastenplayer
Registered User
Posts: 374
Joined: Thu Jul 03, 2014 9:20 pm
Location: Switzerland
Name: Jutta Koliofotis
Contact:

Re: BB code for PDF Attachment

Post by Tastenplayer » Mon May 13, 2019 2:20 pm

My phpBB Style Board & MoreFlowerPower 3.2.8 Screenshots & Download
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.

Post Reply

Return to “Custom BBCode Development and Requests”