No one has responded to this discussion for at least a year, so this information may be out of date. If you're looking for information about this topic, please search for a more recent discussion or post a new question.

PDF Solution: Here's How to Display in the Browser

  • This post has 176 Replies |
  • Hi Guy,

    Thanks for trying the solution.

    Okay, so you're doing great.  Unfortunately, for some P1 users the error when using my template to create the library results in a library with no files, yet for others the files are created and all is good.  I'll add this to the many other issues with using templates in o365.

    Anyway, I've abandoned the template method and reworked my instructions into 2 steps the first of which is to create your own doc lib called utilities.  You've done that.

    The second step is to download the zip file from my site, extract them and then upload them individually to your Utilities Library.

    This should work well for folks who want to install updated versions of the scripts by simply repeating step 2 to overwrite the Utilities Files.

    Please go to my instructions and carry-on with step 2.

    Let me know how it goes.


  • Hi jbooker,

    Like everyone else, I'm grateful for your time and effort solving this perhaps tiny but albeit huge problem we have with o365.

    Now to my own implementation. Our main document library uses "document sets". Before I try to implement your solution on this type of document library, do you have any caveats concerning your solution on document sets?



  • Kanystrom,

    I haven't tried this on a document set view.  It works with folders and on grouped views.  It's easy to remove the affects should you have a problem by simply removing the content editor web part from the page.

    Worse case is the PDF related enhancements simply fail.

    Let us know how it goes.



  • Hi again,

    It worked beautifully. My users are already providing enormously positive feedback. How Office365 handles PDFs has been nothing short of a disgrace. With your solution in place we can love Sharepoint unconditionally :-)

    One more thing, though. And this might be something that has been discussed earlier. When I implement your solution on our main document library, the shortcut to the different views disappear from the breadcrumbs. Instead, I know have to mark a document in order to change the ribbon and there get to the views. Is there anyway of getting the views back to the breadcrumbs?

    Many thanks for your excellent work and immediate feedback,


  • Andreas,


    Yes the behaviour you describe (Missing Library Tools & Breadcrumbs View Selector) are by design in Sharepoint, albiet lazy design, unfortuneately.


    This is because more than one web part exists on the page.  A lazy effort to handle the case that view selection is not applicable to the selected web part.  Could they not have made it work regardless of selected part when the page is a Doc Lib View Page?  That's what the page will always be regardless of how many wps I may add.  Silly.


    Basically, after you add another webpart (CEWP in this case) the Document list view must be selected to see the contextual Library Tools.  I worked out a short script to select the WP, but haven't tested on many views yet.  You could try adding this to the PDF.js and see if it behaves well on your site:


    <script type="text/javascript">
    function SelectWP(){
    //select first webpart
    var wp = document.getElementById("_wpSelected");
        if (wp != null){
     wp.value ="MSOZoneCell_WebPartWPQ2";
     SelectRibbonTab('Ribbon.Document', true)
     ExecuteOrDelayUntilScriptLoaded(SelectWP, "sp.ribbon.js");


    Basically it selects the document list view wp and then shows the document ribbon upon opening the page.  If you click outside the list view the ribbon will disappear again because it's contextual, but at least it appears upon entry which may keep folks from scratching their heads trying to find the upload button.


    After some more testing I'll probably add this to my PDF script.  Your feedback is appreciated.


    As for the view selector, I've not delved into it yet nor have I found anyone else who has.  Some day maybe.

    Check this out:


    I'm sure there's a away to turn the view selector back on in javascript, but I haven't found anything.



  • So after having some time to revisit this, i got it to work with your newest version without too much hassle. - Love the solution :)

    However, i found out a couple of things im not sure is expected behaviour or not.

    Firstly, my site is organised in a way like this: Sharepoint site->Document site->Multiple Document Libraries, not sure if this is an unusual way to organize it.

    It seems that the Content web-part cannot be added in the "root" of the document site for it to work (On the page with the "Relevant Documents" web-part), so i have to add it to the root folder of every document library separately - is this the correct way to implement it? - Might be wise to mention in the setup docs if so that you have to add it to every library if you have multiple ones.

    Also, this leads to the solution not working in the "Relevant Documents" web-part - but thats probably expected?

  • Hi again Josh,

    The PDF-solution is working great -- for my Windows-users. The few, but hardy, mac-users we have are not equally satisfied. When OS X users click on a PDF, they get a "plugin does not exist" comment from Safari and Google Chrome shows a blank page. Is there any way to get your script to work for Apple users?



  • @KKL,

    Yes you have to add the Content Editor WEb part to every page that you want the enhancements.  The alternative is to add the script reference to your master page using sharepoint designer.


    Can they open PDFS in the browser from other websites?  Chrome has a built-in pdf viewer but you have to enable it in the settings somewhere.  Safari may have the same, I don't know.  But if they can open PDFs in browser from other websites, then they should be able to open using this solution.


  • Josh,

    Yup. No problem opening PDFs from other sites in Safari and Chrome. Is there anything in your javascript (I'm not a programmer) that sends commands to Windows-specific solutions?


  • Andreas,


    It has worked in chrome for other users once they enable the PDF plug-in.  Are you sure PDFs are opening in the browser from other sites vs. downloading & opening locally in Adobe?


    The script simply embeds the PDF in the HTML which means it relys on a client-side browser plug-in such as adobe acrobat plug-in for IE or the built-in one for chrome (when enabled).  It will not work if your browser settings are to download and open locally.

    Double check the Chrome setting:

    To enable the built-in viewer, enter about:plugins in the address bar and click Enable underneath the entry for “Chrome PDF Viewer.” The Adobe Reader plug-in is supposed to be automatically be enabled, if you have it installed. 

     Correction:  It's the adobe plug-in for chrome not the built-in one that works.  See the post in this thread :




    Try these options for Safari:



  • Hi all

    I've tried this solution on my computer with IE9 and it works properly. Thanks to Josh for his useful solution. But I've faced and additional issue: when I follow the instructions from Josh, in the docs libraries I've installed the solution I've lost the upper ribbons to get into de library configuration, alerts, Outlook connection, etc.


    The library looks like that:



    What can I do to restore de upper ribbons? I'm positive they're quite necessary to work with the library.


    Thanks again for your support.


    Best regards

  • Hi JI,

    Glad you like the solution.

    You will see a discussion about the ribbon issue in this thread above: Posted by jbooker on 2011-Oct-25 9:33 AM  

    Basically this is by-design behavior in Sharepoint 2010 (unfortunately).  If you click on the library list view the ribbons will appear.  

    You could try to add the script in that post which selects the list view webpart upon opening the page which will display the ribbon.

    I would like to add that to my script, but havn't had time to test and didn't get any feedback from others about it yet.  Feedback appreciated.



  • I did test the script for putting the ribbon back, aand it worked like a charm! - Simple cut-and-paste job.

    Im running O365 E3 plan.

  • Thank you again, Josh. I try by my own too and I'll bring you back my feedback.


  • Thank you, Joshua. Tried that solution and it works as is should have by design :-)

Page 6 of 12 (177 items) «||4|5|6|7|8||»