We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Forms ElementHost host WPF - how to print: directly to the printer

Thread ID:

Created:

Updated:

Platform:

Replies:

132841 Sep 25,2017 07:45 AM UTC Oct 2,2017 01:11 PM UTC WPF 5
loading
Tags: ReportViewer
Gregory Pe
Asked On September 25, 2017 07:45 AM UTC

I've developed Forms
 ElementHost host = new ElementHost();
 a app that generates an rdlc report it works well however.

1.Can you speed up window display? (form10 -  18s and Form2 -5s)
It is too long now.
2. how to print: directly to the printer - (do not open the reportViewerControl)

button3_Click
 i'm trying to print the report directly to a default printer without using the print form2.
, can anyone help,

Gregory
Regards


Attachment: test_ReportDesigner002_387adc51583840917_e259d718.rar

Vinoth Srinivasan [Syncfusion]
Replied On September 26, 2017 12:24 PM UTC

Hi Gregory, 

Thanks for your interest in Syncfusion Components. 

Query 
Response 
.Can you speed up window display? (form10 -  18s and Form2 -5s)
It is too long now. 
To show the form window immediately after the button click, use “Form.Shown” event instead of “Form.Loaded” event.  We have modified your sample based on this. Also, please refer the below MSDN documentation for more details. 

how to print: directly to the printer - (do not open the reportViewerControl)

button3_Click
 i'm trying to print the report directly to a default printer without using the print form2.
, can anyone help, 
You can print the reports without viewing using our ReportWriter, it  supports to export report into PDF document and that can be loaded to the PdfViewer for printing as shown in the below code snippet. We have included this code in “Button3” click event. 
 
string reportPath = @"../../Report1.rdlc"; 
reportWriter.ReportPath = reportPath; 
reportWriter.ReportProcessingMode = Syncfusion.ReportWriter.ProcessingMode.Local; 
reportWriter.DataSources.Clear(); 
reportWriter.DataSources.Add(new Syncfusion.Windows.Reports.ReportDataSource { Name = "DataSet1", Value = this.productBindingSource3 }); 
 
MemoryStream stream = new MemoryStream(); 
reportWriter.Save(stream, WriterFormat.PDF); 
PdfDocumentView pdfViewer = new PdfDocumentView(); 
pdfViewer.Load(stream); 
System.Windows.Controls.PrintDialog printDialog = new System.Windows.Controls.PrintDialog(); 
 
if ((bool)printDialog.ShowDialog()) 
{ 
printDialog.PrintDocument(pdfViewer.PrintDocument.DocumentPaginator, "PDF PRINTER"); 
} 
 
We have modified your sample based on this and please find the sample from the below location. 


Regards, 
Vinoth S. 


Gregory Pe
Replied On September 26, 2017 07:36 PM UTC

Hi Gregory, 

Thanks for your interest in Syncfusion Components. 

Query 
Response 
.Can you speed up window display? (form10 -  18s and Form2 -5s)
It is too long now. 
To show the form window immediately after the button click, use “Form.Shown” event instead of “Form.Loaded” event.  We have modified your sample based on this. Also, please refer the below MSDN documentation for more details. 

how to print: directly to the printer - (do not open the reportViewerControl)

button3_Click
 i'm trying to print the report directly to a default printer without using the print form2.
, can anyone help, 
You can print the reports without viewing using our ReportWriter, it  supports to export report into PDF document and that can be loaded to the PdfViewer for printing as shown in the below code snippet. We have included this code in “Button3” click event. 
 
string reportPath = @"../../Report1.rdlc"; 
reportWriter.ReportPath = reportPath; 
reportWriter.ReportProcessingMode = Syncfusion.ReportWriter.ProcessingMode.Local; 
reportWriter.DataSources.Clear(); 
reportWriter.DataSources.Add(new Syncfusion.Windows.Reports.ReportDataSource { Name = "DataSet1", Value = this.productBindingSource3 }); 
 
MemoryStream stream = new MemoryStream(); 
reportWriter.Save(stream, WriterFormat.PDF); 
PdfDocumentView pdfViewer = new PdfDocumentView(); 
pdfViewer.Load(stream); 
System.Windows.Controls.PrintDialog printDialog = new System.Windows.Controls.PrintDialog(); 
 
if ((bool)printDialog.ShowDialog()) 
{ 
printDialog.PrintDocument(pdfViewer.PrintDocument.DocumentPaginator, "PDF PRINTER"); 
} 
 
We have modified your sample based on this and please find the sample from the below location. 


Regards, 
Vinoth S. 


Hi Vinoth
Thank you for your answer.
1. Form.Shown -it's faster. But can you still accelerate the second stage of file opening  Modified.rdlc


Vinoth Srinivasan [Syncfusion]
Replied On September 29, 2017 12:42 PM UTC

Hi Gregory, 
  
The loading delay occurred due to serialization and de-serialization codes used in your application before opening a report in our report designer. Also, you have customized the image of our report designer report items in ribbon, so it takes time to load the report completely. Can you perform serialization of report in different event or in control loaded event and open the report to reduce the delay. 

Regards, 
Vinoth S. 


Gregory Pe
Replied On September 30, 2017 06:03 AM UTC

Hi Vinoth
but how to do it

Regards, 
 Gregory

Vijay Raja [Syncfusion]
Replied On October 2, 2017 01:11 PM UTC

Hi Gregory, 
  
We have reduced the time delay by calling the report serialization function in report designer control loaded event. As per the suggestion we have modified the sample and it will be available from the below download location. 
 
 
Regards, 
Vijay R. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;