• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Add-on to enable embed PDF files in forum posts

i realized it a bit later. i was actually not looking to embed docs stored on my google docs account. i was looking for a way to embed PDF files hosted on web servers!

google docs viewer is perfectly capable of rendering them... http://docs.google.com/viewer
 
i had to modify your first code coz you said it was designed to work on your localhost!

i added the google doc viewer parameters:

2YXP7.png


http://techwhack.net/threads/3d-crt-lung.2/page-4#post-37
 
ok. you are probably misunderstanding me.

i just want to embed PDFs.

google docs has nothing to do with it. i have been talking about google docs viewer because it is a free web service and does not require any browser plugin.

(i do not want to embed my google docs hosted documents)

i am not sure if there is any other service that would render PDF files inside the web browser without a plugin! :)
 
Yeah I was a little confused I just woke up a short while ago after a good sleep.

Well I just made a modifacation to that same code myself while you were making yours :-) the one I made lets me upload my pdf somewhere else..and embed it in the forums.

The first one I made works with the uploader I made to upload pdf's as well as images and videos to the data/media directory which just made more because jaxels medio addon uses that directory by default when looking for local videos to be embedded. The uploader echos the embed code so a user can copy paste it and not have to do anything other than that. I can pm you a link if you would like to test it on my testbed domain to see what the code was intended to be used in conjunction with.

BTW good work with the gdoc code...please if you will post it in the bbcode repository thread and I will replace my post with another code since yours seems more appropriate so keep that bbcode tag on it. I'll drop it from mine. :-)
 
Try this.
Code:
Example - use everything after the srcid= in the document address when posting
[gdoc]0B9ipbLFXjUqUNDZiZWNjNGItOGY4Ni00ZjE1LTliMjctNGU0ODc0YjQ1YWZk&hl=en&authkey=CIO5w-8O[/gdoc]

Code:
Replacement start
<iframe width=800 height=600px frameborder=0 src=https://docs.google.com/viewer?a=v&pid=explorer&chrome=false&embedded=true&srcid=
Code:
replacement end
></iframe>

aslkh.webp
 
dude! your code is still for documents hosted on google docs!

let me clarify my query once again :)

supposedly i want to embed this pdf document...

HTML:
http://ccmc.gsfc.nasa.gov/staff/HesseVitae.pdf

Google Docs Viewer code can be used to embed this PDF file using this code in a HTML document:

HTML:
<iframe src="http://docs.google.com/viewer?url=http%3A%2F%2Fccmc.gsfc.nasa.gov%2Fstaff%2FHesseVitae.pdf&embedded=true" width="600" height="780" style="border: none;"></iframe>

Try running this code here: http://htmledit.squarefree.com/ to see what I mean :)

So basically, the user would just post a link to a pdf file like the above link...

And the add-on has to convert that link into the code above.

As in... if URLOFAPDFFILE is the URL to a PDF File... I need the plugin to generate:

HTML:
<iframe src="http://docs.google.com/viewer?url=URLOFAPDFFILE&embedded=true" width="600" height="780" style="border: none;"></iframe>

I just checked the source code on my test installation... The add-on you provided and I modified... renders this code:

HTML:
<iframe width=700 height=600px frameborder=0 src=https://docs.google.com/viewer?a=v&pid=explorer&chrome=false&embedded=true&srcid=[url]http://www.glencoe.com/sec/literature/litlibrary/pdf/tom_sawyer.pdf></iframe>[/url]

the problem is that the add-on is putting in [ url ] [ / url ] in the generated HTML code which seems to be breaking the output. :D
 
Well for some reason that particular pdf I can't embed remotely either though I can embed other ones...maybe that one is protected from it? I can't tell right off the bat.
 
Code:
<iframe src="http://docs.google.com/viewer?url=http%3A%2F%2Fccmc.gsfc.nasa.gov%2Fstaff%2FHesseVitae.pdf&embedded=true" width="600" height="780" style="border: none;"></iframe>

http://htmledit.squarefree.com/

this code renders the PDF file just fine on my tests on htmledit.
 
I tried this and it worked though it does not used the doc viewer powered by google.
Code:
in the pdf tags   -->  http://ccmc.gsfc.nasa.gov/staff/HesseVitae    drop the .pdf from the link when posting

replacement start
<embed src="

replacement end
.pdf#toolbar=0&navpanes=0&scrollbar=0" width="638" height="825" z-index="-1">

hjfjffj.webp
 
Not a problem, hopefully soon we can figure out the right way of doing it as I'm sure I did something wrong
biggrin.png
 
i think the problem is that xenforo is converting the link test in URL code which was breaking my implementation. i could not locate any option to disable that. :)

i should probably try testing with http:// inserted by the bbcode while the user puts the rest of the link inside the bbcode. that just might work.

but in the end, it is too complicated for a novice user. asking him to link to a pdf file inside bbcode without the HTTP:// part!
 
well..
im working on the regex now...

Hopefully if I understand this correctly, this should replace any link resembling http://domain.com/path/to.file.pdf or any permutations of that so long as it ends in .pdf, anyone posting a link will have it convert to the same link wrapped properly in pdf tags with the extension dropped from the post text as the .pdf is already in the bbcode, parsing the link. Someone correct me if I'm wrong about the optional regex on custom bbcodes in BBCM
 
Top Bottom