Solved

Printing problem - the job disapears from the spooler

Posted on 2003-11-01
3
528 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 100

Accepted Solution

by:
mlmcc earned 100 total points
Comment Utility
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
Comment Utility
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 100

Expert Comment

by:mlmcc
Comment Utility
Glad I could help.

mlmcc
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now