Created
December 5, 2016 17:42
-
-
Save arman-hpp/b6bc8f48b5e518abd806c1e28597899c to your computer and use it in GitHub Desktop.
Print Stimulsoft Report As PDF With Telerik
This file contains hidden or 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
var report = new StiReport(); | |
report.Load((byte[])Resources.ResourceManager.GetObject("TestReport")); | |
var reportBusinessObjects = new List<ReportBusinessObject> | |
{ | |
new ReportBusinessObject("", "TestReport", reportDto) | |
}; | |
LoadBusinessObjects(report, reportBusinessObjects); | |
report.Compile(); | |
report.Render(false); | |
var reportMemoryStream = new MemoryStream(); | |
report.ExportDocument(StiExportFormat.Pdf, reportMemoryStream); | |
var pdfElement = new RadPdfViewerElement(); | |
pdfElement.LoadDocument(reportMemoryStream); | |
var printDocument = new RadPrintDocument | |
{ | |
AssociatedObject = pdfElement, | |
PrintController = new StandardPrintController() //disable printing window | |
}; | |
pdfElement.DocumentLoaded += (sender, args) => | |
{ | |
printDocument.Print(); | |
reportMemoryStream.Dispose(); | |
pdfElement.Dispose(); | |
printDocument.Dispose(); | |
report.Dispose(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment