Recent

Author Topic: PDF generator  (Read 5560 times)

stem

  • Full Member
  • ***
  • Posts: 101
PDF generator
« on: February 28, 2020, 03:40:55 pm »
Hi,

I want to create pdf files in my multi-platform Lazarus project. I've found three solutions:


What would be your preferred choice? The pdf files will contain mainly text.

Thank you.

stem

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: PDF generator
« Reply #1 on: February 28, 2020, 04:53:55 pm »
What would be your preferred choice? The pdf files will contain mainly text.

For relatively simple, straightforward, "mostly text" PDFs I'de use fcl-pdf: it's relatively simple, doesn't have external dependencies, has most (if not all) of the needed features, and is already included in Lazarus/FPC.

That said, note that I've never used any of them for serious work; I tend to rely on a system-wide PDF "printer" instead.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

madref

  • Hero Member
  • *****
  • Posts: 1116
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: PDF generator
« Reply #2 on: February 28, 2020, 06:36:30 pm »
PowerPDF is easy to use with LazReport.
Instead of opening the report you just export it with PowerPDF.
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Main Platform:
--------------
Mac OS X Tahoe 26.2
Lazarus 4.99 (rev main_4_99-3149-g7867f6275c) FPC 3.3.1 x86_64-darwin-cocoa

Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)

af0815

  • Hero Member
  • *****
  • Posts: 1409
Re: PDF generator
« Reply #3 on: February 28, 2020, 07:02:46 pm »
fcl-pdf. This is maintained by the fpc team.
regards
Andreas

GAN

  • Sr. Member
  • ****
  • Posts: 389
Re: PDF generator
« Reply #4 on: February 28, 2020, 07:12:53 pm »
I use PowerPDF with LazReport. It's easy if you know how to use LazReport.
Linux Mint Mate (allways)
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite - LazReport

useroflazarus

  • New Member
  • *
  • Posts: 23

stem

  • Full Member
  • ***
  • Posts: 101
Re: PDF generator
« Reply #6 on: February 28, 2020, 10:09:17 pm »
Is it possible to have a "print preview" of the generated pages with fcl-pdf?

stem

dsiders

  • Hero Member
  • *****
  • Posts: 1676
Re: PDF generator
« Reply #7 on: May 26, 2026, 09:53:32 pm »
Hi,

I want to create pdf files in my multi-platform Lazarus project. I've found three solutions:


What would be your preferred choice? The pdf files will contain mainly text.

Thank you.

stem

There is also the Pixie library (https://gitlab.com/retrofoxed/pixie/-/tree/master). It is intended for HTML | Markdown | SVG export to PDF. But I've used it's markdown viewer to export plain text to PDF.

It's relatively new.

tdb

  • New Member
  • *
  • Posts: 36
Re: PDF generator
« Reply #8 on: June 04, 2026, 05:23:09 pm »
Hi Stem,

I am using fcl-pdf and it works well for me as I like to have full control of the report. However much more hands on as you need to do all the coding for the reports.
I personally like this as it give complete control over the entire report head, body and footer.

If you prefer an easier way to product Pdf's then maybe a good report writer but you might need to pay $$$ for a commercial product.
NOTE fcl-pdf does need some improvements font size and placement on the page need work and I don't think anyone is actively developing.

Anyway I like the library and works for me to generate reports, invoices, statement etc. More work but more control.

Cheers Trevor

JollyHong

  • New Member
  • *
  • Posts: 11
Re: PDF generator
« Reply #9 on: July 23, 2026, 11:09:15 am »
I'd also recommend cleaning and rebuilding the project after making the changes, since old build files can sometimes cause confusing behavior. It's a simple step, but it has saved me more than once.

Zvoni

  • Hero Member
  • *****
  • Posts: 3466
Re: PDF generator
« Reply #10 on: July 23, 2026, 12:53:34 pm »
Hi,

I want to create pdf files in my multi-platform Lazarus project. I've found three solutions:


What would be your preferred choice? The pdf files will contain mainly text.

Thank you.

stem

fcl-pdf

if you want to go the full gamot, pdfium might be an alternative.
IIRC, pawel is the maintainer/programmer for the bindings
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

jcmontherock

  • Sr. Member
  • ****
  • Posts: 363
Re: PDF generator
« Reply #11 on: July 23, 2026, 11:04:39 pm »
Windows 11 UTF8-64 - Lazarus 4.8-64 - FPC 3.2.2

Tomxe

  • Full Member
  • ***
  • Posts: 144
Re: PDF generator
« Reply #12 on: July 24, 2026, 01:11:10 am »
https://github.com/Xelitan/PDF-Viewer-exporter-in-pure-Free-Pascal-Lazarus-Delphi

Code: Pascal  [Select][+][-]
  1. PDF := TXelPDF.Create(Form1);
  2. Pdf.LoadFromFile('input.txt');
  3. Doc := Pdf.Document;
  4.  
  5. FontRes := Doc.AddFont(FontName, FontSize);
  6. Doc.AddText(PageIndex, 'Test Here', Left, Top, FontRes);

 

TinyPortal © 2005-2018