I'm thinking of adding a print button to my list ribbon , the minute I click on this button a print dialog appears showing the list of the available printers on my computer. so this printdialog i was intending to do it in my custom element of the button :
<CustomAction Id="Ribbon.Library.PROGED"
Location="CommandUI.Ribbon"
RegistrationId="10999"
RegistrationType="List">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Library.Groups._children">
<Group Id="Ribbon.Library.PRO"
Title="PROGED"
Template="Ribbon.Templates.Flexible2"
Sequence="10000">
<Controls Id="Ribbon.Library.PRO.Controls">
<Button Id="Ribbon.Library.PRO.PrintAllFiles"
Command="PrintAllFiles"
Image32by32="_layouts/images/PRO.Ribbon/logopro_32.png"
LabelText="Print All Files"
TemplateAlias="o1"></Button>
</Controls>
</Group>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Library.Scaling._children">
<MaxSize Id="Ribbon.Library.PROGED.Scaling.MaxSize"
GroupId="Ribbon.Library.PRO"
Size="LargeLarge" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="PrintAllFiles"
CommandAction="javascript:function CallDETCustomDialog('PrintAllFiles',dialogResult, returnValue)
{
SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}
var options = {
url: '{SiteUrl}' + '/_layouts/YBBEST/TitleRename.aspx?List={ListId}&ID={ItemId}',
title: 'Rename title',
allowMaximize: false,
showClose: true,
width: 500,
height: 300,
dialogReturnValueCallback: CallDETCustomDialog };
SP.UI.ModalDialog.showModalDialog(options);"/>
</CommandUIHandlers>
</CommandUIExtension>
It's just I didn't know how to translate this .net regular printing dialog to javascript SP.UI printing dialog:
public void printall(object sender, System.EventArgs e)
{
PrintDialog pd = new PrintDialog();
pd.PrinterSettings = new System.Drawing.Printing.PrinterSettings();
this.Close();
pd.ShowDialog();
}
CommandAction="javascript: window.print()"or is that what you already have? – eirikb Oct 22 '12 at 9:56?output=printor a hash#print, and if this is given trigger window.print. Example with jQuery:$(function(){window.location.hash.match(/print/) && window.print()})– eirikb Oct 22 '12 at 10:09