Print report straight Silverlight

14 posts, 0 answers
  1. Andrei
    Andrei avatar
    9 posts
    Member since:
    Jun 2010

    Posted 14 Jul 2010 Link to this post

    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?
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 15 Jul 2010 Link to this post

    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
  3. DevCraft banner
  4. Andrei
    Andrei avatar
    9 posts
    Member since:
    Jun 2010

    Posted 15 Jul 2010 Link to this post

    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?
  5. naip
    naip avatar
    25 posts
    Member since:
    Sep 2009

    Posted 16 Jul 2010 Link to this post

    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
  6. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 16 Jul 2010 Link to this post

    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
  7. Andrei
    Andrei avatar
    9 posts
    Member since:
    Jun 2010

    Posted 16 Jul 2010 Link to this post

    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!!! )
  8. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 01 Mar 2011 Link to this post

    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.
  9. Massimiliano Bassili
    Massimiliano Bassili avatar
    323 posts
    Member since:
    May 2006

    Posted 02 Mar 2011 Link to this post

    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
  10. Vipin Panwar
    Vipin Panwar avatar
    16 posts
    Member since:
    Oct 2014

    Posted 01 Oct 2014 Link to this post

    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. 
      
  11. Stef
    Admin
    Stef avatar
    3042 posts

    Posted 06 Oct 2014 Link to this post

    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.

     
  12. Vipin Panwar
    Vipin Panwar avatar
    16 posts
    Member since:
    Oct 2014

    Posted 15 Oct 2014 in reply to Stef Link to this post

    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.
  13. Stef
    Admin
    Stef avatar
    3042 posts

    Posted 17 Oct 2014 Link to this post

    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.

     
  14. Vipin Panwar
    Vipin Panwar avatar
    16 posts
    Member since:
    Oct 2014

    Posted 20 Oct 2014 in reply to Stef Link to this post

    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.
  15. KS
    KS avatar
    165 posts
    Member since:
    Oct 2012

    Posted 21 Oct 2014 in reply to Vipin Panwar Link to this post

    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
Back to Top
DevCraft banner