ASP.NET - CRYSTAL REPORT PRINTING

Asked By Prithivi Rajan on 11-May-12 07:19 AM
Earn up to 50 extra points for answering this tough question.
HAI SIR,

I USING BELOW CODE TO GENERATE CRYSTAL REPORT TO PDF DOC.

crystalReport.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath("Report_Data/Barcode.pdf"));


I USED BARCODE PRINTER . PAPER SIZE Bat Sticker  --- 3.65 WIDTH & 0.63 HEIGTH

WHEN I
EXPORT TO PDF IN LOCAL I GET ACCURATE OUPUT.. LIKE THIS



THEN I PUBLISHED IN ONLINE :

THE PAPER SIZE IS CHANGED TO A4 SIZE :

SEE THE BELOW OUTPUT:




IF I CHANGE THE PRINTER AND PRINT IT THE PAPER SIZE NOT CHAGED

I USING BARCODE PRINT TO PRINT :

BARCODE PAPER SIZE SETTING :




THESE IS MY PROBLEM IN LOCAL MACHINE IT GET EXACT OUTPUT BUT ONLINE [PUBLISHED] THE OUTPUT IS CHANGING

KINDLY GIVE A SOLUTION FOR THAT ... . . .


ADVANCE THANK U .


[)ia6l0 iii replied to Prithivi Rajan on 11-May-12 12:12 PM
Please turn the capslock off on your computer. 

For the solution, please visit the following thread and read the reply from "Stefano Crosatti"
http://social.msdn.microsoft.com/forums/en-US/vscrystalreports/thread/e16a1630-ad0c-4fda-8351-16e0807072eb

Hope this helps.
kalpana aparnathi replied to Prithivi Rajan on 11-May-12 02:48 PM
hi,

Use this referance link for steps for the pdf printer:

http://www.arsgeek.com/2007/05/17/5-steps-to-create-a-pdf-printer-print-to-pdf-in-ubuntu/

Regards,
Vikram Singh Saini replied to Prithivi Rajan on 12-May-12 09:14 PM
While exporting to pdf and printing same from CrystalReport on client system, the CR uses the default printer setting on the client pc. So that's the reason for unexpected behavior.
However I noticed that your pdf paper's font size is decreased on client side. So for that you can try the registry hack provided at link (describing your problem): http://amiraryani.wordpress.com/2010/03/25/font-size-problem-in-exporting-crystal-report-to-pdf-using-asp-net/
And second I found a suggestive solution for modifying crystal report size via programatic code at: http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/a256a9ce-40ba-41d8-8699-cd0427b7642b/  
Prithivi Rajan replied to Vikram Singh Saini on 14-May-12 08:47 AM
Hai Sir..

I Try that link but i till have the same problem ..

Any other way to export the same size of paper in crystal report..

Advance Thanks
help
54 PM how to use the below coding , To save in pdf formate using C# crystalReport.ExportToDisk( PdfRtfWordFormatOptions , ); hi prithivi try this Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Public Class Form1 CrDiskFileDestinationOptions.DiskFileName = _ "c: \ crystalExport.pdf" CrExportOptions = cryRpt.ExportOptions With CrExportOptions .ExportDestinationType = ExportDestinationType.DiskFile .ExportFormatType = ExportFormatType.PortableDocFormat .DestinationOptions = CrDiskFileDestinationOptions .FormatOptions = CrFormatTypeOptions End With cryRpt.Export() Catch ex As Exception MsgBox(ex.ToString crystal report how to use the below coding , To save in pdf formate using C# crystalReport.ExportToDisk(PdfRtfWordFormatOptions , ); 28-Oct-12 07:
ReportSource = (object)getReportDocument(); CrystalReportViewer1.DataBind(); / / Get the report document ReportDocument repDoc = getReportDocument(); repDoc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; repDoc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions(); objDiskOpt.DiskFileName = @"c: \ crystal report \ TFA DiskFileName = "c: \ csharp.net-informations.pdf"; CrExportOptions = cryRpt.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cryRpt.Export(); } catch (Exception ex) { MessageBox.Show(ex.ToString format fullPath = reportExportPath + sYear + " \ " + sMonth + " \ " + folderName + " \ " + SOA + " \ " + sFileName + "_" + DateTime.Today.ToString("MMddyyyy") + ".pdf"; oRpt.ExportToDisk(ExportFormatType.PortableDocFormat, fullPath); oRpt.Close(); Hope this helps you to solve your problem. thank you very much works fine. :) here is my code: private void bindreport() { con.Open(); string reportpath = Server.MapPath("~ / CrystalReport.rpt"); rptdoc.Load(reportpath); SqlCommand cmd = new SqlCommand("Select * from tblEmp", con); SqlDataAdapter da = new
at client server. what is the problem for that is there any problem creating at CrystalReport DeliveryReport = new ReportDocument(); string reportPath = Server.MapPath("~ / DeliveryChallanReport.rpt"); DeliveryReport.Load(reportPath); DeliveryReport.SetDataSource(dsPrint Pdf file to Disk string folderPath = Server.MapPath("~ / DeliveryReports"); folderPath + = " \ " + Session["Delivery"].ToString() + ".pdf"; DeliveryReport.ExportToDisk(ExportFormatType.PortableDocFormat, folderPath); Thanks in advance Hi, This can be done. Check out the http: / / devlibrary.businessobjects PhysicalApplicationPath + "Reports \ TempReports \ " + (new Random()).Next() + " .pdf"; rptDoc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; rptDoc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; diskOpts.DiskFileName = targetFileName; rptDoc.ExportOptions.DestinationOptions = diskOpts; / / Export report . . . Server-Side. rptDoc.Export(); FileInfo file
reportTitle) 'Export the report to pdf 'Save the PDF file into the network folder reportDocObject.ExportToDisk(ExportFormatType.PortableDocFormat, "FileNamewithpath.pdf") 'Open the File System.IO.Process.Start("Filenamewithpath") Else Return String.Empty End End Try End Function keywords: DataTable, VB.NET, Private Function, report, Export, Load, crystal report, crystalreport description: crystalreport show directly into pdf format using vs2008 halo, when i click button in page1 , it
2- set the value for that object 3- add this object to CurrentValues of the CrystalReport ParameterFields here is an examle DetailedCustomerOrderReport aReport = new DetailedCustomerOrderReport (); / / your crystalReport ParameterDiscreteValue paramDV_UserId = new ParameterDiscreteValue (); / / Step 1 paramDV_UserId.Value = userid; / / step 2:userid is the value report.SetParameterValue( "@Userid" , userid); / / @UserId is the parameter you added at the design of the crystalReport and userid is the value for the parameters CrystalReportViewer1.ReportSource = report; Here is how to ParameterDiscreteValue param.Value = "my value" myCrystalReport.ParameterFields( "parameterName" ).CurrentValues.Add(param) 'exporting as .PDF myCrystalReport.ExportToDisk(ExportFormatType.PortableDocFormat, strFileName) Try and let me know. hi, You can pass parameter values to a crystal a collection of parameters associated with a report. Before you use ParameterFields, you must import CrystalReport.Engine namespace by adding the following line to your code: Imports CrystalDecisions.CrystalReports.Engine 'here ParameterDiscreteValue param.Value = "my value" myCrystalReport.ParameterFields("parameterName").CurrentValues.Add(param) 'exporting as .PDF myCrystalReport.ExportToDisk(ExportFormatType.PortableDocFormat, strFileName) Try and let me know. Using the SetParameterValue you can pass parameter
up code. protected void btnpdf_Click(object sender, EventArgs e) { con.Open(); string reportpath = Server.MapPath("~ / CrystalReport.rpt"); rptdoc.Load(reportpath); SqlCommand cmd = new SqlCommand("Select * from tblEmp", con); SqlDataAdapter da = new dt.Rows.Count ! = 0) { rptdoc.SetDataSource(dt); CrystalReportViewer1.ReportSource = rptdoc; CrystalReportViewer1.DataBind(); } con.Close(); rptdoc.ExportToDisk(ExportFormatType.PortableDocFormat, @"D: \ krunal \ files \ EmployeeDetail1.pdf"); file(); savefile.DiskFileName = rptdoc.FileName; CrExportOptions.ExportDestinationOptions = savefile; / / / / / / / / / / / / / / / / / / / / here i
ParameterDiscreteValue param.Value = "my value" myCrystalReport. ParameterFields(" parameterName").CurrentValues. Add(param) 'exporting as .PDF myCrystalReport.ExportToDisk( ExportFormatType. PortableDocFormat, strFileName) Try and let me know. If you create a CrystalReport C# will generate a class (and .cs) file for that report. You can then create
can do it like this: ReportDocument thisReport = new ReportDocument(); thisReport.Load(inFilename); thisReport.Refresh(); thisReport.ExportToDisk(ExportFormatType.PortableDocFormat, outputFilename); thisReport.Close(); This works perfectly. Now I have a crystal report that takes a this: ReportDocument thisReport = new ReportDocument(); thisReport.Load(inFilename); thisReport.SetParameterValue("FirewallId", 25); thisReport.Refresh(); thisReport.ExportToDisk(ExportFormatType.PortableDocFormat, outputFilename); thisReport.Close(); but I get missing parameter value. When I inspect "thisReports" fields I not setting them gives me missing parameters error. Can anyone help me please? C# Discussions ExportFormatType.PortableDocFormat (1) ReportDocument.SetParameterValue (1) Generate (1) Refresh (1) Report (1) Load (1) Show (1) ReportDocument