Quantcast
Channel: SharePoint 2013 - Setup, Upgrade, Administration and Operations forum
Viewing all articles
Browse latest Browse all 21070

Users are not able to checkout PDF files in IE Browser SharePoint 2013

$
0
0

Users are not able to check out PDF files in IE browser in SharePoint 2013 but they r able to do in desktop adobe. 

to fix this for IE , i did following steps, though it is not working yet

PDFFIX.js placed under C:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions15TEMPLATELAYOUTS"

(function () {


    if (typeof SPClientTemplates === 'undefined')


        return;


    var PdfCtx = {};


    PdfCtx.Templates = {};


    PdfCtx.Templates.Fields = { 'LinkFilename': { 'View': PdfClientLinkFilenameNoMenu } };


    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(PdfCtx);


})();


function GetExtension(szHref) {


    var sz = new String(szHref);


    var re = /^.*\.([^\.]*)$/;


    return (sz.replace(re, "$1")).toLowerCase();


}


var stsOpen = null;


function IsPdfClientInstalled() {


    if (stsOpen == null) {


        if (Boolean(window.ActiveXObject)) {


            try {


                stsOpen = new ActiveXObject("PdfFile.OpenDocuments");


            }


            catch (e) {


                stsOpen = null;


            }


        }


    }


    return (stsOpen != null);    


}


function OpenPdfInClient(pdfFileUrl) {    


    var fRet = true;


    try {


        fRet = typeof stsOpen.ViewDocument2 != "undefined" && stsOpen.ViewDocument2(window, pdfFileUrl, '');


    }


    catch (e) {


        fRet = false;


    };


    if (event != null) {


        event.cancelBubble = true;


        event.returnValue = false;


    }


    return fRet;


}


function PdfNewGif(listItem, listSchema, ret) {


    if (listItem["Created_x0020_Date.ifnew"] == "1") {


        var spCommonSrc = GetThemedImageUrl("spcommon.png");


        ret.push("<spanms-newdocument-iconouter\"><imgms-newdocument-icon\" src=\"");


        ret.push(spCommonSrc);


        ret.push("\" alt=\"");


        ret.push(Strings.STS.L_SPClientNew);


        ret.push("\" title=\"");


        ret.push(Strings.STS.L_SPClientNew);


        ret.push("\" /></span>");


    }


}


function PdfClientLinkFilenameNoMenu(param1, param2, listItem, listSchema) {


    var ret = [];


    var fileUrl = listItem.FileRef; 


    if (fileUrl != null && typeof fileUrl != 'undefined' && TrimSpaces(fileUrl) != "") {


        if (listItem.FSObjType == '1') {


            if (listSchema.IsDocLib == '1') {


                RenderDocFolderLink(ret, listItem.FileLeafRef, listItem, listSchema);


            }


            else {


                RenderListFolderLink(ret, listItem.FileLeafRef, listItem, listSchema);


            }


        }


        else {


            ret.push("<a href=\"");


            ret.push(listItem.FileRef);


            ret.push("\" onmousedown=\"return VerifyHref(this,event,'");


            ret.push(listSchema.DefaultItemOpen);


            ret.push("','");


            ret.push(listItem["HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon"]);


            ret.push("','");


            ret.push(listItem["serverurl.progid"]);


            ret.push("')\" onclick=\""); 


            var appInstalled = IsPdfClientInstalled();


            var szExt = GetExtension(listItem.FileRef);


            if (appInstalled && szExt == 'pdf' && browseris.ie) {


                ret.push("return OpenPdfInClient('");


                ret.push(window.location.protocol + "//");;


                ret.push(window.location.hostname);


                ret.push(listItem.FileRef);


            }


            else {


                ret.push("return DispEx(this,event,'TRUE','FALSE','");


                ret.push(listItem["File_x0020_Type.url"]);


                ret.push("','");


                ret.push(listItem["File_x0020_Type.progid"]);


                ret.push("','");


                ret.push(listSchema.DefaultItemOpen);


                ret.push("','");


                ret.push(listItem["HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon"]);


                ret.push("','");


                ret.push(listItem["HTML_x0020_File_x0020_Type"]);


                ret.push("','");


                ret.push(listItem["serverurl.progid"]);


                ret.push("','");


                ret.push(Boolean(listItem["CheckoutUser"]) ? listItem["CheckoutUser"][0].id : '');


                ret.push("','");


                ret.push(listSchema.Userid);


                ret.push("','");


                ret.push(listSchema.ForceCheckout);


                ret.push("','");


                ret.push(listItem.IsCheckedoutToLocal);


                ret.push("','");


                ret.push(listItem.PermMask);


            }


            ret.push("')\">");


            var fileRef = listItem["FileLeafRef"];


           if (fileRef != null) {


                var index = fileRef.lastIndexOf('.');


                fileRef = index >= 0 ? fileRef.substring(0, index) : fileRef;


            } 


            ret.push(fileRef);


            ret.push("</a>");


            PdfNewGif(listItem, listSchema, ret);


        }


    }


    else {


        ret.push("<nobr>");


        ret.push(listItem["FileLeafRef"]);


        ret.push("</nobr>");


    }


    return ret.join('');


}

-----------------------------

then To set the LinkFilename , we ran following script,

$web = Get-SPWeb http://dev.sp.com/teams/site1/subsite
$list = $web.Lists["TestLib"]
$field = $list.Fields.GetFieldByInternalName("LinkFilename")
$field.JSLink = "/_layouts/15/PdfFix.js"
$field.Update($true)

--------------------------------------------------

i modified DOCICON.xml file for following tag,

<Mapping Key="pdf" Value="icpdf.png" EditText="Adobe Acrobat" OpenControl="AdobeAcrobat.OpenDocuments" OpenApp="AcroRd32" />

-------------------------------------

i also checked mimetypes as below,

$webApplication = Get-SPWebApplication("http://dev.sp.com/")
$webApplication.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
$webApplication.Update()

applications\pdf is there part of mimetypes 

-----------------------------------------------------

when i did all above steps, users are able to check out pdf file in desktop when they open pdf file from document library in SP2013 env. but they neither able to open pdf file in browser nor able to check out pdf file in browser, though i also set opening documents in the browser in library advanced settings.

---------

our SharePoint environment as below,

SharePoint 2013 &&

Configuration database version:15.0.5189.1000

----------------------------------------------------

how can i fix this issue?  

Thanks

DK


Viewing all articles
Browse latest Browse all 21070

Trending Articles