Issue
Text copied from Pega-generated PDF documents appears garbled or as unreadable characters when pasted to external applications such as Notepad or Microsoft Word. The PDF displays correctly when viewed, but the underlying text encoding is corrupted during copy-paste operations.
Symptoms and Impact
- PDFs generated using standard PDF generation activities or Create PDF smart shapes display correctly and are visually intact.
- Copying text from the generated PDF and pasting into text editors (Notepad, MS Word, or other applications) results in garbled output, missing characters, or completely unreadable text.
- The issue affects all text content in the PDF, not specific sections or characters.
- Visual PDF rendering remains unaffected; the problem only manifests during copy-paste operations or find-in-page operations.
- Users cannot extract readable text from generated PDFs for documentation, communication, or downstream processing.
Fonts Affected
- Calibri (most severely impacted)
- OpenSans-Regular
- Any font with ligature support enabled
Steps to Reproduce
- Install HFIX-D1006 to update PD4ML jar from 4.0.19 to 4.0.23.
- Add Calibri font files to the application.
- Configure PDF generation using one of the following methods:
- Create a Create PDF smart shape in a workflow.
- Use standard PDF generation activities (for example, pxCreatePDF, HTMLToPDF).
- Configure correspondence with PDF generation.
- Ensure the PDF section or markup contains text using fonts with ligature support (for example, Calibri, OpenSans-Regular).
- Generate the PDF document at runtime by processing a case or triggering the PDF generation activity.
- Download the generated file.
- Open the generated PDF in a PDF viewer (Adobe Acrobat, browser, PDF viewer, etc.).
- Copy any text from the PDF document.
- Paste the copied text into a text editor (Notepad, MS Word, or similar application).
- Expected Result: Pasted text should match the original PDF content and be fully readable.
- Actual Result: Pasted text appears as garbled, distorted, or completely unreadable characters.
Root Cause
This is a PD4ML library limitation affecting all PDF generation scenarios using Calibri font (or other fonts with complex ligature handling) when ligatures are enabled.
The Calibri font text in the PDF generated using PD4ML library version 4.0.23 is heavily distorted when copied and pasted into text editors. The distortion pattern is inconsistent. Earlier PD4ML version 4.0.19-jakarta also exhibits this issue but with minimal impact due to partial missing letters caused by ligature handling.
Technical Explanation
When pyEnableLigatures is set to true (default configuration) in the pyPDFSettings Data Transform, the PD4ML library combines certain character sequences into single glyph representations (ligatures) to improve visual typography. Common examples include:
- "fi" → single ligature glyph
- "fl" → single ligature glyph
- "ff" → single ligature glyph
During this ligature substitution, the underlying text encoding within the PDF becomes misaligned with the visually displayed characters. When a user copies text from the PDF, the PDF reader attempts to extract the text layer, but the ligature-encoded glyphs do not map correctly back to their original character sequences. This results in:
- Missing characters (e.g., "Office" becomes "Ofce")
- Garbled characters (e.g., random symbols or gibberish)
- Completely unreadable text
Solution
This behavior is a known defect in the PD4ML library versions 4.0.19 Jakarta and 4.0.23 and is planned to be addressed in PD4ML 4.1.1 or later.
A future Pega Platform release will include the updated PD4ML library. The specific release version has not yet been determined. This article will be updated with release details when the fix becomes available in a GA release.
Immediate Workaround (Recommended)
Disable font ligatures in the PDF generation configuration by setting the pyEnableLigatures parameter to false in the pyPDFSettings Data Transform.
Configuration Steps
- Navigate to class Data-Admin-System-Settings and locate Data Transform pyPDFSettings.
- Locate the parameter pyEnableLigatures.
- Change the value from true to false.
- Save the rule.
- Test PDF generation to verify:
- PDFs generate successfully
- Visual quality remains intact
- Text copied from PDFs pastes correctly in external applications
Important Notes
- Disabling ligatures does NOT affect the visual rendering or readability of the PDF.
- The configuration change applies globally to all PDF generation in the application.
- No restart or deployment is required; the change takes effect immediately for newly generated PDFs.
See PD4ML versions and hotfixes and Enhancements and resolved issues with update impact.