locked
Sharepoint 2010 - Opening PDF's in search results: "The filename, directory name, or volume label syntax is incorrect" RRS feed

  • Question

  • Hi guys,

    Was hoping you could help me?

    I am running a SharePoint 2010 public site with anonymous access turned on. This issue is affecting host header site collections, all on the same web application. 

    When trying to open PDF documents from the search results in adobe reader. I get the "There was an error opening this document. The filename, directory name, or volume label syntax is incorrect" error.

    * Permissive is turned on

    * Server default (open in browser) is turned on for the library that has the documents

    * This issue does not affect office documents  

    * If the PDF opens in the browser window, it works

    * If the PDF opens in Adobe reader client, it gives the error "There was an error opening this document. The filename, directory name, or volume label syntax is incorrect"

    * If a new user to the site opens a PDF, the PDF opens in the IE window successfully. However if they click allow to the prompt in IE for the the Adobe Active X, any PDF after that will be opened in the Adobe client, and give the error.

    * Firefox and Chrome open the document in the browser fine

    * If you right click on the document link and open in a new IE tab, it opens fine.

    Any ideas?

    Thanks,

    Mitch

    Wednesday, September 4, 2013 11:43 PM

Answers

  • Hi guys,

    A colleague of mine found a solution/workaround to this issue. See info below:

    Issue:

    Unable to open PDF documents from search results pages in SharePoint 2010.  The Adobe reader plugin would try and open the file with the reader application and give the error "There was an error opening this document. The filename, directory name, or volume label syntax is incorrect"

    Cause:

    The adobe pdf plugin was opening the full path of the document from the search results page, instead of the relative path. Other PDFs, when opening them from the library worked fine.

    Workaround/Fix:

    Put the following piece of code in the page layout for the search results page:

    <script type="text/javascript">

    var currentHostName = window.location.protocol + "//" + window.location.hostname

    $(function(){

        $('a[href$=".pdf"]').attr('href',function(index,value){

                return value.replace(currentHostName,'');

            });

    });

    </script>

    • Marked as answer by Mitch B_83 Monday, December 2, 2013 4:12 AM
    Monday, December 2, 2013 4:12 AM

All replies

  • The problem seems to be related to your Active X plug in not with the SharePoint.

    #RoHsTr

    • Marked as answer by tracycai Thursday, September 12, 2013 2:04 AM
    • Unmarked as answer by Mitch B_83 Monday, December 2, 2013 4:07 AM
    Thursday, September 5, 2013 5:08 AM
  • I'm not sure why this was marked as answered.......

    Is there an answer to this issue?

    I have users experiencing this as well.

    -bill

    Monday, October 7, 2013 2:51 PM
  • This post is more informative and has solutions.

    Sharepoint 2010 Adobe Reader error opening .pdf files

    -bill

    Monday, October 7, 2013 2:53 PM
  • Hi guys,

    A colleague of mine found a solution/workaround to this issue. See info below:

    Issue:

    Unable to open PDF documents from search results pages in SharePoint 2010.  The Adobe reader plugin would try and open the file with the reader application and give the error "There was an error opening this document. The filename, directory name, or volume label syntax is incorrect"

    Cause:

    The adobe pdf plugin was opening the full path of the document from the search results page, instead of the relative path. Other PDFs, when opening them from the library worked fine.

    Workaround/Fix:

    Put the following piece of code in the page layout for the search results page:

    <script type="text/javascript">

    var currentHostName = window.location.protocol + "//" + window.location.hostname

    $(function(){

        $('a[href$=".pdf"]').attr('href',function(index,value){

                return value.replace(currentHostName,'');

            });

    });

    </script>

    • Marked as answer by Mitch B_83 Monday, December 2, 2013 4:12 AM
    Monday, December 2, 2013 4:12 AM
  • Hi guys,

    A colleague of mine found a solution/workaround to this issue. See info below:

    Issue:

    Unable to open PDF documents from search results pages in SharePoint 2010.  The Adobe reader plugin would try and open the file with the reader application and give the error "There was an error opening this document. The filename, directory name, or volume label syntax is incorrect"

    Cause:

    The adobe pdf plugin was opening the full path of the document from the search results page, instead of the relative path. Other PDFs, when opening them from the library worked fine.

    Workaround/Fix:

    Put the following piece of code in the page layout for the search results page:

    <script type="text/javascript">

    var currentHostName = window.location.protocol + "//" + window.location.hostname

    $(function(){

        $('a[href$=".pdf"]').attr('href',function(index,value){

                return value.replace(currentHostName,'');

            });

    });

    </script>

    Solution works for SharePoint 2013 too, thanks!
    Thursday, January 9, 2014 1:23 AM
  • how to do this workaround? 

    Put the following piece of code in the page layout for the search results page:

    Tuesday, February 11, 2014 11:05 PM
  • Hi guys,

    A colleague of mine found a solution/workaround to this issue. See info below:

    Issue:

    Unable to open PDF documents from search results pages in SharePoint 2010.  The Adobe reader plugin would try and open the file with the reader application and give the error "There was an error opening this document. The filename, directory name, or volume label syntax is incorrect"

    Cause:

    The adobe pdf plugin was opening the full path of the document from the search results page, instead of the relative path. Other PDFs, when opening them from the library worked fine.

    Workaround/Fix:

    Put the following piece of code in the page layout for the search results page:

    <script type="text/javascript">

    var currentHostName = window.location.protocol + "//" + window.location.hostname

    $(function(){

        $('a[href$=".pdf"]').attr('href',function(index,value){

                return value.replace(currentHostName,'');

            });

    });

    </script>

    Solution works for SharePoint 2013 too, thanks!

    I put this in content edit webpart and it not working
    Wednesday, October 8, 2014 7:08 PM
  • Hello,

    I have tried your solution and I just can't seem to get it to work. Can you provide with some assistance on where to put this.

    I don't have it on a results page but what i have is just a page with pdf documents and as soon as I click on it it gives me this error.

    Any help would be appreciated.

    Tuesday, December 9, 2014 8:46 PM
  • Hello,

    I have tried your solution and I just can't seem to get it to work. Can you provide with some assistance on where to put this.

    I don't have it on a results page but what i have is just a page with pdf documents and as soon as I click on it it gives me this error.

    Any help would be appreciated.

    Tuesday, December 9, 2014 8:47 PM