Recent

Author Topic: TAChart Printdemo  (Read 1012 times)

ronhud

  • Jr. Member
  • **
  • Posts: 63
TAChart Printdemo
« on: November 30, 2020, 06:34:44 pm »
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

  • Hero Member
  • *****
  • Posts: 7964
Re: TAChart Printdemo
« Reply #1 on: November 30, 2020, 10:37:35 pm »
Just checked it again with my Epson Stylus Office BX535WD, and it is working correctly...
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

AL

  • Full Member
  • ***
  • Posts: 211
Re: TAChart Printdemo
« Reply #2 on: December 01, 2020, 03:54:40 am »
Make sure you did not erase of commented the
Printer.BeginDoc  and Printer.EndDoc instructions
Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

ronhud

  • Jr. Member
  • **
  • Posts: 63
Re: TAChart Printdemo
« Reply #3 on: December 01, 2020, 08:01:25 am »
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

  • Hero Member
  • *****
  • Posts: 7964
Re: TAChart Printdemo
« Reply #4 on: December 01, 2020, 09:44:49 am »
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?
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

ronhud

  • Jr. Member
  • **
  • Posts: 63
Re: TAChart Printdemo
« Reply #5 on: December 01, 2020, 12:00:42 pm »
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

  • Hero Member
  • *****
  • Posts: 7964
Re: TAChart Printdemo
« Reply #6 on: December 01, 2020, 12:04:10 pm »
I notice in the lazarus rawmode demo a mention of something like this.
Which demo is this exactly? (There are so many...)
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

ronhud

  • Jr. Member
  • **
  • Posts: 63
Re: TAChart Printdemo
« Reply #7 on: December 01, 2020, 12:21:01 pm »
the demo is lazarus/components/tachart/demo/print/printdemo

ronhud

  • Jr. Member
  • **
  • Posts: 63
Re: TAChart Printdemo
« Reply #8 on: December 01, 2020, 12:24:15 pm »
oops sorry that should be   lazarus/components/printers/samples/rawmodetest

wp

  • Hero Member
  • *****
  • Posts: 7964
Re: TAChart Printdemo
« Reply #9 on: December 01, 2020, 01:47:23 pm »
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...
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

ronhud

  • Jr. Member
  • **
  • Posts: 63
Re: TAChart Printdemo
« Reply #10 on: December 01, 2020, 01:58:50 pm »
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

  • Hero Member
  • *****
  • Posts: 7964
Re: TAChart Printdemo
« Reply #11 on: December 01, 2020, 03:46:05 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][+][-]
  1.     if RawMode then Label1.Caption := 'RAW MODE' else Label1.Caption := 'normal';
After printing, what does the label show?
« Last Edit: December 01, 2020, 04:06:07 pm by wp »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

ronhud

  • Jr. Member
  • **
  • Posts: 63
Re: TAChart Printdemo
« Reply #12 on: December 01, 2020, 05:12:08 pm »
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

  • Full Member
  • ***
  • Posts: 190
Re: TAChart Printdemo
« Reply #13 on: December 01, 2020, 07:12:35 pm »
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.
Windows 10 (64 bit)
Lazarus: 2.0.10 / Trunk x32

ronhud

  • Jr. Member
  • **
  • Posts: 63
Re: TAChart Printdemo
« Reply #14 on: December 02, 2020, 01:10:07 pm »
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?

 

TinyPortal © 2005-2018