Created
October 20, 2016 15:14
-
-
Save PeteGCole/32119c96bcb0750b3e0292572c96256c to your computer and use it in GitHub Desktop.
Using ASP.NET MVC Helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using MeadCo.ScriptXClient | |
<div class="pagecontent"> | |
<button class="btn btn-default" id="btn-print">Print document</button> | |
</div> | |
@* Output ScriptX tags. Will use installer page if required *@ | |
@MeadCo.ScriptXClient.ClientPrinting.GetHtml( | |
clientValidationAction: ClientPrinting.ValidationAction.Redirect, | |
printSettings: new PrintSettings | |
{ | |
Header = "&w&bPage &p of &P", | |
Footer = "&b&b&d", | |
PageSetup = new PrintSettings.PaperSetup | |
{ | |
Units = PrintSettings.MarginUnits.Inches, | |
Margins = new PrintSettings.PrintMargins | |
{ | |
Bottom = "0.5", | |
Top = "0.5", | |
Left = "0.5", | |
Right = "0.5" | |
} | |
} | |
}) | |
@section scripts { | |
<script type="text/javascript"> | |
// do not use document.ready() as the license may still be loading | |
$(window).load(function () { | |
if (MeadCo.ScriptX.Init() && MeadCo.Licensing.IsLicensed()) { | |
$("btn-print").click(function() { | |
MeadCo_ScriptX_Settings(); @* func generated by ClientPrinting. *@ | |
MeadCo.ScriptX.BackgroundPrintURL("@Url.Action("MyReport")",false); | |
}); | |
} | |
else { | |
$("button[id^='btn-']").prop("disabled", true); | |
MeadCo.Licensing.ReportError(); | |
} | |
} | |
</script> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment