SRVPrint - there is no default printer currently selected

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
BoD
Posts: 2
Joined: Tue Aug 14, 2018 5:34 am

SRVPrint - there is no default printer currently selected

Post by BoD »

Good day!

If the printer is not completely removed from the system when working with the SRVPrint component,
appears error "There is no default printer currently selected" .
A similar error was described in 2012 (/forums/viewtopic.php?t=5488) - still no changes in the source code.

:idea: How to reproduce the error:
  1. The system should not have printers (disconnect and remove all).
  2. Create a new printer (for example, Microsoft XPS) on the unused port (LPT1...).
  3. Create a new VCL – Delphi application and place the SRVPrint component on the form.
  4. Save the project and close Delphi.
  5. Print something (for example, a test page) - the job gets into the print queue.
  6. Remove the printer (it will disappear from the list of printers)
  7. Start Delphi and open the saved project...Error :!:
The problem in the used module Printers.
Which, in this situation, it returns Printer.Printers.Count = 1
But any references to Printer objects (for example, Printer.PrinterIndex, etc.) - generates an error.

Used with:
Delphi 2010, XE6
TRichView 17.2.1
ScaleRichView 8.1.2
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: SRVPrint - there is no default printer currently selected

Post by Sergey Tkachenko »

I thought that checking for Printers.Count = 0 solved the problem, and these changes there made...

I cannot reproduce the error in the scenario you described. In my test, Printers.Count = 0 in this case.
What version of Windows do you use?
BoD
Posts: 2
Joined: Tue Aug 14, 2018 5:34 am

Re: SRVPrint - there is no default printer currently selected

Post by BoD »

Thank you for answer.
I'm use windows 10 x64

Simplest way to reproduce the error:
The system should not have printers (disable / delete all).
Delphi is not running.
  1. Add a new printer (for example, Microsoft XPS) on the unused port (LPT1...).
  2. Send something (for example, a test page) to print - the job gets into the print queue.
  3. Remove the printer (it will disappear from the list of printers)
  4. Create a new Delphi VCL – application and try to place the SRVPrint component on the form...Error
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: SRVPrint - there is no default printer currently selected

Post by Sergey Tkachenko »

I sent a fix by a private message, please test it.
Post Reply