Improving SVG to PDF conversion
What has changed?
In our iText Core version 7.2.1 release, we implemented a couple of bug fixes for issues which had the potential to adversely affect document creation.
The first bug was causing SvgConverter
to create invalid graphics instructions that caused text position bugs in some viewers. (Safari and View on macOS, and Documents on iOS. The issue was that SvgConverter
was creating invalid content streams due to having unallowed operators in the BT/ET
('Begin Text'/'End Text') sequence in certain situations.
Below is an example of one of the invalid streams we found while investigating this bug:
To resolve this bug, the logic of TextLeafSvgRenderer
(Java/.NET) was rewritten from scratch to ensure valid stream generation, so all platforms and viewers would render the document in the same way.
The second issue was a bug in how the 'path' element's 'd' property (a property to specify the shape of a path) was handled. The SVG 2.0 specification allows a 'd' property with a 'none' default value, which means that the element does not render or contribute to the bounding box of ancestor container elements. In our release of iText Core version 7.2.1, we took measures to explicitly allow a path object with that property.
How is the user impacted?
As these are bug fixes, not much will change for the average user in terms of how they code their applications, all SVG creation elements work as they did before due to all changes being made to the backend of the library.