I'm creating some custom features to add functionality to the ribbon.
I have created a button to print the page you are viewing very easily like that:
SPItem containing elements.xml:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="Benetton_FRA.PrintPage" Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Documents.Copies.Controls._children">
<Button Id="Ribbon.Documents.Copies.PrintPage"
Command="PrintPage"
Sequence="15"
Image16by16="/_layouts/images/Benetton_FRA/print16.gif"
Image32by32="/_layouts/images/Benetton_FRA/print.gif"
Description="PrintPage" LabelText="Print Page"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="PrintPage"
CommandAction="javascript:PrintPage();"
EnabledScript="true"/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="Ribbon.Library.Actions.Scripts"
Location="ScriptLink"
ScriptSrc="/_layouts/Benetton_FRA/BenettonScripts.js" />
</Elements>
JS file with the JS method to invoke for the page print:
function PrintPage() {
window.print();
}
function enable() {
var items = SP.ListOperation.Selection.getSelectedItems();
var itemCount = CountDictionary(items);
return (itemCount > 0);
}
Everything works fine. Now I must do the same thing for files: I select one file and this had to be printed. Is there something in EMCS Script that allows me to open and print a file? Is there any server side command to do that?
Thank you very much!