Printing Directly To Printer

3 posts, 0 answers
  1. Jonah
    Jonah avatar
    28 posts
    Member since:
    Oct 2012

    Posted 27 Apr 2015 Link to this post

    I am trying to print directly to a printer using the code listed here. However I need to pass parameters to my report. Is there a way to do that when trying to print directly?
  2. Stef
    Stef avatar
    3610 posts

    Posted 28 Apr 2015 Link to this post

    Hi Jonah,

    You can send values to report parameters through the wrapping report source object. the ReportSource.Parameters collection is mapped by key to the report's ReportParameters collection. The key is the parameter's name which is case sensitive.

    For more details, please check Report Sources.


    See What's Next in App Development. Register for TelerikNEXT.

  3. Jonah
    Jonah avatar
    28 posts
    Member since:
    Oct 2012

    Posted 28 Apr 2015 in reply to Stef Link to this post

    Thank you for the response. I was able to get this figured out, and here is a little bit of code if anyone else stumbles on either the report name or the parameters.

    Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor()
    'set any deviceInfo settings if necessary
    Dim typeReportSource As New Telerik.Reporting.TypeReportSource()
    typeReportSource.TypeName = GetType(WPFControls.RptPrintTicket).AssemblyQualifiedName
    typeReportSource.Parameters.Add("InvoiceNumber", "")
    typeReportSource.Parameters.Add("ProductLocationID", "")
    typeReportSource.Parameters.Add("ProductID", "")
    typeReportSource.Parameters.Add("PartOrderID", dtInsPackage.Rows(0).Item(0).ToString())
    '' Obtain the settings of the default printer
    Dim printerSettings As New System.Drawing.Printing.PrinterSettings
    printerSettings.PrinterName = fcGlobals.GetDefaultPrinter()
    reportProcessor.PrintReport(typeReportSource, printerSettings)

Back to Top