mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-19 14:05:04 +00:00

# Description of Changes Previously, highlight annotations in PDF documents converted to PDF/A format lost their opacity, resulting in highlights appearing completely opaque. This issue stemmed from LibreOffice’s PDF to PDF/A conversion process and affected both supported PDF/A variants (PDF/A-1B and PDF/A-2B). To resolve this, a new conversion method was implemented. Because PDF/A-1B does not support transparency, unlike PDF/A-2B, the input PDF must be preprocessed to flatten existing transparent objects when targeting PDF/A-1B. Changes: - Preprocess the PDF to handle highlight transparency when converting to PDF/A-1B; - LibreOffice's PDF to PDF/A conversion is now only used if fonts are not embedded or images require flattening; - If needed, missing fonts and flattened images are imported from the LibreOffice-converted file; - The document is traversed to remove elements non-compliant with PDF/A standards; - Updated metadata, including all metadata schemes, to ensure full compliance; - Added an ICC Profile if one was not already present. Any challenges encountered: - Since PDF/A-1B does not support transparency, the best workaround I found in other conversion tools was to draw close diagonal lines with the highlight color to simulate transparency, as seem in the example below. Closes #3106 Example from the issue: Original:  PDF/A-1B:  PDF/A-2B:  --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [x] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. I tested the changes using a variety of PDF files and verified PDF/A compliance of the outputs using VeraPDF. While these tests covered different scenarios and document types, PDF files can vary significantly in structure and complexity. As a result, the testing was not exhaustive, and while the results so far have been compliant, full compliance in all edge cases cannot be guaranteed. --------- Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>