Recent

Author Topic: Is there any support for PDF in Free Pascal?  (Read 465 times)

anyone

  • Jr. Member
  • **
  • Posts: 53
    • ASCII Art Online
Is there any support for PDF in Free Pascal?
« on: September 29, 2020, 10:07:09 pm »
Hi all, I am new to this forum.

I wonder if it is worth to create a command-line utility txt2pdf... In fact, I have already started working on it. So it would not make much sense for me to continue working on it if Free Pascal already has built-in support for PDF.



FPC 3.2.0 (i386-Win32) on Windows 10 32-bit.

Handoko

  • Hero Member
  • *****
  • Posts: 3868
  • My goal: build my own game engine using Lazarus
« Last Edit: September 29, 2020, 10:28:24 pm by Handoko »

jwdietrich

  • Hero Member
  • *****
  • Posts: 1141
    • formatio reticularis
Re: Is there any support for PDF in Free Pascal?
« Reply #2 on: September 29, 2020, 10:59:13 pm »
You should also observe the licenses of the existing tools, which may pose restrictions on the mode of distribution of your code.

Additionally, you might want to check out https://foundation.freepascal.org/projects/project-6 and https://foundation.freepascal.org/projects/reporting-engine for information on projects currently being developed.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.10 | FPC 3.2.0 | PPC, Intel, ARM | macOS, Windows, Linux

anyone

  • Jr. Member
  • **
  • Posts: 53
    • ASCII Art Online
Re: Is there any support for PDF in Free Pascal?
« Reply #3 on: September 29, 2020, 11:50:09 pm »
Thank you, @Handoko and @jwdietrich.

"A reporting engine [with PDF support] that does not have GUI dependencies" is something I was looking for.

Though, I just need to convert plain text file into PDF file. In the mean time, I think I will just stick to my own txt2pdf by looking up PDF File Format 1.7 Specification.

However, it is good to know that professional PDF libraries for Free Pascal are available or going to be officially made available.
FPC 3.2.0 (i386-Win32) on Windows 10 32-bit.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1012
  • Former Delphi 1-7, 10.2 User
Re: Is there any support for PDF in Free Pascal?
« Reply #4 on: September 30, 2020, 01:47:54 am »
There is already a wide selection of text to PDF command line tools for both Windows and UNIX or UNIX-like operating systems with source, though they are generally written in C and have varying licences.
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (Parallels VM)

anyone

  • Jr. Member
  • **
  • Posts: 53
    • ASCII Art Online
Re: Is there any support for PDF in Free Pascal?
« Reply #5 on: September 30, 2020, 10:50:04 am »
There is already a wide selection of text to PDF command line tools for both Windows and UNIX or UNIX-like operating systems with source, though they are generally written in C and have varying licences.

Thanks for this useful information.  I hope I am not reinventing the wheel because someone has already done it before.

I am not sure about those command-line tools written in C, but from my initial finding, quite a number of open-source  software (regardless of the platform) are using PdfBox (and its Android port), or iText. Even my resume created with a mobile app was produced by iText (as shown in metadata section).

It is not difficult just to convert plain text into PDF programmatically after a few attempts (without using third-party library) although it would be much complicated to generate multi-page PDF (if input text file is long enough).

 
FPC 3.2.0 (i386-Win32) on Windows 10 32-bit.

 

TinyPortal © 2005-2018