TRVPrint.Print not printing (not arriving in printer queue)

General TRichView support forum. Please post your questions here
Post Reply
DSE
Posts: 4
Joined: Fri Nov 15, 2013 1:16 pm

TRVPrint.Print not printing (not arriving in printer queue)

Post by DSE »

Sometimes when we print from TRVPrint, nothing arrives in the Windows printer queue (from then on consistently - although this might only happen after a few hundred copies who'd just print fine). If we select another printer everything works fine again (for some time). Restarting the application and/or the Windows session does sometimes 'solve' the problem, but not always.

We've updates all printer software (including firmware), and went from network printers to local printers. There's nothing 'special' with the printout before the first faulty one (no errors).

Code looks like this (pdRapToon = printer dialog; rvpRapToon = TRVPrint; rvRapToon: TRichView):

Code: Select all

     
  if pdRapToon.Execute then try
    rvpRapToon.AssignSource(rvRapToon);
    rvpRapToon.FormatPages(rvdoAll);
    rvpRapToon.Print(Caption, pdRapToon.Copies, true);
    rvpRapToon.Clear;
  except
    //some logging
  end;
Any idea anyone?
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I am afraid I do not know why it happens :(

TRichView relies on TPrinter for printing, its printing code contains nothing special - it used Printer.BeginDoc, NewPage, Canvas, EndDoc.

Are there any exceptions?
Last edited by Sergey Tkachenko on Thu Nov 28, 2013 11:51 am, edited 1 time in total.
DSE
Posts: 4
Joined: Fri Nov 15, 2013 1:16 pm

Post by DSE »

Nope, no exceptions. From a Delphi point of view everything works fine.

I'm now adding extra logging to the RichView code, to see where the flow exits.
DSE
Posts: 4
Joined: Fri Nov 15, 2013 1:16 pm

Post by DSE »

I tracked it down to RV_GetPrinterDC. In the cases nothing happens no device context is created (0). This leads to IsDestinationReady = false, which means no formatting, which means lastPgNo = 0 and firstPgNo = 1, which leads to a silent exit in TPrintableRV.PrintPages.

Any ideas why CreateDC sometimes returns 0 (and continuously from then on)?
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I do not know :(

What version of Windows do you use?

Possible problems:
http://support.microsoft.com/kb/967663
http://support.microsoft.com/kb/972616
DSE
Posts: 4
Joined: Fri Nov 15, 2013 1:16 pm

Post by DSE »

Hello Sergey,

I found these also. We will be trying them this week.

Maybe it's an idea to throw an exception if no canvas is allocated, instead of this 'silent exit'. That will be at least my 'solution'.

Thanks for the support!
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

There is no exception, but you can check RVPrint.IsDestinationReady property (after calling FormatPages)
Post Reply