Article

From:
To:
All
Subject:
Error: "Printer selected is not valid."
Newsgroup:
borland.public.delphi.nativeapi.win32

Error: "Printer selected is not valid."

Hello,

I have a Delphi 7 project that prints to a plastic card printer using the Printers.pas unit and calling "BeginDoc". I have updated to the latest driver for the newer model printer and I've also tried using Windows 2000 and Windows XP to see if Windows was part of the issue but it isn't. When "BeginDoc" is called using the old plastic card printer it works, but using the newer model (and corresponding new driver), I get this error when "BeginDoc" is called: "exception class EPrinter....Printer Selected is not Valid". Specifically, the line causing the failure (see "printers.pas" code below) is "if DC - 0 then RaiseError(SInvalidPrinter);
    if Assigned(CreateHandleFunc) then
      with TPrinterDevice(Printers.Objects[PrinterIndex]) do
      begin
        DC := CreateHandleFunc(PChar(Driver), PChar(Device), PChar(Port), DevMode);
        if DC = 0 then RaiseError(SInvalidPrinter);
        if FCanvas <> nil then FCanvas.Handle := DC;
      end;
    State := Value;


Off-the-shelf card design software prints with no problems using the new card printer.
Is it more likely that my issue is with the driver or with Delphi? Does anyone have a solution or workaround that I could try.
Thanks in advance for reading and for your help.
Edward
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Sat, 23 Nov 2024 00:08:52 UTC
Copyright © 2009-2024
HREF Tools Corp.