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.
Similar Messages
-
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,
StacyHi 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 -
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,
Amitk
-
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) -
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 Alokplease 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 -
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,
HassanHi 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 -
Print report directly to printer
I am using Crystal Reports XI R2 to generate reports in Powerbuilder. I want to know whether it is possible to print the report directly to a printer without displaying it in the Crystal Report viewer?
Thanks,
AmolI have a very similar problem, not being able to print a report directly to the printer.
But I am calling Crystal Reports v8.5 from VB6. I have tried the suggested code:
report.PrintOut(prompt user, numberofCopy, collated, startpage, endpage)
but get a "type mismatch" compiler error with "PrintOut" highlighted when compiling, eventhough the inline help shows this method and matching arguments.
I wonder if I have the correct DLL referenced.
This report runs fine thru the preview window, but since this is a series of reports about 100 pages, don't really want the user to have to specify print dozens of times.
Thanks,
Gene -
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 PMGuide 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 -
Can't print the report directly on the printer?
Dear All,
My client encounter a problem of printing a report directly to the printer. He is using developer 6i with OAS. His application is going to deploy on the web. He wants the report printed out directly on the "HP Laser Jet Printer" after the user has made the selection and clicked the "Print" button from the forms 6i. However, he got the error saying that
"Oracle Report Server OWS Cartridge - Report Job has terminated with error
Report Server Replies:
Rep-0713: invalid printer name 'HP4050' specified by parameters DESNAME."
And here is the parameter string passing into the report server:
http://epmsdevs2.eway:9002/rwows/rwows60?report=epms1271.rdf+userid=epmsdev/epmsdev@dev+desformat=landscape+destype=printer+desname=HP4050+server=RepServer
Is there anyone can show me some light on it?!
Any help and idea is appreciated in advance!!!
sheetaHi!
If reports are run in web env. then
you can print reports directly on
printer defined on m/c where report server
is running, not on client m/c. If you want
to print on client m/c then define that
printer on report sever m/c and make sure
report server can access that printer.
Nirali -
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,
HardzAfter 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. :) -
Print report directly to printer without acknowledgement
I'm running reports 9i.
I can successfully print a report directly to a printer but how do I stop a window poping up displaying the "Oracle Reports Job Status"
ThanksI have a very similar problem, not being able to print a report directly to the printer.
But I am calling Crystal Reports v8.5 from VB6. I have tried the suggested code:
report.PrintOut(prompt user, numberofCopy, collated, startpage, endpage)
but get a "type mismatch" compiler error with "PrintOut" highlighted when compiling, eventhough the inline help shows this method and matching arguments.
I wonder if I have the correct DLL referenced.
This report runs fine thru the preview window, but since this is a series of reports about 100 pages, don't really want the user to have to specify print dozens of times.
Thanks,
Gene -
Hi Experts,
we want to print a Report directly after clicking on print version. We don't want to first open the pdf file and then click another time on print. Is there any solution?
The best solution would be, that we print automatically the report on our local printer after confirming the filter variables.
Thanks for your help
SebastianThere should be a javascript command, something like window.print, which you could put in the onLoad function of the page.
The problem here is that it doesn't print in the nice PDF version.
Cheers,
Andrew -
Print a report directly to the printer
I need to print a report directly to the printer in Oracle Forms and Report 11g without a preview in the browser
Hello,
<p>You can use this Java Bean</p>
Francois -
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 TewMorning 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. -
How to print a report directly on to a printer on the client machine
Hi,
Could anyone let me know how to print a report directly on to the clients default printer in oracle forms 10g with OAS?.
Regards,
Prasad.Hello,
<p>You can use this Java Bean</p>
Francois
Maybe you are looking for
-
IDOC Generation Using XSLT Mapping[Query]
Hi, I am working on File to IDOC scenario. I have used XSLT mapping. It is necessary to generate EDI_DC40 segment for IDOC in XSLT? -Kavita
-
Dynamic URL for HTTP receiver adapter
Hi all, when the XI send the http request to the target system, the format maybe like this: header + body the body is including: Prolog, payload and Epilog here is about the target system have a 'input' parameter(maybe string type) is it possible to
-
Will Mountain lion will support the creation of Galleries
Does anyone know if Mountain lion will support the creation of Galleries like the ones produced on mobile me - I need to do this for business purposes - and does anyone have a good sugestion for an alternative - photoshop galleries lack a little flai
-
Dropping signal On WPA Network
At school my laptop connets to a WPA wireless network at school. I have an issue of it dropping the connection whil i am using it. I can connect ocasionally but It either drops the signal or won't connect at all. Thanks, Greg
-
X200 Hard Drive -- SSD question
Greetings: At $830.00 over the "80GB Hard Disk Drive, 5400rpm" default hard drive option, what advantages does a 64 GB hard drive have over any of the other choices? If I go with Vista Business 64-bit, how much disk space will the operating system u