?
Solved

Printing problem - the job disapears from the spooler

Posted on 2003-11-01
3
Medium Priority
?
536 Views
Last Modified: 2012-08-14
Environment:
  OS: Windows XP
  Programming language: Delphi 4 + service packs
  VCL component version: 7.4.0.41, VCL for Delphi 4
  Crystal Reports: Development Edition 8.5.0.217

Specification:
The program has to print a crystal report without user intervention to a nominated printer in the program's options. This is part of a automated process and it should just print the report and move on.
I have currently installed 3local printers: Genreric Text ,Panasonic KX-P6100 , dummy printer that prints to a file

Depending on wich is my default printer and which printer is set up in the program's option I get the strage situation when the report is sent to the spooler, it sits there for a half of second saying "Spooling" and that it disapears. There are no errros and no messages. This happens when I tell the report on which printer to print.
If I bring up the printer selection dialog and select the printer than it work juts fine.

Here is the calling code for the crystal report that I am using:

Oderreport: TCrpe; - this is the static Crystal Report component on the form
*****************
      OrdersReport.Clear;
      OrdersReport.ReportName :=  'name of the report file.rpt' ;
      //Set database location
      OrdersReport.Tables.Retrieve;
      OrdersReport.Tables[0].Path := SysControl.DataDirectory;
      OrdersReport.Tables.Propagate := True;
      OrdersReport.output := toPrinter;

      OrdersReport.Printer.Name := SysControl.PrinterName;
      OrdersReport.Printer.ShowDialog := False;
      OrdersReport.Execute;
*************************

SysControl.PrinterName is pick-up up from the options of the program and it's the name of a windows printer as in Printer.Printers[2] wich returns the third printer in the windows printer list.


If I change in the code above only
   OrdersReport.Printer.ShowDialog := True;
and I hit the OK button on the Printer Dialog that appears it will print the report without problems.

Does anyone ever had or encoutered this problem ?

Thank you for your help.
0
Comment
Question by:Tavirgil
  • 2
3 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 300 total points
ID: 9665771
This link shows how it can be done in VB.  A similar approach should work from Delphi

http://www.experts-exchange.com/Databases/Crystal_Reports/Q_20762547.html

mlmcc
0
 

Author Comment

by:Tavirgil
ID: 9792193
I followed up on your advice to read from your post in VB and I've made sure that the report gets all the values needed for the printer (name, driver, port, handle).

This should be the case since in Crystal 8.5 it's adversited that you only need to put the name of the printer and crystal takes care of the rest.

Anyway I used some Windows API functions together with some Delphi functions to get these values rigth.

If anyone interested please tell me.

Thank's for the advice mlmcc and I'll accept your advice since I need it for a VB project that does the same thing as this one: sends the report to the spooler and the job just disapears. I believe I'll take the same aproach but just your code from the answer you pointed me too.

Cheers and thanks a lot.

Virgil
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 9792656
Glad I could help.

mlmcc
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question