Sign up for Office 365
Learn more about Office 365
I noticed the behavior you describe. I spent a while and made some improvement, but never solved the problem completely.
The menu option generates in script every time you drop down so it's unaffected.
Perhaps someone in the community will have the skills & time to work through this.
Thanks for the feedback.
Josh - thanks so much for this solution. We have 40 site collections all with subsites and tons of libraries and Microsoft really left us to die here. At least your solution gives us a ray of light.
One question I had that I didn't see brought up here - is there a way to edit the .js file to have the PDF open in a new window. This way we don't have to instruct users to hold down CTRL.
Thanks again for all your efforts.
I think I did what you suggested, but am getting the following error (at least it's moved)
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; MS-RTC LM 8)
Timestamp: Mon, 19 Dec 2011 17:09:50 UTC
Message: 'href' is null or not an object
Line 113 is var c = b.href;
@PartlyCloudy and others who've requested opening PDFs in new window:
Please download this file and replace your /utilities/pdf.js with this one. I tested minimally, please test it out to see if it opens in new window as you would like. If it works well let me know and I'll update my utilities files to benefit future folks.
@PartlyCloudy, with a large implementation, you may find it easier to apply the script to you master pages using sharepoint designer. This requires a change to the script. Please read above and let me know how it goes.
@Sharon, The error is in the code that builds the menu drop down option. Beside the menu option, can you tell me whether the icon and file link are working? If not what are the symptoms for those enhancements?
Josh - the new file worked and opens the PDFs in a new tab in IE9 both when you click the filename and when you select Open from the drop down.
I will try applying your solution to the master pages and let you know.
This is AWESOME! No script errors, Icon is showing, Drop Down is working (5 libraries deep!). THANK YOU SO MUCH!!!!
This little problem was stopping me from publishing and allowing people onto our Office 365 Site.
Josh, I'll be visiting your site and making a nice contribution for sure!
I have a requirement to open .pdf file in browser in sharepoint online that is linked to another .pdf file in a seperate folder(linked with bookmarks) . This is working fine in Sharepoint 2010 when browser file handling is set to permissive. above solution works perfectly for opening .PDF files in browser, however linked .PDF files will not work.
Are there any solutions to open linked .pdf files in browser with sharepoint online.
I've never used bookmarks in PDF files before, but I assume it may work if you could alter the urls in the pdf file to use the following syntax:
I need to alter bookmarks for many pdf files and tried creating a console application that can read and alter the bookmarks. I could retrieve the pdf bookmarks using itextsharp, however didn't succed to retrieve the bookmark url that will enable me to alter with above syntax.
Any pointers to retrieve pdf bookmark url using itextsharp will be helpful.
Josh - just wanted to update you and people following this thread regarding the alternative for installing in each library.
I installed the .js reference into the v4.master file (after the body tag) for each of my sites and removed the script tags from the .js file. This worked perfectly.
In addtion to making this easier to apply to sites with many libraries, I also found a few other advantages over applying at the library level with the content editor web part. When applying at the v4.master level, all new libraries created, regardless of template used, will contain the fix automatically. This avoids having to recreate your library templates if you have a lot of them. Also, the problem with the ribbon losing focus as described in other posts here does not happen when the fix is applied to the master page.
Thanks again for this solution - it was a life saver.
Thanks for the update. Glad you got it working well using the masterpage reference.
Have a great day!
This is in reply to the following comment on the wiki page which is associated to this thread. I didn't create the wiki, so I don't get notified of comments there...just happended accross it today.
Please use this this thread for questions instead of the wiki page.
Josh - been in touch with you in the past for some troubleshooting and have one more question. We are working to open a PDF in a list, and have been unable to tailor the .js to get it to see the .pdf hyperlink. The one for the calendar attachments works great, but lists appear to be handled differently. Any ideas?
Hi again Art,
Not sure I understand completely, but I'll give it a shot.
So you added the additional script to your calendar form pages so PDF attachment links now open in the browser, correct?
Are you saying that attachment links on form pages of another list don't work?
If so, then you'll need to add the CEWP and reference pdf_forms.js to the EditForm.aspx and DispForm.aspx of that list too. I'm sure theres a way to do this in the master page, but it broke the doc lib enhancements on my first try and I havn't had time to revisit. PS...I don't use list attachments.
If I'm not uderstanding you correctly then please reply with more details.
Have a Great Day,
You have outlined the problem perfectly. Of course, since the editform.aspx and dispform.aspx are both pop up windows, the pdf_forms.js doesn't run on them and they cannot be edited via sharepoint designer. So I'm stuck. We have tailored an "issue" list to work as an ordering platform for our company, where orders are attached to a new issue list item for processing. Most of these are in PDF, as they are scanned, and it would greatly help our order dept to simply click on them rather than having to save/open. I have played around in the V4.master, but have no idea where to place the .js. I tried to emulate what PartlyCloudy had done to put the solution at a root level, but couldn't figure out where the "body tag" ended. Bottom of the page? Right below \body? Can you say "end user"? lol.
Anyway - your continued help on the PDF issue is greatly appreciated.
Glad to reach you. Because I tried the master page thing and it had issues, I wouldn't recommend that for forms pages unless you have time/skills to work it out.
Using Content Editor on the Forms pages will work the same as you got it to work for the calendar forms. As in this article:
Here are some hints....
To get your forms to open in the browser when the list is set to display modal pop-ups you can type the url directly into the browser address:
to get that form into edit mode so you can add the CEWP add this:
I think that's where you're hung up. Now you should be able to follow the steps in the above article to reference pdf_forms.js in CEWPs on both the dispform.aspx and editform.aspx for the respective list.
It's not nessessary in this case if you use the browser edit mode described above, but you can edit forms in SPD on the list settings page under forms:
Also FYI, you can specify whether forms open in modal dialogs in the List Settings | Advanced Settings page:
Let us know how it goes.
Opening the editform.aspx in the browser to add the CEWP was the key. Thanks so much for your help!