This is a migrated thread and some comments may be shown as answers.

Print report straight Silverlight

13 Answers 316 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrei
Top achievements
Rank 1
Andrei asked on 14 Jul 2010, 02:53 PM
Hi i want to print report after clicking print button, wihtout saving to pdf first... i want to use it with no-browser siverlight application to print reports... what can you advice me? could you provide code example? is it possible at all?

13 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 15 Jul 2010, 01:44 PM
Hi Andrei,

Currently the Silverlight report viewer control is built against Silverlight 3 and works out-of-browser except the printing functionality. Our short-term plans include migration to SL4 and starting using the built-in printing functionality. As of now we still haven't scheduled any time frame for this to happen, but once we do the product road map would be updated with this info.

Best wishes,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Andrei
Top achievements
Rank 1
answered on 15 Jul 2010, 01:50 PM
And what about the algorithm when i save pdf first and then send it to print? could i save to pdf manualy? could i add my button to your panel and remove yours printing button?

And could you tell me can i get report display source from code to implement printing by myself?
0
naip
Top achievements
Rank 2
answered on 16 Jul 2010, 10:10 AM
Hello,

I also wanted to print reports directly in SL4 without an additional roundtrip and all the pdf hassle. I usually have only one-page reports and in that case it is realy simple to extend the ReportViewer to support SL printing.

1) Place the telerik ReportViewer control on your page.

2) Use Expression blend to create a copy of the ReportViewer template.

3) Locate the print button in the template, remove the Command property and give the control a name. Example:
<telerik:RadButton x:Name="myPrintButton" Margin="0,2" Padding="2">
    <Image Height="16" Source="/Telerik.ReportViewer.Silverlight;component/images/Print.png" Width="16"/>
</telerik:RadButton>

4) Derive your own class from ReportViewer and add the printing code:
public class CareReportViewer : ReportViewer
    {
        private ReportViewerModel Model
        {
            get { return DataContext as ReportViewerModel; }
        }
 
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            RadButton printButton = GetTemplateChild("myPrintButton") as RadButton;
            if (printButton != null)
            {
                printButton.Click += OnPrintButtonClick;
            }
        }
 
        private void OnPrintButtonClick(object sender, RoutedEventArgs e)
        {
            if (Model.PageCount == 1)
            {
                PrintDocument pd = new PrintDocument();
                pd.PrintPage += OnPrintPage;
                pd.Print("my application");
            }
            else
            {
                Model.PrintReportCommand.Execute(null);
            }
        }
 
        private void OnPrintPage(object sender, PrintPageEventArgs e)
        {
           e.PageVisual = Model.PageRoot;
           e.HasMorePages = false;                   
        }
    }

5. Replace the telerik ReportViewer on your page with your own report viewer.

Thats it. It should be possible to extend that principle for multiple pages (call page by page, wait until page is loaded, create a writeable bitmap from the page root and print the bitmaps - or do something else more clever ;)

Best regards,
Thomas
0
Steve
Telerik team
answered on 16 Jul 2010, 11:26 AM
Hello Andrei,

Since the Telerik Silverlight report viewer is built against Silverlight 3, which does not support print, we are exporting to PDF internally and then use their printing abilities to allow users to print. If you just want to save to pdf, use the export button instead. Additionally if you need to do this manually for whatever reason, you can use the code from the following blog post: Programmatic export to PDF from Silverlight application.
As to your last question - the Silverlight viewer is actually a template that allows easy modifications. That way you can customize the viewers' template to respond to any custom requirements you have i.e. adding button to it.

Sincerely yours,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Andrei
Top achievements
Rank 1
answered on 16 Jul 2010, 04:15 PM
Thanks Thomas you help me a lot! I implement printing 1 page document printing... could you advice me how to implement page fliping... cause when i use go to next page command the pageroot still the same... no refresh :( could you give me some advice?

 PS 10x a lot! you already help me SO MUCH!!! )
0
danparker276
Top achievements
Rank 2
answered on 02 Mar 2011, 02:09 AM
I'd also like to print directly from a print button I create without showing the user a report window.  Is there any progress on this?  I couldn't find this in the list of issues that I could vote on.
0
Massimiliano Bassili
Top achievements
Rank 1
answered on 02 Mar 2011, 12:08 PM
Found this forum with the same discussion: http://www.telerik.com/community/forums/reporting/telerik-reporting/print-from-the-silverlight-report-viewer-without-viewing-the-report.aspx

Cheers
0
Vipin Panwar
Top achievements
Rank 1
answered on 01 Oct 2014, 04:04 PM
Hi,
Silverlight Telerik ReportViewer have print report option but there is no event present, to work on reportviewer print event. Similarly no Export event present.
There is a need to generate Log in case if the user print the report. In Telerik winform reportviewer we have both Print and Export Event.
Can anybody assist me on this for an alternate solution or best possible solution asap.

Thanks in advance
Vipin. 
  
0
Stef
Telerik team
answered on 06 Oct 2014, 07:16 AM
Hello Vipin,

Currently the Silverlight ReportViewer does not expose such events. It is in our plans to expose the events for all viewer.

Until the feature is available, you can use the approach for printing described in the Print from the Silverlight Report Viewer without Viewing the Report forum thread.


I hope the above information is helpful.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Vipin Panwar
Top achievements
Rank 1
answered on 15 Oct 2014, 06:03 PM
Hi,
Does anyone let us know that Can we render the iTextSharp Controls in the Telerik Report Viewer. Like Text Field controls, radio Check Field Control and Rectangle Control.
Thanks in advance.
Vipin Panwar.
0
Stef
Telerik team
answered on 17 Oct 2014, 09:23 AM
Hi Vipin,

Telerik Report Viewers are dedicated to display only Telerik Reports. Reports can include only native reporting items listed in the Report Structure help section.

Details how to start creating Telerik Reports and display them in viewers are available in the Quickstart help section. You can also check the local demos under C:\Program Files (x86)\Telerik\Reporting <VERSION>\Examples.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Vipin Panwar
Top achievements
Rank 1
answered on 20 Oct 2014, 06:14 PM
Hi,
Can anyone from Telerik Team let us know for the below query,
We are able to see/render controls in PDF but we are unable to see/render in the Telerik RadPdfViewer.
Please see the highlighted one in the attached file.

Thanks in advance.
Vipin Panwar.
0
KS
Top achievements
Rank 1
answered on 21 Oct 2014, 01:58 PM
Hi,

Test exporting a PDF from these demos (Reporting demos), and importing it in this demo (PDF Viewer). Test the same with your PDF. Your problem might be related to the PDF file or the PdfViewer settings. 

-KS
Tags
General Discussions
Asked by
Andrei
Top achievements
Rank 1
Answers by
Steve
Telerik team
Andrei
Top achievements
Rank 1
naip
Top achievements
Rank 2
danparker276
Top achievements
Rank 2
Massimiliano Bassili
Top achievements
Rank 1
Vipin Panwar
Top achievements
Rank 1
Stef
Telerik team
KS
Top achievements
Rank 1
Share this question
or