Print Page | Close Window

printDocument fails

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1068
Printed Date: 25 Jun 25 at 5:53PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: printDocument fails
Posted By: MrPopup
Subject: printDocument fails
Date Posted: 24 Apr 09 at 6:30PM
Good morning forum members,
 
Details:
Version: 5.22 & 7.12
Style:     AxtiveX
Application: Jade ( http://www.jadeworld.com/ - www.jadeworld.com ) based - similar to VB
 
I have a print server application that detects pdf files that need to be printed. It validates the file and then uses the printDocument method to launch the actual printing to the specified printer.
 
The process works successfully if in a single ' locate pdfs run' only one pdf file is located or if the multiple files are very small (1/4 pages).
 
However if a number of files are located and some are large (20 to 600 pages) the seciond and subsequent printDocument commends fails with error -2147418113 (null object reference).
 
A seperate QuickPDF object instance is created for each printDocument.
 
To me it appears that while the printDocument call returns to the calling method the AcitveX/library is still in fact still busy sending the file to the print spooler.  As a result the next printDocument causes a failure.  This implies that the library is neither thread safe nor actually capabile of multi-user activity.
 
For large files, if I put in a 2 minute delay prior to issuing the next printDocument all is well however this is not a satisfactory solution. (if the network is busy 2 minutes may be insufficient etc)
 
Does anyone have any suggestions please.
 
Thank you.
 
Charles



Replies:
Posted By: dsola
Date Posted: 14 May 09 at 7:19AM
We have same problem with delphi version.

Still have no solution  Cry



-------------
registered QuickPDF user


Posted By: dsola
Date Posted: 14 May 09 at 8:09AM
We found delphi workaround.

You can't print while printer is in "spooling mode" so before we sent another PDF to print we  check if printer is out of spooling mode.







-------------
registered QuickPDF user


Posted By: MrPopup
Date Posted: 14 May 09 at 3:08PM
Good morning Dsola,
Thanks for the comment. I would love to see the code/mechanism used to check the printers. I do have well over 100 printers on the server! I take it you just check the target printer?
Thank you.
Mrpopup
Smile


Posted By: dsola
Date Posted: 15 May 09 at 2:35AM
Hi MrPopUp.

Yes I know printername on which I need to print so I check just target printer.

Delphi code:
procedure TBatchPrint.DoWork(........);
var
  xx: integer;
  printerName: string;
begin

  printerName := Printer.Printers[FPrinterIndex];
  // check if printer is spooling  500 times (500*.5sec= cca 4min) to avoid inifinite loop
  for xx := 1 to 500 do begin
    if not Printer.Printing then
      Break;
    Sleep(500);
  end;

  PrintDocument(.....);
end;

-------------
registered QuickPDF user



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk