Bug #11833


Wt PDF output problems with some versions of libharu 2.4.x

Added by Bruce Toll about 1 year ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


There appears to be a bug in libharu versions 2.4.0 through 2.4.3 where some floating point values are written incorrectly by the HPDF_FToA() function. This can result in corrupt PDF files where only a portion of the intended content is visible.

An attached example program, wt_test_chart.C, can be used to demonstrate the issue.

Testing was done with Wt 4.10.0 with both libharu 2.3.0 and 2.4.3 builds. In both cases, the interactive chart is displayed as intended. Pressing the "Export to PDF" button, however, results in different PDF output. The libharu 2.3.0 is similar to the interactive version, while the libharu 2.4.3 version is missing several elements, including the y-axis labels, title, and legend.

I've attached PDF samples from each build: test_haru_2_3_0.pdf and test_haru_2_4_3.pdf.

I've also posted a nix flake to make it easier to reproduce the exact builds I used. See:

More information on the libharu issue can be found here:

Of course, this is not directly a Wt issue, but perhaps Wt could provide a release note and/or a warning/error if an attempt is made to build with one of the affected libharu versions.

For reference, the repology site has information on which versions of libharu are included with various Linux distributions:

NOTE 1: It is possible that this issue does not appear on all platforms. I only have access to an x86_64-linux platform.
NOTE 2: It seems that the libharu HPDF_FToA() function is also called in rendering the interactive chart via Wt::WMeasurePaintDevice::drawText. But, I don't know if it has any adverse affect.


wt_test_chart.C (3.88 KB) wt_test_chart.C Bruce Toll, 07/17/2023 04:05 PM
test_haru_2_3_0.pdf (3.96 KB) test_haru_2_3_0.pdf Bruce Toll, 07/17/2023 04:05 PM
test_haru_2_4_3.pdf (3.99 KB) test_haru_2_4_3.pdf Bruce Toll, 07/17/2023 05:03 PM

No data to display


Also available in: Atom PDF