Ada PDF Writer version 7

PDF_Out is an Ada package for producing easily and automatically PDF files, with text, vector graphics, and imported images (JPEG).
With PDF_Out, you can produce automatically reports, invoices, tickets, labels, delivery notes, charts, maps etc. from your Ada program.
The Ada PDF Writer is free and open-source, fully programmed in Ada.

Home page: https://apdf.sourceforge.io/
Sources, site #1: Ada PDF Writer download | SourceForge.net
Sources, site #2: GitHub - zertovitch/ada-pdf-writer: Ada PDF Writer: a standalone, portable package for producing dynamically PDF documents
Alire Crate: Alire - Apdf

:new: Changes in this version:

  • Vector graphics: added Arc and Circle.
  • Navigation: added Hyperlink methods for producing links within or outside the document.

NB: most of recents additions to the package are contributions from users - kudos!

The main demo (pdf_out_demo.adb) includes now some pie charts and hyperlink examples.


An additional demo shows graphically various steps of the k-means data clustering / unsupervised machine learning method.
k_means

Enjoy!
Gautier

11 Likes

Great!

The link to Sierpinski demo is broken, by the way.

Tried without success to find the demo about k-means clustering. What is the name?

Fixed (was a PNG image: https://apdf.sourceforge.io/pw_sierpinski.png ) - thanks!

k_means.adb, in the demos subdirectory.

I tried the library 1 or 2 years ago but I was stuck with how to compute the width and height of the text to display. It’s not part of the PDF specification, but you need it to layout the text correctly (ellipsize/truncate/split lines/whatever). How would you do that?

There is an investigative work behind this topic: get the font metrics.
For the “standard PDF fonts” the PDF 1.7 (ISO standard) says:

9.6.2.2 Standard Type 1 Fonts (Standard 14 Fonts)
The PostScript names of 14 Type 1 fonts, known as the standard 14 fonts, are as follows: Times-Roman,
Helvetica, Courier, Symbol, Times-Bold, Helvetica-Bold, Courier-Bold, ZapfDingbats, Times-Italic, Helvetica-
Oblique, Courier-Oblique, Times-BoldItalic, Helvetica-BoldOblique, Courier-BoldOblique
These fonts, or their font metrics and suitable substitution fonts, shall be available to the conforming reader.
NOTE The character sets and encodings for these fonts are listed in Annex D. The font metrics files for the standard
14 fonts are available from the ASN Web site (see the Bibliography). For more information on font metrics, see
Adobe Technical Note #5004, Adobe Font Metrics File Format Specification.

For usable numbers, I’d look into the sources of Ghostscript or PDF.js .

Thanks for the tip. I’ll look at that.