vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=248548

BBCode: Embed PDF Files (No JavaScript/No iFrames) (BB Code)
by BirdOPrey5
13 Aug 2010 19:27

2 Attachment(s)
This is <embed> BB Code to embed a PDF file into your forum. The user needs a compatible PDF Reader such as Adobe's free PDF Reader. If they don't have one they will still see a link to view the PDF directly.

I am aware <embed> is not "proper" HTML but it works fine in all major browsers (IE/FF/Chrome/Opera/Safari) while <object> was not working for me in IE. If you prefer to keep to strict HTML guidelines and don't care about IE users then simply change the two instances of "embed" in the replacement code to "object".

This has been confirmed working in the latest releases of IE, FF, Chrome, Safari, and Opera.

I am also aware there are at least 2 other PDF BB Codes out there... I believe this implementation is better because one of them uses JavaScript and another uses an iFrame and relies on a 3rd party website (google) to display the PDF. My implementation uses no JavaScript and does not reply on any other websites.

Demo: here.

Add a new BBCode

Title: Embed PDF
BB Code Tag Name: pdf
Replacement:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Example: [pdf]http://www.qapla.com/ju/PDFOpenParameters.pdf[/pdf]
(I suggest using your own example if possible.)
Use Option: No
Button Image: (optional) https://www.vbulletin.org/forum/external/2010/08/43.jpg
Remove Tag If Empty: Yes
All Disable Options: Yes

Overall this tag acts a lot like the built in [img] tags.

Please mark as installed if you use this. :)

Check My Profile for other BB Code enhancements. They work on all versions.

Screenshot Attached:
http://www.vbulletin.org/forum/attac...1&d=1281727562

yotsume has found a bug where VB drop down menus (like "thread tools") may get hidden behind the PDF if the menu overlaps the same screen space as the PDF. For now please leave some extra lines before embedding a PDF at the top of the first post if you need to use the drop down menus.

yotsume 14 Aug 2010 20:33

Works Great!

However... I changed the width to: width="100%". Looks even nicer using a %. This way the pdf view window is the full size of the post. In my case I used this inside of a vbadvanced bb code page with no wrapper.

Thanks!

SublimeBoa 14 Aug 2010 20:55

Simple to install, user friendly and works nicely.

Thanks! :up:

BirdOPrey5 14 Aug 2010 20:57

Quote:

Originally Posted by yotsume (Post 2083906)
Works Great!

However... I changed the width to: width="100%". Looks even nicer using a %. This way the pdf view window is the full size of the post. In my case I used this inside of a vbadvanced bb code page with no wrapper.

Thanks!

Thanks for the suggestion, I personally prefer the smaller box but whatever works for you is good. :)

Quote:

Originally Posted by SublimeBoa (Post 2083914)
Simple to install, user friendly and works nicely.

Thanks! :up:

No problem. :up:

SublimeBoa 15 Aug 2010 02:17

Is there a way to adjust it so the scroll wheel works when outside the pdf itself? It scrolls the pdf just fine, but will not scroll the web page.

Thanks
Rick

SublimeBoa 15 Aug 2010 02:18

Never mind. Guess it just wanted to mess with me. Works fine now.

yotsume 15 Aug 2010 02:25

Your scroll wheel will detect where you have clicked on the page. So if you clicked on the pdf scroll bar your scroll wheel will move that bar instead of the pages bar. Click on a portion of the page and it will detect the pages scroll bar instead. ;)

SublimeBoa 15 Aug 2010 02:39

Thanks!

yotsume 15 Aug 2010 05:34

1 Attachment(s)
There is a small problem with the BB Code. Popup menus in VB will open under the embedded PDF. (see attached screenshot)

I believe the same way that flash can be made to open under menus... the PDF can be made to as well by adding a line of code that makes it "transparent".

UPDATE: Using a transparent or opaque mode will not work with a PDF because the adobe plugin doesn't currently support them for PDFs yet. I hope another solution to this issue can be found...

BirdOPrey5 15 Aug 2010 14:50

yotsume- I can confirm I do have this bug too, thanks... I guess the work around for now is to leave some empty lines before embedding the PDF, though for me it's not nearly as big an issue because of my choice to have a fixed width and most of the menus still very visible. This doesn't seem like it would be a problem if a pdf was posted in anyplace but the top of the first post.

I will see if I can find a solution.

BirdOPrey5 15 Aug 2010 15:56

I've been playing with z-index values all morning but this is apparently a common issue with flash too and there is no solution for that either- when something loads via a plugin all bets are off on how it displays :( Will keep looking but it does not look good.

trotskid 15 Aug 2010 18:10

Nice BB code, but page on forum doesn't scroll with mouse wheel on Firefox.

SublimeBoa 15 Aug 2010 20:24

Quote:

Originally Posted by trotskid (Post 2084338)
Nice BB code, but page on forum doesn't scroll with mouse wheel on Firefox.

I had the same glitch with FF no matter where I clicked, then it just started working right.

yotsume 16 Aug 2010 04:24

Quote:

Originally Posted by BirdOPrey5 (Post 2084277)
I've been playing with z-index values all morning but this is apparently a common issue with flash too and there is no solution for that either- when something loads via a plugin all bets are off on how it displays :( Will keep looking but it does not look good.

The flash issue is actually easy to solve. This PDF issue however requires you to wrap it in an iframe and then use a lower z-index then the popup menu. Its a pain but for now not a big issue for me. Maybe Adobe will fix it in a new plugin update???

BirdOPrey5 16 Aug 2010 04:34

I actually tried the iframe 'solution' I found posted but in fact it still wasn't working for me even with the iframe-div-iframe codes I found.


All times are GMT. The time now is 10:08.

Powered by vBulletin® Version 3.8.12
Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.