TAChart Printdemo lazarus / 55-TAChart ---------------------------------------------------------------------- ronhud · 2020-11-30 17:34 I have been looking at the printdemo supplied with Lazarus.  I have an HP  Deskjet 2724 which will print from a file in Notepad for example but when I try to print from the PrintdDemo example it doesnt print and the printer status window  shows the document waiting for printing but its status is 'Error'.   Unfortunately no error code etc.   Any ideas? ---------------------------------------------------------------------- wp · 2020-11-30 21:37 Just checked it again with my Epson Stylus Office BX535WD, and it is working correctly... ---------------------------------------------------------------------- AL · 2020-12-01 02:54 Make sure you did not erase of commented the Printer.BeginDoc  and Printer.EndDoc instructions ---------------------------------------------------------------------- ronhud · 2020-12-01 07:01 Thanks for the comments - I am using the demo without having changed anything.   The file appears to arrive at the printer - it shows up in the Windows printer status window but then the printer driver is reporting an error.  Since the printer prints other documents ok it suggests that the document issued by the demo program is not compatible with this particular printer in some way.  I will refer the problem to HP and see if there is some way to get more info about the error. ---------------------------------------------------------------------- wp · 2020-12-01 08:44 Can you print to file, pdf for example? Is this pdf valid which you can display? What is your OS? Lazarus and FPC version/bitness? ---------------------------------------------------------------------- ronhud · 2020-12-01 11:00 Yes the printdemo will print to pdf and the pdf will display ok.  My OS is Windows 10, Lazarus version 2.0.6 64 bit, FPC is 3.0.4.   The printer is using a WiFi connection to the pc running the program - would this have any bearing?  As I mentioned earlier the file seems to be reaching the printer (it appears in the windows printer status window and the printer gives an audible 'thunk' when the printing is started) I wonder if the printer requires some sort id or special code to actually print - I notice in the lazarus rawmode demo a mention of something like this. ---------------------------------------------------------------------- wp · 2020-12-01 11:04 Quote from: ronhud on December 01, 2020, 12:00:42 pmI notice in the lazarus rawmode demo a mention of something like this. Which demo is this exactly? (There are so many...) ---------------------------------------------------------------------- ronhud · 2020-12-01 11:21 the demo is lazarus/components/tachart/demo/print/printdemo ---------------------------------------------------------------------- ronhud · 2020-12-01 11:24 oops sorry that should be   lazarus/components/printers/samples/rawmodetest ---------------------------------------------------------------------- wp · 2020-12-01 12:47 The rawmode looks pretty ancient to me; on my printer I had the issue that it did not eject the output at the end... Since you work with the 64-bit IDE I checked also a 64-bit version of the (TAChart) print demo, and it is working, too, as expected. I could only imagine that your print driver has some issue processing one or some of the canvas drawing commands that TAChart uses. A workaround may be to install your printer a second time, now using a similar model; or use the driver coming with Windows instead of the manufacturer's driver. I am attaching a simple test program which only draws a simple line across the page -- this is the kind of graphics used by TAChart. It should work. On the other hand, I must say that I do have occasional printing problems, too. In my case the print dialog says irreproducibly that my Epson does not exist. I attributed this to an unstable WiFi connection. Having fixed this I did not see this again, until a few minutes ago after having printed the rawmode demo. ATM, I cannot tell what this is... ---------------------------------------------------------------------- ronhud · 2020-12-01 12:58 wp Thank you for your help.   I have run your line program and get the same result as the chart printdemo. Some more info Windows printer status shows 1 file in queu size 13.3kb same window has a document properties view which says size 0 bytes Pages 1 datatype RAW. ---------------------------------------------------------------------- wp · 2020-12-01 14:46 Quote from: ronhud on December 01, 2020, 01:58:50 pm datatype RAW. This sounds as if you are in raw mode. According to https://lazarus- ccr.sourceforge.io/docs/lcl/printers/tprinter.rawmode.html, this does not sound correct - I am no printing specialist, though, I rarely use the printer... Try to find out how you can configure the printer to leave raw mode (maybe just turn it off and then back on). [EDIT] Add a label to the line demo and add this code before "BeginDoc": 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 RawMode then Label1.Caption := 'RAW MODE' else Label1.Caption := 'normal';After printing, what does the label show? ---------------------------------------------------------------------- ronhud · 2020-12-01 16:12 it shows 'normal'.     Strange that the Document properties as shown by the windows printer status (document properties option) is RAW and  also 0 bytes.    If there is nothing for the printer to read then that could account for its not starting the print process.    I am thinking that the canvas is not being sent - perhaps just some header information that includes the file size.  Anyway I thank you again for responding - I have sent a message to HP though I have my doubts about getting anything useful back.  I can print the chart to a pdf and print that from outside my application for now. ---------------------------------------------------------------------- sstvmaster · 2020-12-01 18:12 I think "RAW" means direct printing via XPS for newer drivers. I found this: https://h30434.www3.hp.com/t5/LaserJet-Printing/Send- Raw-Print-Jobs-do-not-print/m-p/6594229/highlight/true#M339470 and with the "XPS_PASS" i found this: https://stackoverflow.com/questions/57680432/how-to-send-data- directly-to-xps-printer-in-delphi-using-the-flag-xps-pass I hope it could be an solution or an direction. ---------------------------------------------------------------------- ronhud · 2020-12-02 12:10 sstvmaster I have just bought the printer and the driver files are v4 so I think there is a strong possibility that you have found the reason for this problem.  If so more developers are going to find themselves in the same position. wb - how would you amend your single line program to cope with this? ---------------------------------------------------------------------- wp · 2020-12-02 12:45 I think such a fix should go into the printers unit, probably the report libs have the same issue. Unfortunately I am not a printer specialist. Therefore you should file a bugreport and describe the situation, you should attach my simple line demo program because it is independent of TAChart. In the meantime you could try to install your printer a second time. The OS will probably find another model which is similar, maybe does not support all features of the "1st choice" driver, but uses the old driver model. Create a system restore point before doing this so that you can return to the old system configuration in case that something goes wrong. If it works out you can use this printer for the TAChart print-out, and the original one for all your other print jobs. ---------------------------------------------------------------------- ronhud · 2020-12-04 11:37 Thanks for the response wp.  I'll explore your suggestions.  Never submitted a bug report so that will be a first.