Solved

Printing problem - the job disapears from the spooler

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

Expert Comment

by:mlmcc
ID: 9792656
Glad I could help.

mlmcc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

919 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

11 Experts available now in Live!

Get 1:1 Help Now