0
votes

I’m using SharePoint 2010 and InfoPath 2010 on IE 11, w/Windows 7 operating system.

I have an InfoPath form that I want the user to be able to fill in the data and have the option to download a copy (with the data), as a pdf or word document – save as feature.

I see in InfoPath filler (office 2010) I can perform this “save as PDF” function but not in SharePoint 2010. Is there a setting I’m missing or do I have to go the route of extending SharePoint foundation w/ASP.net?

Thanks

2

2 Answers

0
votes

Sorry, there is no native SharePoint 2010 functionality that meets your requirements. But there are several 3rd party tools you can purchase, or, of course, follow your own suggestion and pursue custom options.

0
votes

I created a shim for SP2010 that will cause all Infopath forms in a sharepoint 2010 site to download, as long as the link to the form is in Sharepoint 2010. You will need jquery 1.12 for this to run.

$(function() {
    if (document.getElementsByTagName('BODY')[0].innerHTML.indexOf('.xsn') != -1) {        

        $('a[href$=".xsn"]').each(function(index) {
            var self = $(this); 
            var fileLocation = '';  
            var spDownloadsUrl = '/_layouts/download.aspx?SourceUrl=';         

            //GRAB LINK'S HREF LINK PATH AND URI ENCODE IT
            var currentUrl = encodeURI(self.attr('href'));

            //IF THE HREF IS TO A NETWORK FILE LOCATION EXIT THE PROCESS AND LEAVE IT ALONE
            if (currentUrl.indexOf('file:') != -1) {
                return;
            }

            //SHAREPOINT 2010 DOC LIST ELEMENTS HAVE INLINE JS ALTERING THE LINK BEHAVIOR, SO THEY NEED TO BE REMOVED
            self.removeAttr('onclick');
            self.removeAttr('onmousedown');
            self.removeAttr('onfocus');

            //IF THE LINK'S URL IS ABSOLUTE PATH, BUILD IT AS RELATIVE
            if (currentUrl.indexOf('.com') != -1) {  
                var urlSplitOnDotCom = currentUrl.split('.com');              
                var urlAfterDotCom = urlSplitOnDotCom[1];
                var urlPartsArr = urlAfterDotCom.split('/');

                //REBUILD URL FROM ARRAY
                var newPathname = "";
                for (i = 1; i < urlPartsArr.length; i++) {
                  newPathname += "/";
                  newPathname += urlPartsArr[i];
                }                

                fileLocation = newPathname;     

            } else {
                fileLocation = currentUrl;
            }                        

            //ADD NEW URL TO INFOPATH FILE'S HREF ATTRIBUTE
            self.attr('href', spDownloadsUrl + fileLocation);                           
        });        
    }
});