[SOLVED] New Printer giving me grief! lazarus / 21-General ---------------------------------------------------------------------- Badger · 2022-03-31 10:18 I have had an Epson WF-2750 for many years and recently upgraded to an Epson WF4830. Suddenly I can't get my programs to print.  I keep getting an error message (I think its a windows error message)  "Error printing on ####### (Epson WF 4830 Series)  The printer couldn't print" The old WF2750 still prints fine for the same program. Does anyone out there have a WF4830 printer and are you having the same problem? This is the code I used to test Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, PrintersDlgs,  printers; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    PrintDialog1: TPrintDialog;    procedure Button1Click(Sender: TObject);  private   public   end; var  Form1: TForm1; implementation var  MyPrinter:TPrinter; {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);begin  If PrintDialog1.Execute then  begin    MyPrinter := Printer;    MyPrinter.BeginDoc;      MyPrinter.Canvas.font.size:=12;      MyPrinter.Canvas.TextOut(200,200,'Please  Work');    MyPrinter.EndDoc;  end;end; end. ---------------------------------------------------------------------- Zvoni · 2022-03-31 10:45 Can you print a Testpage from within windows? In such cases my money is on windows giving you grief and not the printer........ ---------------------------------------------------------------------- Badger · 2022-03-31 11:07 Test page printed fine. (Good job you didn't put real money on it! ---------------------------------------------------------------------- rvk · 2022-03-31 11:19 Quote from: Badger on March 31, 2022, 12:18:58 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     MyPrinter := Printer;    MyPrinter.BeginDoc; Why are you using MyPrinter and not Printer directly? Try: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i If PrintDialog1.Execute thenbegin  Printer.BeginDoc;  Printer.Canvas.font.size:=12;  Printer.Canvas.TextOut(200,200,'Please  Work');  Printer.EndDoc;end;Does that also give you an error? ---------------------------------------------------------------------- Badger · 2022-03-31 11:39 I usually use just printer and initially did so on this occasion but that gave me the same error.  Then I remember reading somewhere that Lazarus didn't like referring directly to printer (Can't remember where or when) but this gave the same result. Incidentally, all regular programs such as Libre Office, Google Chrome, Thunderbird, etc print fine on the new printer.  That's why I want to find someone with a WF 4830 to try the program to see if it's a problem with my printer or Lazarus ---------------------------------------------------------------------- Zvoni · 2022-03-31 11:52 hmm..... Have you checked "printer.Printers"-List? Should return all System- Printers Somehow i still think it's not your printer (as in Hardware), but more like "wrong standard-printer" Wouldn't suprise me, if you have TWO printers installed with nearly the same name I've cursed Windows many times for that stunt https://wiki.freepascal.org/Using_the_printer ---------------------------------------------------------------------- rvk · 2022-03-31 13:06 Or the printer is named really weird or long and that the printer-unit can't handle that name. (just a thought) ---------------------------------------------------------------------- winni · 2022-03-31 15:37 Hi! Check which printer is selected: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     If PrintDialog1.Execute then    begin      showMessage (Printer.PrinterName);      Printer.BeginDoc;      Printer.Canvas.font.size:=12;      Printer.Canvas.TextOut(200,200,'Please  Work');      Printer.EndDoc;  end;  Winni ---------------------------------------------------------------------- Badger · 2022-03-31 20:57 The Message returns the correct name of the printer and this corresponds to the printer named in the error message ---------------------------------------------------------------------- rvk · 2022-03-31 21:05 What's the port name of that printer? (Wireless? Ipv6? WSD? If so, try tcp/ipv4) ---------------------------------------------------------------------- wp · 2022-03-31 21:08 This somehow reminds me of a RAW mode discussion I was involved some time ago: https://forum.lazarus.freepascal.org/index.php/topic,52355 In particular, look at the repy https://forum.lazarus.freepascal.org/i ndex.php/topic,52355.msg385827.html#msg385827 ---------------------------------------------------------------------- Badger · 2022-04-01 00:00 wp   You just hinted at something I was examining. I was looking at the Windows Printer Test Page that Zvoni suggested to print and I noticed that all the additional print drivers listed started with E_.........  It suddenly occurred to me that I had seen something similar recently.  I recalled that Avast had put a file E_YARNXIE.exe into its Quarantine Vault because it identified it as  IDP.Generic. I went looking in  C:\Windows\System32\spool\drivers\x64\3  and there were a number of Epson Files there. I did a restore from quarantine then did an Avast 'Scan selected items for viruses' and it got a clean bill of health.  However, when I tried my print test program it came up with the IDP.Generic alert and stuck it back into quarantine. I have also run the file through TotalVirus with no detrimental flags. My quandary is, do I put an exception on this damned file? ---------------------------------------------------------------------- af0815 · 2022-04-01 04:42 Problems with snakeoil :-) SCNR Google says: https://support.avast.com/en-us/article/Antivirus-scan-exclusions/ IDP.Generic is a heuristic found, often misdetected. You can see something if you compile a compiler by itselft.  A good idea is, to send the file to your AV-Provider and say it is a =)(/%$§ positive false with his "§%%& product. ---------------------------------------------------------------------- delphi2pk · 2022-04-01 12:59 I wrote your code in Lazarus 2.20 on windows 8.1 64bit with a shared printer hp lasterjet P1102 on win 8.1 32bit. everything working fine. no error occure. I think your printer driver is creating problems. Please check it. Quote from: Badger on March 31, 2022, 12:18:58 pmI have had an Epson WF-2750 for many years and recently upgraded to an Epson WF4830. Suddenly I can't get my programs to print.  I keep getting an error message (I think its a windows error message)  "Error printing on ####### (Epson WF 4830 Series)  The printer couldn't print" The old WF2750 still prints fine for the same program. Does anyone out there have a WF4830 printer and are you having the same problem? This is the code I used to test Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, PrintersDlgs,  printers; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    PrintDialog1: TPrintDialog;    procedure Button1Click(Sender: TObject);  private   public   end; var  Form1: TForm1; implementation var  MyPrinter:TPrinter; {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);begin  If PrintDialog1.Execute then  begin    MyPrinter := Printer;    MyPrinter.BeginDoc;      MyPrinter.Canvas.font.size:=12;      MyPrinter.Canvas.TextOut(200,200,'Please  Work');    MyPrinter.EndDoc;  end;end; end. ---------------------------------------------------------------------- Badger · 2022-04-02 11:37 Well after pulling my hair out for a couple of days I finally got the damn printer to work!!!!!! I won't bore people with the whole sorry story - here's the highlights The file rejected by Avast was a false positive so in desperation I tried everything I could think of. I ran setup disc 99+ times, reloaded and updated the printer's firmware, updated windows 10 and its print drivers, updated Epsom drivers several times, changed printer port, kicked the printer, slammed fist randomly on keyboard and screamed at the cat.  Somewhere along the line I did something that convinced the damn thing to cooperate - it was probably when I kicked it.  Anyway, it is now working - thanks for all your advice folks. (Yeh, I know. I should have changed one variable at a time so I knew where the error was but by this evening, after 3 days, I just couldn't give a #@$%.) ---------------------------------------------------------------------- winni · 2022-04-02 11:48 Hi! Todays AntiVius Software are snakeoil and the heuristic causes a lot of trouble. It is not only Avast. I had a lot of poblems with false positive from Bitdefender. Whenever you want to install something on your machine: * Disable the net connection (if not necessary for the install) * Disable the AntiVirus programm * Install Winni ---------------------------------------------------------------------- af0815 · 2022-04-02 15:47 Before my used Av makes a design decision (by comercials) and i have to kick the snakeoil :-) it was a good way to send them the positive false. And 1 up to 3 days later i see the problem was gone and the new definitions are updates well and the positive false are gone. It was a paid AV (with limited basic support).