whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
SUPPORT
whitespace
FORUM
whitespace
FAQS
whitespace
SUBSCRIPTION
whitespace
REQUEST ON-LINE
whitespace
whitespace

Technical Support Forum

Welcome Guest Search | Active Topics | Log In | Register

Link To Document - Edit Mode for PDFs Options · View
jchilde
#1 Posted : Saturday, August 13, 2011 11:20:18 PM
Rank: Member

Groups: Registered

Joined: 5/6/2011
Posts: 10
Is there a way to setup the link to document column to allow it to force PDFs to open in edit mode rather than read only mode?
stets
#2 Posted : Monday, August 15, 2011 1:14:29 PM
Rank: Developers Team

Groups: Registered

Joined: 5/27/2010
Posts: 80
Location: Lviv
Hello,

You can allow to force files to open in edit mode only for Item Display Form. To do this please do following:
1) Open item Display Form in new window
2) Add Content Editor web part to page
3) Edit HTML Source and place the following JavaScript code into it:
Code:

function Link2Doc_OnBodyLoad(){
    var links = document.getElementsByTagName( "A" );
    for( var i = 0; i < links.length; ++i ){
        var el = links[i];
        var ctrlEditor = el.parentNode.parentNode.parentNode.parentNode.parentNode;
       
        //check if link is inside Link to Document column
        if( ctrlEditor && ctrlEditor.id == "SPFieldArtfulBits.LinkToDocument" ){
            var href = el.getAttribute( "href" );
            //logic to figure out extension
            if( href &&( -1 != href.toLowerCase().indexOf( ".pdf" ) ) ){
                //attach click event to open document in edit mode using SharePoint ActiveX control
                Link2Doc_AttachEditMode( el );               
            }
        }
    }
}
function Link2Doc_AttachEditMode(el){
    el.onclick = function (){
        return DispEx(this, event, 'TRUE', 'FALSE', 'FALSE', 'SharePoint.OpenDocuments.3', '0', 'SharePoint.OpenDocuments', '', '', '', '0', '0', '0', '0x7fffffffffffffff');};
}
_spBodyOnLoadFunctionNames.push( "Link2Doc_OnBodyLoad" );


4) And save page
Please let me know if you have any questions.

Best Regards,
Yura Stetsuk
ArtfulBits SharePoint Development Team
jchilde
#3 Posted : Monday, August 15, 2011 9:25:55 PM
Rank: Member

Groups: Registered

Joined: 5/6/2011
Posts: 10
Thank you for your reply. PDFs are being opend in edit mode; however, I realize that I needed to provide you with some additonal information as to my requirements.

I need the pdf to open like it does from a document library.

If I open a PDF in the document library, I am first asked to either "check out and open", or just "open". Then, I can edit the PDF and, upon completion, just hit save and a new version is created in the docuemnt libarary.

However, using a link2document link, although the file now opens in edit mode, Acrobat does not recognize that the file is stored in a document library.

Consequently, I cannot update metadata, I cannot checkout or checkin, and I cannot save without entering a new location. If I save to the same file, it overwrites rather than creating a new version.

So, what I need is to be able to open a file as it it were in a document library.
stets
#4 Posted : Tuesday, August 16, 2011 10:42:10 AM
Rank: Developers Team

Groups: Registered

Joined: 5/27/2010
Posts: 80
Location: Lviv
You should improve Link2Doc_AttachEditMode() function, where onclick event is attached for link html element. Please open Document Library in IE browser and using IE development tools (F12), take a look at onclick attribute of document link and compare it with onclick event in Link2Doc_AttachEditMode() function.

And I mentioned above, this can be done only for Item Display Form, not for List View. List View is not supported this way, because we do not use original URL to document in link html element there, we use link to our internal handler (href=".../FlexibleLinkHandler.ashx?[params]"), that just finds document and redirects to it.

Regards,
Yura
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.