Author |
Message |
123CAW
Newbie
Joined: 11 Jun 2008
Location: United States
Online Status: Offline
Posts: 2
|
Posted: 11 Jun 2008 at 10:02am |
Could you please show me your logic that was used to create the postscript file using VB 2005? I am just getting started with Crystal XI would like to see your method of creating the postscript file using VB (without prompting the user).
Thanks.
Edited by 123CAW - 11 Jun 2008 at 10:03am
|
IP Logged |
|
N11689
Newbie
Joined: 13 Jun 2007
Location: United States
Online Status: Offline
Posts: 22
|
Posted: 12 Jun 2008 at 6:08am |
In Summary, we declare the following objects:
Public objPrinterSettings As New System.Drawing.Printing.PrinterSettings
Public objPageSettings As New System.Drawing.Printing.PageSettings
Public objReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
We set the objPrinterSettings.PrinterName to our postscript printer (a printer with a postscript driver):
objPrinterSettings.PrinterName = postscriptprintername
We then set the objPageSettings.PrinterName to the objPrinterSettings.PrinterName
objPageSettings.PrinterSettings.PrinterName = objPrinterSettings.PrinterName
Our application creates the .PS filename: PostScriptFilename.ps
Then we print to the printer
objPrinterSettings.PrintToFile = True
objPrinterSettings.PrintFileName = PostScriptFilename.ps
We use the load method to load the crystal report into the objReportDocument object
We then process each report (set parameter values, logon tables, etc.) and the finally 'print' the report to the printer using the following command:
objReportDocument.PrintToPrinter(objPrinterSettings, objPageSettings, False)
|
IP Logged |
|
Hridya
Newbie
Joined: 12 Nov 2007
Location: India
Online Status: Offline
Posts: 2
|
Posted: 12 Jun 2008 at 7:04am |
hi,
r u using any third party tool to create a .ps file? If no, please let me know how u r doing that.
|
IP Logged |
|
N11689
Newbie
Joined: 13 Jun 2007
Location: United States
Online Status: Offline
Posts: 22
|
Posted: 12 Jun 2008 at 7:19am |
No. We create a filename with a .PS extension. When the report 'prints' to a file, we send it to a printer defined with a PostScript print driver (specifically Digital LN03R ScriptPrinter). Therefore, when the file is created, it has a .PS extension and is the driver formats it into the postscript format.
|
IP Logged |
|
123CAW
Newbie
Joined: 11 Jun 2008
Location: United States
Online Status: Offline
Posts: 2
|
Posted: 14 Jul 2008 at 9:38am |
Hi N11689. Thank you for the code sample. However, I still have a problem.
I know that I have Crystal XI Release 2 installed but I cannot say for sure that I have SP3 installed. When I start Crystal, and go to 'Help, About' it does not show if SP3 has been applied. All it shows is the version number. Are you using version 11.5.9.1076? I installed it from a file called 'crxir2_sp3' but I was expecting to see the SP level when I go to the about screen.
I am able to use your code up to a certain point. I get an error on the following line.
objReportDocument.PrintToPrinter(objPrinterSettings, objPageSettings, False).
The error states that the arguments for 'PrintToPrinter' are invalid. It is expecting an integer where I have 'objPrinterSettings' and 'objPageSettings'.
Am I missing something?
Thanks for you help.
|
IP Logged |
|
kuphaus
Newbie
Joined: 05 Sep 2008
Online Status: Offline
Posts: 1
|
Posted: 05 Sep 2008 at 7:03am |
I too am getting the same problem with
objReportDocument.PrintToPrinter(objPrinterSettings, objPageSettings, False).
The error states that the arguments for 'PrintToPrinter' are invalid. It is expecting an integer where I have 'objPrinterSettings' and 'objPageSettings'.
Can someone lead me in the right direction to get this to work?
Thanks,
Kelli
|
IP Logged |
|
wjzabs
Newbie
Joined: 16 Mar 2009
Online Status: Offline
Posts: 2
|
Posted: 16 Mar 2009 at 7:57pm |
I am not sure how you finally got it to work - I was able to get a report to be printed to a file with the following code:
Dim prtdoc As New System.Drawing.Printing.PrintDocument
Dim prset As System.Drawing.Printing.PrinterSettings = prtdoc.PrinterSettings
prset.PrinterName = "Your Windows Printer Name"
prset.PrintToFile = True
prset.PrintFileName = "report.tmp"
CrystalReport.PrintToPrinter(prset, New System.Drawing.Printing.PageSettings, False)
Note that the Print to File option has nothing to do with Crystal - it is an option offered by the Windows Print dialog (which is why I had to use the PrinterSettings object, and not a Crystal-derived object).
If you are going to send the output to a windows socket (IP & Port), make sure that the Windows PrinterName that you choose has the printer driver matching the printer that you expect to eventually send the output to.
To do this, you would read the file that you just created into a byte array and then send that array to the socket, which is useful if you want to print to a printer knowing it's IP and port, without having to create a Windows (spooled) printer. Crystal has an ExportToStream method, but this does not capture the Printer Specific codes and escape sequences needed to interact with the printer - this is the purpose of the Printer Driver.
Bad things will happen if the destination printer does not know how to interpret the control codes which resulted from the printer driver your Windows PrinterName is associated with.
Edited by wjzabs - 16 Mar 2009 at 8:01pm
|
IP Logged |
|
uda_shy
Newbie
Joined: 28 Jul 2010
Online Status: Offline
Posts: 1
|
Posted: 28 Jul 2010 at 6:12pm |
hi everyone, This is maybe out of the topic, but do you know where can I save the RPT file as PDF (smaller MB not the same as the default) using it IDE? coz when I save it as PDF, it did treat the RPT file as Image so that's why the MB quite big.
Need help how to reconfigured the Crystal Report IDE if thier's any..
Thanks.. uda
Edited by uda_shy - 28 Jul 2010 at 6:13pm
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|
Posted: 29 Jul 2010 at 12:37am |
There is no way to do this. The export .dll files that Crystal uses provide access to a very limited set of features for each type of export. You can't access anything beyond the options that are available to you in the export screens in the Crystal IDE.
-Dell
|
|
IP Logged |
|
|