Page 1 of 2

BB code for PDF Attachment

Posted: Mon May 21, 2018 12:18 am
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>

Re: BB code for PDF Attachment

Posted: Mon May 21, 2018 12:45 am
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.

Re: BB code for PDF Attachment

Posted: Wed May 23, 2018 9:06 am
by jan_2017
I see source code only instead the content.
Screenshot_20180523-110534.png
no pdf Preview :(

Re: BB code for PDF Attachment

Posted: Wed May 23, 2018 5:21 pm
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.

Re: BB code for PDF Attachment

Posted: Wed May 23, 2018 7:36 pm
by jan_2017
Very Thanks.

It works :D

Thank you for code !

Bye Jan

Re: BB code for PDF Attachment

Posted: Fri Jun 15, 2018 10:30 am
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 ;)

Re: BB code for PDF Attachment

Posted: Sun May 12, 2019 3:49 pm
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.

Re: BB code for PDF Attachment

Posted: Sun May 12, 2019 6:52 pm
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

Re: BB code for PDF Attachment

Posted: Mon May 13, 2019 1:01 pm
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.

Re: BB code for PDF Attachment

Posted: Mon May 13, 2019 1:17 pm
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.

Re: BB code for PDF Attachment

Posted: Mon May 13, 2019 1:51 pm
by Tastenplayer
This shows only the link addresses in all my forums :)

Re: BB code for PDF Attachment

Posted: Mon May 13, 2019 1:59 pm
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>

Re: BB code for PDF Attachment

Posted: Mon May 13, 2019 2:07 pm
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)

Re: BB code for PDF Attachment

Posted: Mon May 13, 2019 2:12 pm
by 3Di
Gimme please an URL to a PDF so I can test.

Re: BB code for PDF Attachment

Posted: Mon May 13, 2019 2:20 pm
by Tastenplayer