Recent

Author Topic: Some question about printing  (Read 8798 times)

Kyjan

  • New Member
  • *
  • Posts: 41
Some question about printing
« on: March 20, 2010, 01:14:40 pm »
Hi guys,

I would like to write a complete, integrated environment for lawyers, which help to maintain the cases, the deadlines, data of the clients, and can help to write some papers, i.e. letters and so on.
I found a component (richmemo) which is very useful for loading and saving in .rtf format, which is perfect for me, but I have some problems:

1.) How can i print a document in justify?
2.) Can anyone give me a free editor which can be built in a lazarus application, or should i write it by myself?

Thank you very much!

davesimplewear

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: Some question about printing
« Reply #1 on: March 21, 2010, 12:38:34 am »
Quote
1.) How can i print a document in justify?
Do you mean that the text is justified in your document when you print?
printing tips are in lazarus/\components/\printers.

Regards
Dave
All things considered insanity seems the best option

Kyjan

  • New Member
  • *
  • Posts: 41
Re: Some question about printing
« Reply #2 on: March 21, 2010, 10:24:51 am »
Thank you for your help, Dave.
I've checked the directory you mentioned, but was unable to find any sampe or documentation. So, futher help is needed. :-)

Regards,
Kyjan

davesimplewear

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: Some question about printing
« Reply #3 on: March 21, 2010, 10:45:09 am »
Ok, the path in linux and I presume the same for windows (except the delimeters are reversed) is lazarus/components/printers/samples.

Regards
Dave
All things considered insanity seems the best option

Kyjan

  • New Member
  • *
  • Posts: 41
Re: Some question about printing
« Reply #4 on: March 22, 2010, 07:32:52 pm »
Dave, I found those files, but can't figure out, how can i print in justified mode. So, I keep googling. :)
Thanks for your help.
Regards, Kyjan

davesimplewear

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: Some question about printing
« Reply #5 on: March 22, 2010, 10:54:18 pm »
AFAIK the printer canvas will output as displayed, I have attached the source printer code from lazarus for you to play with.

Regards
Dave
All things considered insanity seems the best option

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12618
  • Debugger - SynEdit - and more
    • wiki
Re: Some question about printing
« Reply #6 on: March 22, 2010, 11:20:06 pm »
Well if justified means having the text align on the right and left border...
I don't know of anything that does it out of the box; I don't even know anything that does the long line wrapping.

eg, if you simply do
Canvas.Textout as in the example, then any part of the line that is longer than the width of the page, is simply cut of.

You need to break down your text into tokens (words) yourself.
Then measure each with "Canvas.TextExtent()", and see how many fit on each line (or if a word is to long, how to break the word).

Once you know how many and which words to put on a line, you can equaly distribute the space in-between them, so you get "justified".

It's a lot of work.
As I said I don't know any ready made module. But I have never looked yet => so there may well be such a solution.



Kyjan

  • New Member
  • *
  • Posts: 41
Re: Some question about printing
« Reply #7 on: March 23, 2010, 07:14:29 pm »
Thanks for your answer, Martin, that's what I was talking about. So, I won't write a text editor, instead i should find a free, portable version somewhere on the Internet. Thanks again.

Regards,
Kyjan

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12618
  • Debugger - SynEdit - and more
    • wiki
Re: Some question about printing
« Reply #8 on: March 23, 2010, 07:31:20 pm »
If you have an editor, the editor will usually know how do to this on it's own canvas. You would likely still have to copy the code and adapt it to use the printer canvas instead.
But it could serve as example.

 

TinyPortal © 2005-2018