Printing PDF report directly to printer, not using orarrp utility

The orarrp utility works only with Windows machines and it
requires installation on both the client machines and servers to
support. We need a more general solution.
Adobe has a java application/applet/javabean (and support
classes) to view PDF, and it is easy to write a java driver
which can be used in place of the orarrp utility. However,
Adobe's Java Viewer is extremely slow, does not produce quality
output, and is explicitly not supported by Adobe.
My question then relates to Reports. When the Report server
returns a PDF in the Previewer, I'm expecting the JINITIATOR,
used by Forms, is also used to support the Report frame and
functionality, including eventual printing. If this is the case,
is there not a set of classes, downloaded with Jinitiator, which
support the fonts, and printing of PDF to locally attached
printers?
And if so, shouldn't we, in Java, be able to make use of these
classes and their APIs to print PDF files directly to locally
attached printers without the need for Previewing first?

within a forms trigger:
1. generate the report
2. copy from iAS to local
like: webutil_file_transfer.url_to_client()
3. print.exe /d:printer filename (for windows OS)

Similar Messages

  • Orarrp can't print pdf file directly to printer

    oracle remote print utility (orarrp) can't print pdf file directly to printer.
    we expect orarrp utility can handle ".rrpa" file (i.e. pdf file generated on the application server) by directly print the file to the client's printer, i.e. invoke the acrobat reader on the client side, display the the printer selection dialogue, after confirmation print the pdf file, then the acrobat reader close automatically nicely.
    However we are disappointed as the acrobat reader startup and display the pdf file content but does not print and does not close.
    After testing the problem several times, there are some findings:-
    Finding (A):-
    (a) for the success of direct printing of pdf file, a physical path must be provided; we have tried 2 methods:
    1) using drag & drop to copy the pdf file directly to the browser
    2) open pdf file in the browser directly using browser menu-->File-->Open.
    (b) for the failure of direct printing, a virtual path is involved and we have also tried 2 methods:
    1) when web.show_document() is used
    2) enter the url to the URL bar of the browser,
    eg. http://appsvr.com:7777/report/test_printout/APPSVR1094707.rrpa (this is a virtual path/url)
    Finding (B):-
    (a)when the physical path is used, a temporary pdf file is generated in the same directory where the rrpa file exists in the application server,
    e.g. in application server: d:/printout/yyy.pdf is generated for d:/printout/xxx.rrpa when direct print occurs
    (b) however when the virtual path is used, there is no such temp "pdf" file generated and direct print failed.
    May be when virtual path is used, orarrp utility don't know where to generate the temp "pdf" so direct print doesn't occur.
    So, anyone has similar experience or further queries or has solutions, please join.
    Thanks for your attention.

    Hi,
    It is really late to give response this post. But still who ever refering to this post for the same issue this solution is useful for achieving same in background:
    Even same can be used in smartforms, for getting spool request in PDF format as well which will decrease the size of file when printing in SAP printer.
    ct_tline is PDF output:
    DATA: lv_pdfsource TYPE xstring.
    FIELD-SYMBOLS:<p> TYPE x. " <p> type any.
    LOOP AT ct_tline INTO cs_tline.
      ASSIGN cs_tline TO <p> CASTING TYPE x.
      CONCATENATE lv_pdfsource <p> INTO lv_pdfsource IN BYTE MODE.
    ENDLOOP.
    * ->Create spool request in PDF format
    CALL FUNCTION 'ADS_CREATE_PDF_SPOOLJOB'
      EXPORTING
        printer  = 'LOCL'            "Printer name supporting PDF device type
    *   DEST     =
        pages    = 1
        pdf_data = lv_pdfsource        "XSTRING internal table
    *   NAME     =
    *   SUFFIX1  =
    *   SUFFIX2  =
    *   COPIES   =
    *   PRIO     =
        IMMEDIATE_PRINT         = 'X'
    *   AUTO_DELETE             =
    *   TITLELINE               =
    *   RECEIVER =
    *   DIVISION =
    *   AUTHORITY               =
    *   LIFETIME = '0'
    * IMPORTING
    *   SPOOLID  =
    * EXCEPTIONS
    *   NO_DATA  = 1
    *   NOT_PDF  = 2
    *   WRONG_DEVTYPE           = 3
    *   OPERATION_FAILED        = 4
    *   CANNOT_WRITE_FILE       = 5
    *   DEVICE_MISSING          = 6
    *   NO_SUCH_DEVICE          = 7
    *   OTHERS   = 8
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.

  • Error - Printing a report directly to printer

    Hi,
    i'm using oracle forms 9i and i'm trying to print a report directly to printer. I using the code above:
    SET_REPORT_OBJECT_PROPERTY(ReportId,REPORT_DESFORMAT,'PDF');
    SET_REPORT_OBJECT_PROPERTY(ReportId,REPORT_SERVER,GetReportTnsName);
    IF ReportDesType = 'CACHE' THEN
    SET_REPORT_OBJECT_PROPERTY(ReportId,REPORT_DESTYPE,CACHE);
    ReportServerJob:=RUN_REPORT_OBJECT(ReportId, PList);
    rep_status := report_object_status(ReportServerJob);
    IF rep_status=’FINISHED’ THEN
    JobId := substr(ReportServerJob,length(GetReportTnsName)+2,length(ReportServerJob));
    WEB.SHOW_DOCUMENT ('/reports/rwservlet/getjobid'||JobId||'?server='||GetReportTnsName,'_blank');
    ELSE
    message ('Error’);
    END IF;
    -- logic for sending report directly to printer
    ELSIF ReportDesType = 'PRINTER' then
    SET_REPORT_OBJECT_PROPERTY(ReportId,REPORT_DESTYPE,PRINTER);
    SET_REPORT_OBJECT_PROPERTY(ReportId,REPORT_DESNAME,:parameter.p_print);
    ReportServerJob:=RUN_REPORT_OBJECT(ReportId, PList);
    rep_status := report_object_status(ReportServerJob);
    IF rep_status=’FINISHED’ THEN
    message ('Report sent to printer successfully');
    ELSE
    --handle errors
    message ('Error’);
    END IF;
    end if ;
    i get this error :
    REP-50157: Erro no envio do ficheiro para a impressora lp65. Sair com o código de erro 64
    NEED HELP !!
    Regards,

    The printer has to be known on the server where the Reports service runs.
    Also, the user who runs the Reports service has to have access to that printer. If you are running on Windows, Reports Service runs as Local system by default. Change that to a real (domain) user, who has access to the printer.

  • Print PDF report directly to a network printer (dot matrix)

    Dear All,
    I have a report of PDF output generated from an XML Report..
    Can I print this PDF report directly to the network printer (dot matrix), by default, like a normal text report output.
    If yes, how can I make this possible...
    Please update...

    Hi,
    Yes u can do that ,first setup the printer on the o/s and refer below documents
    Please refer below documents
    How To Print XML Publisher PDF Reports Via The Concurrent Manager [ID 338990.1]      
    How To Print Concurrent Requests in PDF Format [ID 333504.1]
    How To Generate And Print Reports In PDF Format From EBS With The UTF8 Character Set [ID 443778.1]
    Regards

  • Unable to print PDF reports on laser printer?

    Hi
    Our requirement is to print the PDF reports directly on the laser printer after submitting through concurrent requests. We have configured the local printer attached to the user, installed printer as network printer on IBM AIX server and configured the printer configuration in ERP instance. Whenever, we print garbage is printing. Then came across this metalink document (How To Print XML Publisher PDF Reports From The Concurrent Manager [ID 338990.1]). According this document, i have downloaded PDF converter 'xpdf' through this link http://www.foolabs.com/xpdf.
    As far as i know, extracting the xpdf.tar file itself will install this software. Modified and un-commented this line pasta_pdf.cfg file with 'preprocess=pdftops {infile} {outfile}' command. Still the printer is printing garbage.
    How to verify that XPDF is installed properly or not?
    Regards

    I think that means tool is either not installed or not in path:-
    "The Xpdf language support packages include CMap files, text encodings, and various other configuration information necessary or useful for specific character sets. (They do not include any fonts.) Any or all of these can be installed by simply unpacking the tar file and adding a few lines to your xpdfrc configuration file (see the README file inside each package for details).
    have you seen what needs to be changed in xpdfrc configuration file?
    Thanks,
    JD

  • Print RDLC Report Directly to Printer with SubReports!

    I am currently printing a report directly to the default printer using the code from this link. 
    http://msdn.AddHandler
    ReportViewer1.LocalReport.SubreportProcessing, AddressOf SubreportProcessingEventHandler
    and this code:
    Public Sub SubreportProcessingEventHandler(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
    Dim zrpt = e.ReportPath
    Select Case zrpt
    Case "WOPartsSubReport"
    Dim ds1 As New WOPartsSubReportDataSet
    Dim da1 As New WOPartsSubReportDataSetTableAdapters.wopartsTableAdapter
    da1.Fill(ds1.woparts)
    e.DataSources.Add(New ReportDataSource("DataSet1", ds1.Tables("woparts")))
    Case "WOLaborSubReport"
    Dim ds2 As New WOLaborSubReportDataSet
    Dim da2 As New WOLaborSubReportDataSetTableAdapters.wolaborTableAdapter
    da2.Fill(ds2.wolabor)
    e.DataSources.Add(New ReportDataSource("DataSet1", ds2.Tables("wolabor")))
    Case "WOLockoutSubReport"
    Dim ds As New WOLockOutSubReportDataSet
    Dim da As New WOLockOutSubReportDataSetTableAdapters.wolockTableAdapter
    da.Fill(ds.wolock)
    e.DataSources.Add(New ReportDataSource("DataSet1", ds.Tables("wolock")))
    End Select
    End Sub
    But now that I am NOT using a reportviewer how can I still get the subreports to work and still print directly to the printer?  Where would I put the code to do that?
    Thanks,
    Stacy

    Hi Stacy,
    Sorry for the delay.
    It’s Christian that I have involved to help on this issue. Maybe the issue requires a more in-depth level of support. Alternatively, you could contact Microsoft Customer Support Services (CSS) via telephone so that a dedicated Support Professional can assist
    you in a more efficient manner. Please understand that contacting phone support will be a charged call, but it will be free if this is a product issue. To obtain the phone numbers for specific technology request please take a look at the web site listed below:
    http://support.microsoft.com/default.aspx?scid=fh;EN-US;PHONENUMBERS
    Another option would be creating a thread on our Connect site:
    http://connect.microsoft.com/sql.
    Regards,
    Mike Yin
    If you have any feedback on our support, please click
    here
    Mike Yin
    TechNet Community Support

  • 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

  • Error in Printing Crystal Report Directly to Printer using SDK Code

    Hello ,
    I am trying to print a crystal report created in SAP Crystal Reports 2008 through SDk Code using one parameter
    as (Document Number).But While running the Code the Report is not getting printed and also the system is
    not able to fetch the correct data in the report using the supplied parameter .
    I am using Visual Studio 2005 Crystal Report dll s in my code :-
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Imports CrystalDecisions.CrystalReports
    Imports System
    Imports System.Data.SqlClient
    Imports System.IO
    For Clarification i am pasting my code below :-
                Dim oRpt As ReportDocument
                oRpt = New ReportDocument
                oRpt.Load(Path)
                With crConnectionInfo
                    .ServerName = Server
                    .DatabaseName = Database
                    .UserID = User
                    .Password = Password
                End With
                CrTables = oRpt.Database.Tables
                For Each CrTable In CrTables
                    crtableLogoninfo = CrTable.LogOnInfo
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo
                    CrTable.ApplyLogOnInfo(crtableLogoninfo)
                Next
                oRpt.ParameterFields("Document Number").CurrentValues.AddValue(Parameter)
                If Printer <> "" Then
                    oRpt.PrintOptions.PrinterName = Printer
                End If
                oRpt.PrintToPrinter(Copies, False, 0, 1)
            Catch ex As Exception
                SBO_Application.MessageBox(ex.Message)
            End Try
    Please suggest me what i have to do in my code to print the report with correct data in report.
    Thanks & Regards,
    Amit

    k

  • How to print a report directly on printer

    Hi,
    anyone, plz help me in finding out, why my report i.e. i m sending directly to printer is getting printed like html codes?
    Plz help asap.
    Br,
    Divya Alok

    please check out the following link.
    Print report directly
    just mention the printer name i hope it helps u.
    sarah
    Edited by: QGIRCO on Apr 1, 2010 3:01 AM

  • Can not print report directly to printer.

    Hi,
    We are using Crystal Report Server for reporting in our project.
    The version we are using is Crystal Report Server XI R2 and Crystal Report Server XI R2 SP 2.
    Please kindly advice us on the following issues we faced:
    - Can not print report directly to printer.
      The print button on the Crystal Report Viewer prints the report to pdf and user have to click "Print" again in the pdf file. This is unusual and not convenient. As we have hundreds of reports to print, is there a way we can print the reporrt directly to printer?
    - "Set to Null"
      In the default interface of the Crystal Report View, there's is this "set to null" check box that we can not remove. Is there a way to do without it?
    Thank you,
    Kenny Tew

    Morning Kenny,
    The printer settings are in server management console. Additionally see what settings you have setup for the printer for the report in the server. If it is setup to use End User printer then check your End user machine settings and make sure the printer is setup as a default printer on his/her machine.
    Please let us know how you get along with the issue.
    As far as "Set to Null" I am not sure where it is set up. A screenshot of it might help understanding it better?
    Many thanks
    Regards
    Jehanzeb
    Edited by: Jehanzeb Navid on Oct 6, 2008 11:07 AM
    Is this issue on all computers or only one computer?
    I have just tested this on my colleague machine and it asks for default printer and not pdf however on mine I setup for pdf.

  • Not able to print PDF report from Oracle APPS

    adcmctl.sh version 115.17.
    We have a network printer HP Laserjet 4250 which is configured on our concurrent manager server of RH Linux OS. We are using HP LASERJET 4250 Postscript driver. We are able to print PDF's directly however through CC manager we are not able to print reports in Proper PDF format. Has anyone faced such an issue with Oracle Apps?

    user11996936 wrote:
    Has anyone faced such an issue with Oracle Apps?Maybe. Maybe not. Ask to the proper forum. Here you are in Peoplesoft forum.
    Nicolas.

  • Print report directly to printer using RUN_PRODUCT in Forms6i

    Hi all,
    I would like to have information regarding print any .rdf directly to printer from form 6i using RUN_PRODUCT.
    I got help from Form Builder Help option and tried following coding in form
         DECLARE
         PL_ID                    PARAMLIST;
         printername          VARCHAR2(50);
         BEGIN
         PL_ID := GET_PARAMETER_LIST('WEIGHMENT');
              IF NOT ID_NULL(PL_ID) THEN
                   DESTROY_PARAMETER_LIST(PL_ID);
              END IF;
              PL_ID := CREATE_PARAMETER_LIST('WEIGHMENT');
              printername := '"'||'I.T Printer'||'"';
              Add_Parameter(pl_id, 'DESTYPE', TEXT_PARAMETER, PRINTER);
              Add_Parameter(pl_id, 'DESNAME', TEXT_PARAMETER, printername);
              Add_Parameter(pl_id, 'P_EQ_NBR', TEXT_PARAMETER, :weighment.eq_nbr);
              Add_Parameter(pl_id, 'P_WT_GKEY', TEXT_PARAMETER, :weighment.gkey);
              Run_Product(REPORTS, 'c:\wegt001r', ASYNCHRONOUS, RUNTIME, FILESYSTEM, PL_ID, NULL);
         EXCEPTION
              WHEN OTHERS THEN
              MESSAGE(SQLERRM);
         END;
    END IF;
    But report did not printed and following message received in Reports Background Engine
    Error submitting report [Thu May 07 18:49:23 2009] ...
    REP-0159: Syntax error on command line.
    Pls help.
    Thanks,
    Hassan

    Hi Heidi
    I have already tried printername := 'I.T Printer'; but result is same.
    This is also my default printer and I tried to add / remove the following coding
    Add_Parameter(pl_id, 'DESNAME', TEXT_PARAMETER, PRINTER);
    but in both cased I received the same error.
    I also tried to print thru HOST command as follows
    the_username := Get_Application_Property(USERNAME);
         the_password := Get_Application_Property(PASSWORD);
         the_connect := Get_Application_Property(CONNECT_STRING);
    the_command := 'rwrun60 report=c:\wegt001r.rdf userid= '||the_username||'/'||the_password||'@'||the_connect||' DESTYPE=Printer BACKGROUND=NO BATCH=YES ERRFILE=c:\reports\error.log LOGFILE=c:\reports\joblog.log p_eq_nbr='''||'TESTMKI'''||' p_wt_gkey=118306';
    Host( the_command );
    Host command displays correctly but no printing.
    I then change my command as follows
    the_command := 'rwrun60 report=c:\wegt001r.rdf userid=test/test@test DESTYPE=Printer BACKGROUND=NO BATCH=YES ERRFILE=c:\reports\error.log LOGFILE=c:\reports\joblog.log p_eq_nbr='''||'TESTMKI'''||' p_wt_gkey=118306'; and now report prints on printer.
    But I cannot hard coded the username, password and connect.
    Thanks,
    Hassan
    Edited by: Hassan Raza Khan Lodhi on May 7, 2009 6:55 PM

  • How to print the report directly without previewing (report viewer) using c# windows application

    Hi,
    Currently, we are using crystal report to all of our reporting applications, but since I/users have encountered some issues about CR's speed to load only a simple report, maybe it is now time for us to adopt a new reporting environment in which I think SSRS
    can fill this problem.
    To start with, I have here a sample code, that uses the crystal report to print the report directly without previewing:
    csCashInvoiceCal csCashCal; --Crystal report name .rpt
    dsCsReceipt dsCs; --created dataset
    DataTable u;
    DataRow s;
    private System.Drawing.Printing.PrintDocument printDocument1;
    private System.Windows.Forms.PrintDialog printDialog1;
    ParameterValues paramValue;
    ParameterDiscreteValue discreteValue;
    ParameterFieldDefinition fieldDefinition;
    private void btnPrint_Click(object sender, EventArgs e)
    this.Cursor = Cursors.WaitCursor;
    loadReceipt2();
    print2();
    csCashCal.Close();
    this.Cursor = Cursors.Default;
    private void loadReceipt2()
    dsCs = new dsCsReceipt(); --created dataset
    u = dsCs.Tables.Add("DtCsReceipt");
    u.Columns.Add("Qty", Type.GetType("System.String"));
    u.Columns.Add("UOM", Type.GetType("System.String"));
    u.Columns.Add("Description", Type.GetType("System.String"));
    u.Columns.Add("UnitPrice", Type.GetType("System.String"));
    u.Columns.Add("Discount", Type.GetType("System.String"));
    u.Columns.Add("Amount", Type.GetType("System.String"));
    try
    for (int i = 0; i < dgvDesc.Rows.Count - 1; i++)
    s = u.NewRow(); double.TryParse(dgvDesc.Rows[i].Cells[Discount2.Name].Value.ToString(), out discount);
    s["Qty"] = double.Parse(dgvDesc.Rows[i].Cells[Qty.Name].Value.ToString());
    s["UOM"] = dgvDesc.Rows[i].Cells[Uom2.Name].Value.ToString();
    s["Description"] = invcode + dgvDesc.Rows[i].Cells[Description.Name].Value.ToString();
    s["UnitPrice"] = dgvDesc.Rows[i].Cells[UnitPrice.Name].Value.ToString();
    if (discount != 0)
    s["Discount"] = "(" + string.Format("{0:0.##}", discount) + "%)";
    else
    s["Discount"] = "";
    s["Amount"] = dgvDesc.Rows[i].Cells[Amount2.Name].Value.ToString();
    u.Rows.Add(s);
    catch (Exception) { }
    csCashCal = new csCashInvoiceCal();
    csCashCal.SetDataSource(dsCs.Tables[1]);
    //csCashCal.Refresh();
    loadParameter2();
    private void loadParameter2()
    ParameterFieldDefinitions paramFieldDefinitions;
    paramValue = new ParameterValues();
    discreteValue = new ParameterDiscreteValue();
    paramFieldDefinitions = csCashCal.DataDefinition.ParameterFields;
    discreteValue.Value = date;
    fieldDefinition = paramFieldDefinitions["Date"];
    commonParam();
    discreteValue.Value = txtcsno.Text;
    fieldDefinition = paramFieldDefinitions["InvoiceNo"];
    commonParam();
    discreteValue.Value = txtNameTo.Text;
    fieldDefinition = paramFieldDefinitions["CustomerName"];
    commonParam();
    discreteValue.Value = txtAdd.Text;
    fieldDefinition = paramFieldDefinitions["CustomerAddress"];
    commonParam();
    ------other parameters----
    private void commonParam()
    paramValue.Clear();
    paramValue.Add(discreteValue);
    fieldDefinition.ApplyCurrentValues(paramValue);
    private void print2()
    using (printDocument1 = new System.Drawing.Printing.PrintDocument())
    using (this.printDialog1 = new PrintDialog())
    //this.printDialog1.UseEXDialog = true;
    this.printDialog1.Document = this.printDocument1;
    DialogResult dr = this.printDialog1.ShowDialog();
    if (dr == DialogResult.OK)
    int nCopy = this.printDocument1.PrinterSettings.Copies;
    int sPage = this.printDocument1.PrinterSettings.FromPage;
    int ePage = this.printDocument1.PrinterSettings.ToPage;
    string PrinterName = this.printDocument1.PrinterSettings.PrinterName;
    try
    csCashCal.PrintOptions.PrinterName = PrinterName;
    csCashCal.PrintToPrinter(nCopy, false, sPage, ePage);
    printcount++;
    //saveCountPrint();
    catch (Exception err)
    MessageBox.Show(err.ToString());
    This is only a simple sales receipt application that uses dgv and textboxes to push its data to dataset to the crystal report, a simple one but there are instances that it is very slow.
    But I'm having trouble implementing this using SSRS, since I'm only new to this one, wherein I created the report using report wizard, with two button options inside the form for print preview or direct print selection. Actually, it is very easy to implement
    with print preview because it uses reportviewer. My problem is that how can I print the report directly without using a reportviewer?
    So here is my code so far which I don't know what's next:
    private void button2_Click(object sender, EventArgs e)
    this.Cursor = Cursors.WaitCursor;
    loadReceipt3();
    //print3();
    this.Cursor = Cursors.Default;
    ReportParameter[] parameter = new ReportParameter[11];
    private void loadParameter3()
    parameter[0] = new ReportParameter("InvoiceNo", txtcsno.Text);
    parameter[1] = new ReportParameter("Date", date);
    parameter[2] = new ReportParameter("CustomerTin", txtTin.Text);
    parameter[3] = new ReportParameter("CustomerName", txtNameTo.Text);
    parameter[4] = new ReportParameter("CustomerAddress", txtAdd.Text);
    parameter[5] = new ReportParameter("Agent", agent);
    parameter[6] = new ReportParameter("Discount", "Discount: ");
    parameter[7] = new ReportParameter("TotalDiscount", lblDiscount.Text + "%");
    parameter[8] = new ReportParameter("TotalSales", rdtotal);
    parameter[9] = new ReportParameter("Tax", rdtax);
    parameter[10] = new ReportParameter("TotalAmount", rdnet);
    private void loadReceipt3()
    DataSet dsrs = new DataSet();
    DataTable dtrs = new DataTable();
    DataRow drs;
    dtrs.Columns.Add("Qty", Type.GetType("System.String"));
    dtrs.Columns.Add("UOM", Type.GetType("System.String"));
    dtrs.Columns.Add("Description", Type.GetType("System.String"));
    dtrs.Columns.Add("UnitPrice", Type.GetType("System.String"));
    dtrs.Columns.Add("Discount", Type.GetType("System.String"));
    dtrs.Columns.Add("Amount", Type.GetType("System.String"));
    try
    for (int i = 0; i < dgvDesc.Rows.Count - 1; i++)
    drs = dtrs.NewRow();
    drs["Qty"] = double.Parse(dgvDesc.Rows[i].Cells[Qty.Name].Value.ToString());
    drs["UOM"] = dgvDesc.Rows[i].Cells[Uom2.Name].Value.ToString();
    drs["Description"] = invcode + dgvDesc.Rows[i].Cells[Description.Name].Value.ToString();
    drs["UnitPrice"] = dgvDesc.Rows[i].Cells[UnitPrice.Name].Value.ToString();
    if (discount != 0)
    drs["Discount"] = "(" + string.Format("{0:0.##}", discount) + "%)";
    else
    drs["Discount"] = "";
    drs["Amount"] = dgvDesc.Rows[i].Cells[Amount2.Name].Value.ToString();
    dtrs.Rows.Add(s);
    catch (Exception) { }
    int addtlRow = 7;
    if (addtlRow > (count - 1))
    addtlRow = addtlRow - (count - 1);
    for (int i = 0; i < addtlRow; i++)
    dtrs.Rows.Add();
    loadParameter3();
    LocalReport localreport = new LocalReport();
    localreport.SetParameters(parameter);
    localreport.DataSources.Clear();
    localreport.DataSources.Add(new ReportDataSource("dsSalesReceiptSsrs", dtrs));
    localreport.Refresh();
    //what's next....
    So what's next after local..refresh()? Actually, I have googled a lot but I didn't found the exact solution that I'm looking for which confuses me a lot.
    Anyway I'm using VS 2010 with sql server 2012 express.
    You're help will be greatly appreciated.
    Thank you,
    Hardz

    After some further studies with ReportViewer controls and with the use of this tutorial @ : http://msdn.microsoft.com/en-us/library/ms252091.aspx, which helps me a lot on how to print a report without using a report viewer, I found out what is missing
    with my code above and helps solve my question.
    Here's the continuation of the code above:
    private void loadReceipt3()
    loadParameter3();
    LocalReport localreport = new LocalReport();
    localreport.ReportPath = @"..\..\SsrsCashReceipt.rdlc";
    localreport.SetParameters(parameter);
    localreport.DataSources.Clear();
    localreport.DataSources.Add(new ReportDataSource("dsSalesReceiptSsrs", dtrs));
    Export(localreport);
    print4();
    private IList<Stream> m_streams;
    private int m_currentPageIndex;
    private void Export(LocalReport report)
    string deviceInfo =
    @"<DeviceInfo>
    <OutputFormat>EMF</OutputFormat>
    <PageWidth>8.5in</PageWidth>
    <PageHeight>11in</PageHeight>
    <MarginTop>0.25in</MarginTop>
    <MarginLeft>0.25in</MarginLeft>
    <MarginRight>0.25in</MarginRight>
    <MarginBottom>0.25in</MarginBottom>
    </DeviceInfo>";
    Warning[] warnings;
    m_streams = new List<Stream>();
    report.Render("Image", deviceInfo, CreateStream,
    out warnings);
    foreach (Stream stream in m_streams)
    stream.Position = 0;
    private void print4()
    if (m_streams == null || m_streams.Count == 0)
    throw new Exception("Error: no stream to print.");
    PrintDocument printDoc = new PrintDocument();
    PrintDialog printDlg = new PrintDialog();
    printDlg.Document = printDoc;
    DialogResult dr = printDlg.ShowDialog();
    if (dr == DialogResult.OK)
    if (!printDoc.PrinterSettings.IsValid)
    throw new Exception("Error: cannot find the default printer.");
    else
    printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
    m_currentPageIndex = 0;
    printDoc.Print();
    Dispose();
    public void Dispose()
    if (m_streams != null)
    foreach (Stream stream in m_streams)
    stream.Close();
    m_streams = null;
    private Stream CreateStream(string name, string fileNameExtension, Encoding encoding, string mimeType, bool willSeek)
    Stream stream = new FileStream(name + "." + fileNameExtension,
    FileMode.Create);
    m_streams.Add(stream);
    return stream;
    private void PrintPage(object sender, PrintPageEventArgs ev)
    Metafile pageImage = new
    Metafile(m_streams[m_currentPageIndex]);
    // Adjust rectangular area with printer margins.
    Rectangle adjustedRect = new Rectangle(
    ev.PageBounds.Left - (int)ev.PageSettings.HardMarginX,
    ev.PageBounds.Top - (int)ev.PageSettings.HardMarginY,
    ev.PageBounds.Width,
    ev.PageBounds.Height);
    // Draw a white background for the report
    ev.Graphics.FillRectangle(Brushes.White, adjustedRect);
    // Draw the report content
    ev.Graphics.DrawImage(pageImage, adjustedRect);
    // Prepare for the next page. Make sure we haven't hit the end.
    m_currentPageIndex++;
    ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
    Thank you very much for this wonderful tutorial. :)

  • Not able to take print a report directly to the printer

    Hi All,
    Can anyone help me to print a report directly to the printer?. Currently, I am viewing the reports in the screen and then taking print of that report. If anyone knows the solution for this, please give me the feedback immediately. It is very urgent.

    HI ALL
    i have the same problem plz tel me som solution 4 it
    thanx in advance

  • Form 6i printing report directly to printer

    Hi Professionals,
    I am in badly need of help to print my barcode report directly to printer from form, currently it is working fine if i make it preview first and then user has to select network printer to print, but user is not accepting that manual step, and therefore we are unable to launch our material management module.
    MY CURRENT CODE WHICH WORKING FINE WITH PREVIEW..................
    add_parameter(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'PREVIEW');
    add_parameter(PL_ID, 'MAXIMIZE', TEXT_PARAMETER, 'YES');
    add_parameter(pl_id,'paramform',TEXT_PARAMETER,'NO');
    add_parameter(pl_id,'STR',TEXT_PARAMETER,:IM_STR_ISSUE_MASTER.STR_CODE);
    add_parameter(pl_id,'BAT',TEXT_PARAMETER,:IM_STR_ISSUE_DETAILS.BAT_ID);
    add_parameter(pl_id,'DIV',TEXT_PARAMETER,:IM_STR_ISSUE_DETAILS.GRP_CODE);
    add_parameter(pl_id,'GRP',TEXT_PARAMETER,:IM_STR_ISSUE_DETAILS.SUB_GRP_CODE);
    add_parameter(pl_id,'ITM',TEXT_PARAMETER,:IM_STR_ISSUE_DETAILS.ITEM_CODE);
    add_parameter(pl_id,'COPIES',TEXT_PARAMETER,:IM_STR_ISSUE_DETAILS.QTY);
    RUN_PRODUCT(REPORTS,'F:\IMS\REPORTS\STOCK_IN_BARCODE.rep',SYNCHRONOUS,RUNTIME,FILESYSTEM,PL_ID);
    IF I CHANGE IT TO THE FOLLOWING FOR DIRECT PRINTING IT IS NOT WORKING
    ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'PRINTER');
    ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, 'SOLABEL');
    I appreciate any efforts to resolve this issue.
    Thanks
    Ahon
    Edited by: [email protected] on Oct 4, 2009 11:20 PM

    Guide to Implement local printing on client in 10gas/9ias
    To archive this goal we have used orarrp(Oracle Reports Remote Printing Utility), which can be downloaded from the OTN website http://otn.oracle.com/sample/products/reports/index.html.
    Steps:
    1.Add the required ORARRP mime types to the Oracle HTTP Server configuration.
    (Note: This will be the Oracle HTTP Server belonging to the Oracle Application Server 10g/9ias middle (BI & Forms) tier)
    Do this manually by editing the httpd.conf
    or
    via the Oracle Application Server 10g AS Console e.g.
    Navigate to the Middle Tier Components Page
    Click on HTTP_Server -> Administration -> MIME Types
    NOTE: MIME types added in httpd.conf are as per requirement mode in which report has to be run e.g. pdf, rt(rtf) and html etc. syntax for manual entry in httpd.conf is given below.
    AddType application/x-orarrp-text     rrpt
    AddType application/x-orarrp-ps     rrpp
    AddType application/x-orarrp-pdf     rrpa
    AddType application/x-orarrp-rt     rrpr
    AddType application/x-orarrp-ini     rrpi
    AddType application/x-orarrp-html     rrph
    2. Create an aliasmatch in forms.conf pointing to a physical directory \tmp- for example, directory will be c:\tmp
    Do this by manually editing the forms.conf
    or
    via the Oracle Application Server 10g AS Console e.g.
    Navigate to the Middle Tier Components Page
    Click on HTTP_Server -> Administration -> Advanced Server Properties -> forms.conf
    Add a line like :
    # Virtual path for physical directory of temp
    AliasMatch ^/tmp/(..*) "C:\tmp/$1"
    ** IMPORTANT NOTE **
    The advantages of making the changes via EM / AS console, rather than editing the files manually, are:
    - the EM / AS console will put the mime type entries in the correct place
    - the EM / AS console automatically issues a 'dcmctl updateconfig' which synchronizes the file changes with the Infrastructure Metadata Repository
    - the EM / AS console will do the required restart of the HTTP Server component
    (Only the HTTP Server needs to be stopped and restarted – Oracle AS 10g components can remain up and running)
    If the changes are made manually then the following commands must be issued after the changes to httpd.conf and forms.conf have been made.
    Run these command at run prompt
    DRIVE:\oracle\FRHome_1\dcm\bin\dcmctl.bat updateconfig -ct ohs -v -d
    (to synchronize the changes with the Metadata Repository)
    DRIVE:\oracle\FRHome_1\dcm\bin\dcmctl.bat stop -ct ohs -v -d
    DRIVE:\oracle\FRHome_1\dcm\bin\dcmctl.bat start -ct ohs -v -d
    where DRIVE: is the drive where \oracle\frhome_1\ is installed.
    3. Copy and run orarrp.exe on client machine in program files\orarrp\ folder.
    4. Set value of options '”choose_printer=no” in orarrp.ini created at above folder.
    5. Add following lines in your code of run_report procedure.
    In declare section
    vc_file varchar2(225);
    In begin block add
    /* Generate a pseudo unique filename */
    vcfile:=:global.user_code||to_char(sysdate,'YYYYMMDDHHMISS');
    vcfile:=vcfile||'.rrpr';
    /* In this example - output will be rtf so adding .rrpr extension */
    set_report_object_property(repid, report_filename,store_var);
    set_report_object_property(repid, report_server, :global.r_server);
    set_report_object_property(repid, report_execution_mode, batch);
    set_report_object_property(repid, report_comm_mode, SYNCHRONOUS);
    set_report_object_property(repid, report_destype, file);
    set_report_object_property(repid, report_desformat,'rtf');
    set_report_object_property(repid,REPORT_DESNAME,'C:\tmp\'||vcFile);
    ---- path can be made dynamic by making a database entry in makess.path_entry for tmp folder and
    ---using proc_path procedure from path lib.
    :GLOBAL.PrintOutPut := vcFile;
    In Run report section make following change:
         vc_reportserverjob := RUN_REPORT_OBJECT(repid,pi_id);
         report_job_id:=substr(vc_reportserverjob,length(:global.r_server+2,length(vc_reportserverjob));
         v_rep_status:=report_object_status(vc_reportserverjob);
         if v_rep_status='FINISHED' then
              web.show_document('/tmp/'||:global.printoutput,'_blank');
         else
              message ('error when running report'||v_rep_status);
    end if;
    Edited by: amitphynyl on Oct 5, 2009 1:36 AM

Maybe you are looking for

  • Dataguard in oracle standard edition ?

    I am using Oracle 10.2.0.4 standard edition database. how to check / query can i use dataguard feature in my oracle database. Is there any docs having to expalin more detail? Rgds,

  • Help required in compiling Java Code.

    I have java1.6 installed on my PC but I want to compile my code in such a way that it will run on PCs with lower versions of java installed. I am not using any feature specific to java1.6 in my program. I am using Netbeans IDE 6.1 Thanks in advance.

  • Help with account Statements

    Hi, i'm needing a litle help. I want to create a financial managment with this data: - Date of the transaction - Details of the transaction - If it is a positive amount, it is shown as a debit - If it is a negative amount it is shown as a credit - Th

  • Mail-In Repair Question

    ok...so Ive decided to send in my Macbook for a simple repair before my warranty expires. Its a pretty common issue it seems. My left command key got popped off by my nephew, after sticking it back on it works 90 percent of the time, but will come ba

  • Illustrator CS3 (13.0.2) stacks and freezes after a while.

    I have problems with Illustrator CS3. Sometimes, when I am using it and go to select a layer, it .. stack/freeze whatever. I don't know why, but the cost to me is too much - specially if I haven't save my artwork for some time.. (you might understand