How to insert a PDF document in Virtual Tour

  • Hello, i dont understand something or too complicated for me.

    One client wants have the possibilitie to press a button (plugin) and it will appear a pdf document in the same window.

    If i ve well understand, it s a javacript with by example Thickbox.

    Someone can explain to me how i must do ?

    thx the pro's

    Edited once, last by stretchie (July 3, 2011 at 2:11 PM).

  • What do you mean "the same window"?

    Do you want it in the same browser window? then you just can do openurl('linkto.pdf", _parent"); if you want to keep the tour in the background, then you need a thickbox, or some SWF plugin that can read pdf's.

  • In my XML KRpano, i ve put :

    <script type="text/javascript" src="thickbox/jquery.js"></script>
    <script type="text/javascript" src="thickbox/thickbox.js"></script>
    <link rel="stylesheet" href="thickbox/thickbox.css" type="text/css" media="screen" />

    I've created a button :

    <data name="buttontext">
    <p align="center">
    <font face="Arial" size="20">
    OPEN<b>PDF DOCUMENT</b>
    </font>
    </p>
    </data>

    <plugin name="button" url="%SWFPATH%/plugins/textfield.swf"
    align="bottom" y="52" width="350" height="30" children="false"
    html="data:buttontext"
    background="true"
    autosize="center"
    onclick="action();"
    />

    I want when i click on "Open Pdf Document", the pdf document appears in my virtual tour in a box.

    and yes, its for a "pop-up" in the virtual tour like this LINK > Iframedcontent demos


    thx a lot Zephyr

  • it cant be done. google for pdf in thickbox. a while back i needed that and had to manually modify the thickbox.js to allow it to embed a pdf. even after i got it to work it was not 100% sometime all it would load was a red X. why not create a jpg of the pdf at 100% and put that into a scrolling textfield. it would be very close to the same thing. place a link in the textbox to allow direct downloading of the pdf if the jpg is not good enough. i just know for sure showing a pdf in thickbox is not doable without a hack of the js.


    i did some digging and found my old tour where i used this, like i said it was not a 100% fix when it did work and i think FF does not support this at all. so i already undid my use of pdfs in that tour but there was 1 thickbox files left in the folder. one is the js that comes with the actual download, one is the modded version that sort works with pdfs. i dont know which is which anymore but 1 of them is setup for the pdf hack.

    http://www.virtualnorthland.com/tb_pdf.rar

    plus if they do not have the pdf brouser plugin then it will not work no matter what brouser is being used.

    Edited 2 times, last by VN2011 (July 4, 2011 at 3:03 AM).

  • a pdf can be loaded in a browser, or even in an iframe (http://www.cs.tut.fi/~jkorpela/html/iframe-pdf.html) A lightbox/thickbox/shadowbox etc can load content in an iframe, so it should be possible.

    I haven't used thickbox in years, I use fancybox now, together with jquery and wrote a javascript function that opens that popup.

    then in krpano:

    Code
    onclick="js(openPopup('a title', 'linkto.pdf', 500, 500, 'iframe'))"

    here is fancybox
    http://fancybox.net/

  • I followed this advice - https://krpano.com/forum/wbb/inde…d&threadID=5437, all works fine. Probably the same way you can insert into a panorama, and Google maps, and galleries and html pages using iframe. How this can be prescribed in xml file?

    Html I added this:

    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script type="text/javascript" src="fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
    <link rel="stylesheet" href="fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
    <script type="text/javascript" src="fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
    <script type="text/javascript">

    function openPopup(t,linktourl,w,h,type)
    {
    $.fancybox({
    'title' : t,
    'width' : w,
    'height' : h,
    'href' : linktourl,
    'type' : type,
    'autoScale' : 'true',
    'overlayColor' : '#000000',
    'overlayAlpha' : '0.3'
    });
    }
    </script>


    I added in the description in hotspot:
    onclick="js(openPopup('picture', 'something.jpg', 1000, 1000, 'iframe'))"


    This works for video, single images, pdf files. But as it is possible to insert, for example, a link to Google maps or gallery?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!