Printing Crystal Report to Printer from Windows Service

Hello Support,
We are currently using 13.0.3.612 version of Crystal report. We want to print the report to the printer from the windows service. For printing the report to the printer we are using the “PrintOutputController.PrintReport” method. At our end on the Windows 8 machine this method is giving following error:
Message: Error HRESULT E_FAIL has been returned from a call to a COM component.
StackTrace:    at CrystalDecisions.ReportAppServer.Controllers.PrintOutputControllerClass.PrintReport(PrintReportOptions options)
   at PMLWLibrary.CrystalReport.LoadReports()
And on the Windows 7 machine the report is sent to the print spooler, however the report is not printed on the printer. Not sure what could be causing the issue. Can you please let us know what could be causing the issue.

Hi Brian,
Thank you for your response.
We tried running the service under the domain user account as well which has access to the printer, but even this fails. Further, from the regular .net application when we try to print the report to the printer, it directly prints the report without displaying any print window. So I assume that even from the service no print window should be launched. Can you please confirm on this.
We are attaching herewith the code snippet which we have used to print to printer through the service. Can you please review the same and let us know if we are missing something here.
Dim printReportOptions As New CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions
Dim printOutputController As New CrystalDecisions.ReportAppServer.Controllers.PrintOutputController
Dim rptClientDoc As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument
rptClientDoc = ReportDocument.ReportClientDocument
printReportOptions.PrinterName = "\\pc2\HP LaserJet 1015"
printReportOptions.JobTitle = [Enum].GetName(GetType(ReportNames), PrinterSetting)
printReportOptions.Collated = False
printReportOptions.AddPrinterPageRange(1, 1)
rptClientDoc.PrintOutputController.PrintReport(printReportOptions)

Similar Messages

  • TLV Error when using crystal report in application from Terminal Services

    Our accounting software is generating the error:
    Invalid TLV record
    The error is generated from every user except one, for that one user everything works fine.
    i've checked the file permissions on the rpt files as well as the dll, everything is correct and i'm now lost.
    Any ideas on where else to start looking?

    Ah.. I hate when they do that, if you are going to write an application then support it.... At least help figure out why it's failing other than just saying it should work....
    I would get on a call with them and get a Manager involved, someone there should be able to help you...
    In the mean time:
    First easiest way is search for crpe32.dll, there should only be one version and it should match the est of the file versions. Next step will tell you the versions being used.
    OK, download [Modules|https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip]. what this app will do is list all of the runtime files each user has access to. You can save and then compare the list files between the  one working PC and any other user. Should help determine what is missing or the users profile doesn't have access to or not installed.
    Another option is to use ProfileMonitor from Microsoft, it will list all access issues including the registry keys that all users need to run CR.
    Can you tell me what version you are using?
    Also need to know what version of TS?
    OS it's running on?
    And work station OS?
    One more option, go to this link http://www.sdn.sap.com/irj/scn/advancedsearch?query=boj and search on "invalid tlv" and it will return a bunch of know reasons why you can get that error.
    Thanks
    Don
    Edited by: Don Williams on May 31, 2011 12:52 PM

  • Print Crystal Report directly from C# without using Report Viewer

    Hello All,
    I need to print a crystal report directly to the printer without using ReportViewer in C#. I've a CrystalReport2(belowCode) which requires a query (Select * from JobHeader where JobNumber='J012345') to display all the data. I'm stuck with database connection
    and putting all the data to DataAdapter in C# (Below Code). I also have 8 subreports in my CrystalReport2. Can somebody please give me hand on this? I'm struggling with it. Thanks.
    Regards
    using CrystalDecisions.CrystalReports.Engine;
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using System.Data.SqlClient;
    namespace csharp_win_printtoprinter
    /// <summary>
    /// Summary description for Form1
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    //CR Variables
    ReportDocument crReportDocument;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.PrintDialog printDialog1;
    private System.Windows.Forms.Button button2;
    private System.Drawing.Printing.PrintDocument printDocument1;
    private CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1;
    private CrystalReport1 CrystalReport11;
    private Chart Chart1;
    /// <summary>
    /// Required designer variable
    /// </summary>
    private System.ComponentModel.Container components = null;
    public Form1()
    // Required for Windows Form Designer support
    InitializeComponent();
    // TODO: Add any constructor code after InitializeComponent call
    /// <summary>
    /// Clean up any resources being used
    /// </summary>
    protected override void Dispose( bool disposing )
    if( disposing )
    if (components != null)
    components.Dispose();
    base.Dispose( disposing );
    #region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor
    /// </summary>
    private void InitializeComponent()
    this.button1 = new System.Windows.Forms.Button();
    this.printDialog1 = new System.Windows.Forms.PrintDialog();
    this.button2 = new System.Windows.Forms.Button();
    this.printDocument1 = new System.Drawing.Printing.PrintDocument();
    this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
    this.Chart1 = new csharp_win_printtoprinter.Chart();
    this.CrystalReport11 = new csharp_win_printtoprinter.CrystalReport1();
    this.SuspendLayout();
    // button1
    this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    this.button1.Location = new System.Drawing.Point(32, 56);
    this.button1.Name = "button1";
    this.button1.Size = new System.Drawing.Size(160, 104);
    this.button1.TabIndex = 0;
    this.button1.Text = "Print Report No Choose Printer";
    this.button1.Click += new System.EventHandler(this.button1_Click);
    // button2
    this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    this.button2.Location = new System.Drawing.Point(272, 56);
    this.button2.Name = "button2";
    this.button2.Size = new System.Drawing.Size(160, 104);
    this.button2.TabIndex = 1;
    this.button2.Text = "Choose Printer";
    this.button2.Click += new System.EventHandler(this.button2_Click);
    // crystalReportViewer1
    this.crystalReportViewer1.ActiveViewIndex = 0;
    this.crystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    this.crystalReportViewer1.Cursor = System.Windows.Forms.Cursors.Default;
    this.crystalReportViewer1.Location = new System.Drawing.Point(47, 188);
    this.crystalReportViewer1.Name = "crystalReportViewer1";
    this.crystalReportViewer1.ReportSource = this.CrystalReport11;
    this.crystalReportViewer1.Size = new System.Drawing.Size(903, 296);
    this.crystalReportViewer1.TabIndex = 2;
    // Form1
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    this.ClientSize = new System.Drawing.Size(1164, 505);
    this.Controls.Add(this.crystalReportViewer1);
    this.Controls.Add(this.button2);
    this.Controls.Add(this.button1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.Load += new System.EventHandler(this.Form1_Load);
    this.ResumeLayout(false);
    #endregion
    /// <summary>
    /// The main entry point for the application
    /// </summary>
    [STAThread]
    static void Main()
    Application.Run(new Form1());
    private void button1_Click(object sender, System.EventArgs e)
    crReportDocument = new ReportDocument();
    //Create an instance of a report
    crReportDocument = new CrystalReport2();
    //Use error handling in case an error occurs
    try
    //Set the printer name to print the report to. By default the sample
    //report does not have a defult printer specified. This will tell the
    //engine to use the specified printer to print the report. Print out
    //a test page (from Printer properties) to get the correct value.
    System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
    crReportDocument.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
    //Start the printing process. Provide details of the print job
    //using the arguments.
    crReportDocument.PrintToPrinter(0 ,true , 1, 1);
    //Let the user know that the print job is completed
    MessageBox.Show("Report finished printing!");
    catch(Exception err)
    MessageBox.Show(err.ToString(), "Unexpected exception");
    private void Form1_Load(object sender, System.EventArgs e)
    private void button2_Click(object sender, System.EventArgs e)
    //Open the PrintDialog
    this.printDialog1.Document = this.printDocument1;
    DialogResult dr = this.printDialog1.ShowDialog();
    if(dr == DialogResult.OK)
    //Get the Copy times
    int nCopy = this.printDocument1.PrinterSettings.Copies;
    //Get the number of Start Page
    int sPage = this.printDocument1.PrinterSettings.FromPage;
    //Get the number of End Page
    int ePage = this.printDocument1.PrinterSettings.ToPage;
    string PrinterName = this.printDocument1.PrinterSettings.PrinterName;
    crReportDocument = new ReportDocument();
    //Create an instance of a report
    crReportDocument = new Chart();
    try
    //Set the printer name to print the report to. By default the sample
    //report does not have a defult printer specified. This will tell the
    //engine to use the specified printer to print the report. Print out
    //a test page (from Printer properties) to get the correct value.
    crReportDocument.PrintOptions.PrinterName = PrinterName;
    //Start the printing process. Provide details of the print job
    //using the arguments.
    crReportDocument.PrintToPrinter(nCopy, false, sPage, ePage);
    //Let the user know that the print job is completed
    MessageBox.Show("Report finished printing!");
    catch(Exception err)
    MessageBox.Show(err.ToString());

    1. This is a VB.Net forum not a Visual C# forum. For Visual C# questions try this forum.
    Visual C#
    2. Crystal Reports are not supported by Microsoft. Therefore, unless somebody responding in the Visual C# forum has experience with whichever version of Crystal Reports you are using, you will probably not receive an answer in the Visual C# forum. SAP has
    their own assistance for Crystal Reports using Visual Studio. You can try to find an appropriate forum to ask questions in at SAP in the below link.
    SAP Community Network
    La vida loca

  • Problem in printing Crystal Report from SAP Business One - the printing cut in it width margins

    Hi
    i'm trying to print crystal report layout from sap b1. when i preview the report as pdf file, i have the option to choose Fit in size option and then the layout print O.k with out any margins that been cut.
    The problem start when i'm trying to print the layout directly from sap b1 (printer button) which cause the page to be cut in it width margins.
    How can i control the printing of crystal layout when i'm printing it directly from sap b1? do i have the option to chose 'Fit page size' from sap system?

    Hi,
    Please check SAP note:
    1820939 - Page settings of Crystal Reports not transferred
    correctly
    Thanks & Regards,
    Nagarajan

  • Crystal Report Export & Printing Error in Windows 7 (SAP B18.81 PL09)

    Dear Experts,
                          I have installed B1 Client on windows 7 pro every thing working fine but when exporting or printing crystal report B1 goes on not responding. These crystal reports are part of Add on.
    In Standard B1, exporting of Crystal Report is  done successfully but when printing this report B1 crash. Facing this issue on all machines including server.
    Have any one idea regarding this issue.
    Regards
    Rahil Hassan

    Hi Nitin,
    For better advice please post you report related query to the Reporting Forum.
    [Reporting and Printing;
    Regards,
    Rakesh N

  • Error message when trying to view/print Crystal reports in B1

    I get the following Error message when trying to view/print crystal reports in SAP B1/Crystal Reports Integration Tool for SAP Business One:   
    " Could not load file or assembly 'Crystal Decisions Windows Forms, version=12.0.2000.0, Culture=neutral, Public Key Token=692fbea551e1304'  or one of its dependencies.  The system cannot find the file specified.  ????

    Hi
    Common issues for this :
    1. Once you install crystall add on ,you need to go to Crystal report Administration >Account setup .
    Put on the user name and password and click on creating ext tables
    Try then running the report .
    If not the case ,
    make sure you install runtime .
    You need :
    1.Crystal report basic from SAP download -(Not necessary if you want only report viewer >
    2.You need to have crystal integration addon (I think service pack is SP1)
    3.Make sure you have runtime install
    When you are installing ,make sure you restart your PC before you do or remove temporary file s
    Hope this solves your issue
    Bishal

  • Unable to print crystal report over web using ActiveX Control

    Post Author: jimmyp
    CA Forum: General
    We have a problem with printing crystal report over web using ActiveX Control.  When clicking print button, it only shows a blank dialog web crystal viewer page without any error.  The page just simply hangs.  We installed the PrintControl DLL and enable all the security setting for ActiveX Control for IE.  It still does not print.  Does anyone know why?  
    Environment.
    Bundle Crystal Report v10
    Asp.net 2.0
    IE 6.0 or higher.
    Appreciate for your help.
    Jimmy

    Post Author: Ian Kulmatycki
    CA Forum: General
    A team member here found this, I haven't read it, I'm not sure if our problems are related to this, but hopefully it helps someone:
    -ian
    When Secure Sockets Layer (SSL) is enabled, using the ActiveX control to print reports from a Crystal 10 DHTML viewer results in the following error message:
    "A communication error occurred, printing will be stopped."
    How can this error message be resolved?
    Resolution
    This is a known issue with Crystal Reports 10 and Crystal Enterprise 10 viewers and has been tracked. The Track ID is ADAPT00282199.
    This error occurs due to the receiving application performing a case-sensitive check for the HTTPS request header value "ON". When a sender application sends the value as "on" in lower case, the error occurs. The update below changes the receiving application to be case-insensitive.
    Hot Fixes or Service Packs address this issue as indicated below. With the updates, this issue is resolved.
    Unless indicated otherwise, Weekly Hot Fix updates from our FTP site have only been tested with English versions of products.
    For Crystal Reports 10 and Crystal Enterprise 10, the update for this issue is included in the Crystal 10 Viewers Weekly Hot Fix (WHF). This is available in English only at the following location:
    ftp://ftp.crystaldecisions.com/outgoing/EHF/viewers10win_en.zip
    This issue is addressed in the following components (and later versions):
    PageObjectModel.dll, version 10.0.5.785, dated 8/25/2004
    ReportRenderer.dll, version 10.0.5.785, dated 8/25/2004
    WebReporting.dll, version 10.0.5.785, dated 8/25/2004

  • Printing Crystal reports via Great Plains 10

    Hi,
    I am unable to print (to printer) crystal reports in Great Plains 10. I can preview the report, export and print the exported file but the Print button does not respond when I click it (no errors, nothing) in the Crystal preview screen. We are using Crystal XI, Developers Kit.
    I have set the report to 'No Printer', verified that I can print other files from the server, verified the default printer and I have spokes to GP (Microsoft), nothing has helped with this issue.
    OS:
    MS Windows Server 2003
    Standard Edition
    SP1
    Thanks,

    Hi Carolyn,
    Great Plains is an OEM partner of ours and they MUST resolve this issue for you. If they can not figure out what the problem is they can create a case on line to get help from Support to help you.
    Not sure if you have Crystal Reports Designer or not but if you do can you print from the Designer? If you can then it's an issue in Great Plains software.
    Thank you
    Don

  • Print crystal report without preview

    Dear All,
    i want print crystal report without preview.
    when i click print button i want show printer list install in that computer.
    so user can choose which printer that use to print. I means like if we printing document from office, we can choose the printer.
    how that i can do that?
    please help.
    best regards,
    Surbakti

    Since this issue has little to do with sql server, I suggest you post your question to a forum for CR
    SAP CR community

  • Crystal report layout printing issue

    Hi Experts
    I have a bit of an urgent issue which I can't seem to solve.
    I have created a print spec using crystal reports 2008 sp3.  I am trying to print it using an epsom dot matrix printer which is brand new. When I print from crystal reports itself, I have managed to get it printing perfectly. However, as soon as I run it through SAP, the orientation either goes out or it only prints 3/4 of the width of the page and to much as far as the being goes...
    There are other print specs which have been created using pld which print fine.
    Does anyone know the solution to this issue?

    Hi,
    To print Crystal report correctly on dot matrix printer is really a challenge for B1. You have to try everything possible to make it happen. Try search the forum first. There are quite a few discussions about it. However, solution is rare.
    Thanks,
    Gordon

  • Smart forms- when i print a report it print main window data on same page

    hi,
    when i print a report it print main window data on same page .
    i.e. if data is more then one page then it shows data page wise on computer screen but when i print it print all data on same only one page by over wrriting .
    pl. help why it is happening
    i create page in page i set next page and in second page give first page.
    mukesh

    mukesh,
    what happened to this: smart form
    close that please.
    by the way,did you tried with what i suggested?
    lets say mainwindow in 1st page.
    copy the first page to second page.
    now.
    for 1st page: next page is : page2
    for page2: next page is also : page2

  • Print crystal report in A5 paper tray

    Dear Experts,
    I am using VB.NET
    We have different printers like "Lexmark Optra T612_DB", "HP Universal Printing PCL 5 (v4.7)", etc., in the network, there will be 2 or more trays for each printer. One of the tray has A5 paper in it. While printing Crystal report,
    1. How to find in which tray A5 paper is present?
    2. How to select A5 paper tray for printing?
    If the above 2 are not possible with crystal report object:
    1. How to print crystal report using PrintDocument object?
    2. How to find in which tray A5 paper is present using PrintDocument object?
    3. How to select A5 paper tray for printing? using PrintDocument object?
    Currently with the following lines of .NET code, it is always printing in Tray 2
    report.PrintOptions.PaperSize = PaperSize.PaperA5;
    report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
    Regards,
    Eswar

    Unfortunately, it will be up to you to find out what tray the correct paper size is in, then set that to the report. The CR APIs do not look up these values, they just expect you to know these and set them.
    Ludek

  • How to keep file name in print queue when printing crystal report

    We are using VB .Net 2003 + Crystal Report 2008 SP2 up to Fix Pack 2.6
    When the VB program spools crystal report files to print queue, the print queue only shows "Crystal Report" for each document.  How to keep the original file name?  In the past when we were using Crystal Report 11, the original file name can be shown in the print queue.
    Please help because it's so important for operation to see which report is failed in printing when reports are printed in batch.
    Thanks

    Hello,
    Set the PrintOption.JobTitle value for the print job. Here's C# code on how to:
                   System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
                CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions rasPROpts = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptionsClass();
                CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions newOpts = new PrintOptionsClass();
                   pDoc.PrinterSettings.PrinterName = cboCurrentPrinters.Text;          
                   rasPROpts.PrinterName = cboCurrentPrinters.Text;               
                   rasPROpts.PaperSize = (CrPaperSizeEnum)
                        pDoc.PrinterSettings.PaperSizes[cboCurrentPaperSizes.SelectedIndex].Kind;
                // this sets the name of the print job
                rasPROpts.JobTitle = "MYPrintJob";
                   rptClientDoc.PrintOutputController.PrintReport(rasPROpts);
                   MessageBox.Show("Printing report.", "RAS", MessageBoxButtons.OK,MessageBoxIcon.Information );
    Thank you
    Don

  • Printing Crystal Report decreasing font Size in web.

    Printer reduces font:
    when we use crystal report`s print button to print report, It reduces original font size....
    I am using Crystal report viewer to preview and print the report in which print mode is "pdf". I tried with "ActiveX" mode but its generate error...
    I using Crystal Report 13.0 in asp.net2010.

    Make sure you are on SP1:
    SAP Crystal Reports, developer version for Microsoft Visual Studio: Updates & Runtime Downloads [original link is broken]
    See KB [1218753|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313338333733353333%7D.do]
    Next time, don't forget to search these forums and use the search box in the top right corner of this web page to get KBs, wikis, blogs, etc., etc.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Page Not Found Error when clicking on Crystal Report Viewer print icon

    Hi,
        I am working with ASP.NET 2.0 and crystla reportXI release2.
        I am getting "Page Can not be Found " error when clicking on Crystal Report Viewer print icon.
        Could you please tell me how to get rid of this error?
    Regards,
    Smitha

    This sounds like a postback issue. Does your application handle postback by putting the report in session?
    There is a [sample|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/CrystalReports_dotNET_SDK/crsdk_samples_aspx/data/crsdk_net_tutorials_115_en.zip] to look at on our website. It was created with Crystal Reports XI R2 and Visual Studio .NET but the code will be the same.
    A short pseudocode would be something like this:
    Dim rptDocument As ReportDocument
    If Not Me.IsPostBack or Session("Report") = Nothing Then
    rptDocument = New ReportDocument
    rptDocument.Load(sGlobalPath & "\myreport.rpt";)
    Ludek

Maybe you are looking for

  • I had all my photos neatly in events on the MAC; with this new upgrade, all photos are renamed by location not what I want; how do I change this back?

    MAC; OS X Yosemite 10.10.3. All my photos on the MAC were in events named by me. Now, with this upgrade, all my photos are without my event names and named by iphoto by date and location (sometimes incorrect). I do not like this at all. I want to ret

  • IPod Nano 6G Case

    Hi, I just received my replacement iPod Nano.  I had a generation one and now Apple replaced it with a generation six.  I want to use this for when I go to the gym. I purchased the arm band for my G1, but the G6 is a lot smaller. I'm looking for two

  • Changes in Standard RHBUCH00_LSO with LDB PCH

    Hi All, Greetings!! I have to make changes in RHBUCH00_LSO which uses LDB PCH . The changes are to display Applicanr also with Participant also . The Standard report at selection screen take only one object type (P Participant ) or (AP Applicnat) . A

  • Problem with version enabling tables with ric.

    Hello, i have the a problem when i want to version enable tables having ref. int. constraits having delete rule cascade or set null. Is it possible that i can't version enable the tables because of these constraints? How i could solve this problem if

  • Saving objects in Transport request

    Hi all, i want to save a Package and all its contents to a single transport request which already transported.I didn't do any change,but i need to save this in a new transport request in a simple way.suggest me a simple way to do it. Thanks in advanc