WordPress.org

Ready to get started?Download WordPress

Forums

Easy FancyBox
Open PDFs in "Fit One Full Page to Window" mode by default (12 posts)

  1. tombyrnes
    Member
    Posted 1 year ago #

    Hi

    I've just started using your excellent plugin. I'd like PDF files to open in "fit one full page to window" mode. I've tried amending the "view=FitH" entries in easy-fancybox-settings.php thinking that this might do the trick. I guessed at FitW and Fit1 - they had some effect but not the one I desired.

    Is this possible? I'm happy to make changes to the PHP and js files if need be (and I understand the implications re upgrading).

    Thanks in anticipation.

    Tom Byrnes

    http://wordpress.org/extend/plugins/easy-fancybox/

  2. tombyrnes
    Member
    Posted 1 year ago #

    More:

    I've now found that changing the 3 "zoom=80,0,0" to "zoom=page,0,0" in line 596 of easy-fancybox-settings.php has the desired effect. But this was blind guesswork. Is there a better way?

    Thanks

  3. tombyrnes
    Member
    Posted 1 year ago #

    Even More:
    The previously posted hack did not quite work.... I have now changed the 3 "view=FitH" entries to "view=FitV" (guessing that maybe H didn't stand for height but horizontal??), and for good measure, I've change the 3 "zoom=80,0,0" to "zoom=40,0,0".

    With this hack, I now find that I get the full page view (give or take a % point) when it opens in IE9, IE8, Firefox (latest). But no luck with Google Chrome.

    I'am about to try the development version to see if that makes a difference.

  4. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Tom, it's hard to control the PDF browser plugin because it can behave differently across different browsers. Your guess work is probably even closer than I ever got so thanks for sharing your findings...

    If you would like to try a different approach, with some more freedom, see http://demo.status301.net/easy-fancybox-sandbox/pdf-embeds/ where each first link on each new line represents a different method of embedding a PDF in a FancyBox frame. The last one is probably the most cross browser compatible as it does not need any PDF browser plugin. But then again, you might find that one even harder to control in displaying page size at your desired format. Unless it does so by default ;)

  5. tombyrnes
    Member
    Posted 1 year ago #

    Hi Ravan

    Firstly thanks for replying. I was tearing my hair out with this.
    Secondly, I did click on your donate link but it was all in French and I freaked out. But I'd be happy to kick some money in - your plugin has been most helpful. Let me know if you have an easier donate link.

    On the PDF front, I look the liberty of adapting your plugin - well butchering it more likely - and I was able to finally get it working in a stable manner across IE, FF, Safari and Chrome in a number of OS environments. See the page from a test site below. I went to Fanybox 2.1.3 to do this. I think the code will show everything you need to know. (I didn't use your option structure yet as it was necessarily complex and my needs were quite specific).

    http://modedion.cairohouse.net/my-back-pages/

    I did try using Google Docs to get around acrobat but found it unsatisfactory as it essentially converts the PDF into an image which rather defeats the whole purpose. And acrobat seems, so far, to not be an issue with this approach.

    Thanks again.

  6. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    So basically you found that, code like

    <embed src="http://.../.../.pdf#nameddest=self&page=1&view=FitV,0&zoom=40,0,0&toolbar=1&navpanes=0" type="application/pdf" height="99%" width="100%">

    works better than

    <object data="http://.../.../.pdf#nameddest=self&page=1&view=FitV,0&zoom=40,0,0&toolbar=1&navpanes=0" type="application/pdf" height="100%" width="100%">
      <param name="src" value="http://.../.../.pdf#nameddest=self&page=1&view=FitV,0&zoom=40,0,0&toolbar=1&navpanes=0">
      <embed src="http://.../.../.pdf#nameddest=self&page=1&view=FitV,0&zoom=40,0,0&toolbar=1&navpanes=0" type="application/pdf" height="100%" width="100%">
    </object>

    ?

    I'll have to check that out... If that is the case, it can easily be adapted :)

  7. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    Could you check out http://demo.status301.net/easy-fancybox-sandbox/pdf-embeds/ again and tell me if the first method works better for you now?

  8. tombyrnes
    Member
    Posted 1 year ago #

    Hi Ravan

    Sorry I probably destroyed that test page link due to other changes I was making. (I thought you were in a way different time zone and wouldn't get to it so soon). It's now looking better - but you seemed to have worked it out.

    Yes, I found that going from object to embed was the big difference. I'll check out sandbox link, and report back. (I did try downloading the development version about a week or so back and couldn't get it to fire the popup - kept opening up the PDF in the same page or another tab. Usually this seems to mean that there is some syntactic problem with the embedded javascript. Anyway, it's probably changed.)

    I'll report back.

  9. tombyrnes
    Member
    Posted 1 year ago #

    Hi Ravan

    Basically it worked quite well. I could re-open the same PDF under IE repeatedly with no problems. It worked across my 4 PCs under IE9 and Ie8, FF, Chrome and Safari. (Win 7 64-bit, Win 7 32-bit and 2 XP SP3 machines, one of which has acrobat 9 installed and the other acrobat XI - the Win 7 machines have XI installed). The display of the page was "off-centre" in Chrome but that just seems to be Chrome.

    I also noticed that the rendering of the page was faulty on IE9 32-bit on the Win 7 64-bit PC - I've emailed you an image - basically some letters were just missing from the Todd Moore title - weird.

    (I have experienced similar wirdness with IE9 on win7 64-bit when playing youtube videos using the fancybox 2.1.3 - the video is hidden behind the white background of the popup. With some extra CSS applied to that skin it then works OK).

    The other minor - and repeatable - problem I had was on the 2 XP machines. If one opened IE and plugged in that address, the first time it would take you to a full acrobat page - ie no popup. If you cleared the cache and closed and reopened IE the same thing would happen. Subsequent clicks of method 1 worked fine. And when it pulled the page down the very first time (or after clearing the cache), it would show a JS error on line 33 char 1623 in coolclock.min.js. Thereafter error disappeared and it worked fine. But if that error came up (as it did on iniial load), then popup would not fire.

    Trust this is helpful.

    Cheers

    Tom

  10. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for this extensive testing!

    I wonder if that coolclock thing that is running on that same test site (which uses Google's excanvas.js for IE8 and older) might be interfering here. If you would like to test again without it, I have removed all that...

    But I can understand if you have ahd enough or you want to go for the iframe method anyway ;)

    As I'm in Europe, I'm going to bed now but will be back online tomorrow at the end of the day. Just let me know and thanks again :)

  11. tombyrnes
    Member
    Posted 1 year ago #

    Ravan

    Taking out that coolclock fixed the first time/JS problem on both XP/IE8 machines, and also corrected the rendering problem on Win7 64bit / IE9 32 bit. So all looks good and stable with embeds.

    Cheers

    Tom

  12. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    That's good news. This embed code variant will make it into the next release... Thanks for reporting back :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic