Lazarus

Free Pascal => Beginners => Topic started by: pentilisea on March 22, 2023, 07:38:12 pm

Title: printing stuff
Post by: pentilisea on March 22, 2023, 07:38:12 pm
Hu guys,
stuck again awefully dispite googling the printer stuff.

I've got the printer dialog:
Code: Pascal  [Select][+][-]
  1. if PrintDialog1.Execute then

I've got a small png file about 75k bits.
Code: Pascal  [Select][+][-]
  1. Image1.Picture.LoadFromFile('savegrid.png');

How do I bring both together so the pic gets printed on the standard printer?

I looked at a lot of printer stuff with complicated setting - my guess: shouldn't be done with long code pages and printer/doc settings....

Hmm, seems I'm keeping you busy, will try to not post any stupid too basic stuff.....

Any help apreciated.
Klaus
Title: Re: printing stuff
Post by: KodeZwerg on March 22, 2023, 09:08:34 pm
You should read this (https://wiki.lazarus.freepascal.org/Using_the_printer).
If I had a printer I would create a small demo but unfortunately I haven't anymore.
Title: Re: printing stuff
Post by: pentilisea on March 22, 2023, 09:40:55 pm
Hi Mr. Zwerg,
thanks fo far. Already have this link looked at. But haven't yet figured out how to implement it as it is not dealing with PrintDialog.

I need a simple solution, as nothing else will be printed in the app as .png of a small size.

The other Load and Safe file Dialogs are pretty easy to use so I would expect not to fumble around with paper size, margins ....
The components of the PrintDialog seam to not have a print.image or somethiong like this...... or using the OS provided
printer settings...

Will poke around and see what works....
Title: Re: printing stuff
Post by: wp on March 22, 2023, 10:35:51 pm
Here is a small project for you, it should work (I tested on Windows).
Title: Re: printing stuff
Post by: pentilisea on March 24, 2023, 02:51:22 pm
Here is a small project for you, it should work (I tested on Windows).

Hi WP,
works like a charm and gets me started ...

Klaus
TinyPortal © 2005-2018