Recent

Author Topic: TAChart printdemo from examples prints only black rectangle  (Read 1910 times)

Alchemist45

  • Newbie
  • Posts: 4
TAChart printdemo from examples prints only black rectangle
« on: November 04, 2019, 07:27:56 pm »
Hello all,

I am returning to Lazarus/Delphi after retiring 18 years ago.  I have hit a snag in using Lazarus on Linux Mint.  I can run most of the TAChart demos except for the printdemo example.  It fails to print properly to any of my printers.  Instead of printing the chart it prints a black rectangle where the chart should be. 

This works properly in Windows, but not in linux using standard cups printer setup.  Even a pdf created is black!

The selectprinter example/demo is the only printer I have found that works.

Any help would be appreciated.  My work before retiring relied heavily on print out of graphs/charts and I'm interested in getting those program working.

Any help or advice is welcome!!

Alchemist45

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: TAChart printdemo from examples prints only black rectangle
« Reply #1 on: November 04, 2019, 07:44:45 pm »
Hi!

Is the package printers4lazarus installed?

And then

uses  .......,printers4lazarus;

Allready done?

Winni

Alchemist45

  • Newbie
  • Posts: 4
Re: TAChart printdemo from examples prints only black rectangle
« Reply #2 on: November 04, 2019, 08:22:17 pm »
Yes.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: TAChart printdemo from examples prints only black rectangle
« Reply #3 on: November 04, 2019, 08:34:51 pm »
Hi!

Idea 1: You confused the cups daemon. Restart it.

Idea 2: Some printer options might be confused. Use a PrinterSetupDialog (Page Dialogs) to control that.

Winni

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: TAChart printdemo from examples prints only black rectangle
« Reply #4 on: November 04, 2019, 10:29:23 pm »
Which Lazarus/fpc version?

Alchemist45

  • Newbie
  • Posts: 4
Re: TAChart printdemo from examples prints only black rectangle
« Reply #5 on: November 05, 2019, 01:28:00 am »
Lazarus 2.0.4
Fpc 3.0.4
2019-09-12 version
Nothing suggested so far works.
Select printer dialog project prints test images.
Any suggestions?
Thanks.

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: TAChart printdemo from examples prints only black rectangle
« Reply #6 on: November 05, 2019, 07:29:39 pm »
I can confirm on my Mint if compiled to gtk2 widgetset. The print-out is correct, however, when I use qt widgetset. The demo prints correctly in gtk2 as well if I replace the Color and BackColor values of clBtnFace by clWhite. Or if you need the shades of clBtnFace replace it at runtime by its rgb values:
Code: Pascal  [Select][+][-]
  1. uses
  2.   LCLIntf;
  3. ...
  4.   Chart1.Color := ColorToRGB(clBtnFace);
  5.   Chart1.BackColor := ColorToRGB(clBtnFace);
« Last Edit: November 05, 2019, 10:10:01 pm by wp »

Alchemist45

  • Newbie
  • Posts: 4
Re: TAChart printdemo from examples prints only black rectangle
« Reply #7 on: November 07, 2019, 02:30:09 am »
Thanks for the reply, wp.

Your suggestion fixed the black area in the demo.
In my old program it works for all but the top header title of the graph which is still black.
Do you know what is different about the top title above the graphed area in the Chart?
I haven't been able to find a separate background parameter color for that area.

Thanks for any advice you can give.

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: TAChart printdemo from examples prints only black rectangle
« Reply #8 on: November 07, 2019, 10:29:47 am »
gkt2 seems to have a issue in converting the system colors to rgb values. Try to avoid such colors when you intend to print under gtk2, or replace them by the rgb values by calling ColorToRGB as I showed above. The chart title, for example, has the Brush.Color clBtnFace which will render as black in the printout as you saw for the chart background. Set it to clWhite (or any other non-system color), or set the Brush.Style to bsClear to make the title transparent.

 

TinyPortal © 2005-2018