|
| 1 | +--- |
| 2 | +title: Resolving Apostrophe Character Being Replaced with Copyright Symbol in Filled PDF AcroForm |
| 3 | +description: Learn how to address the issue where an apostrophe character is replaced by a copyright symbol in a filled PDF AcroForm using RadPdfProcessing for Document Processing. |
| 4 | +type: how-to |
| 5 | +page_title: Fixing Apostrophe Display Issue in PDF AcroForm Fields |
| 6 | +meta_title: Fixing Apostrophe Display Issue in PDF AcroForm Fields |
| 7 | +slug: apostrophe-character-replaced-copyright-symbol-acroform |
| 8 | +tags: processing, document, pdf, acroform, font, encoding, text, field, xfa |
| 9 | +res_type: kb |
| 10 | +ticketid: 1692742 |
| 11 | +--- |
| 12 | + |
| 13 | +<style> |
| 14 | +img[alt$="><"] { |
| 15 | + border: 1px solid lightgrey; |
| 16 | +} |
| 17 | + |
| 18 | +</style> |
| 19 | + |
| 20 | +## Environment |
| 21 | + |
| 22 | +| Version | Product | Author | |
| 23 | +| ---- | ---- | ---- | |
| 24 | +| 2025.2.520| RadPdfProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)| |
| 25 | + |
| 26 | +## Description |
| 27 | + |
| 28 | +Learn how to address the issue where a special symbol (e.g. apostrophe character) is replaced by a copyright (or other) symbol in a filled PDF AcroForm using RadPdfProcessing. When the form is opened for editing in a viewer (like Adobe Acrobat), the character appears correctly as an apostrophe in the editor itself. |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +>note This might be reproduced with other symbols as well, not only with the apostrophe character. Usually, such behavior may occur with XFA forms. However, from PDF 2.0 (ISO 32000-2) the XFA forms are depreciated. |
| 33 | +
|
| 34 | +## Solution |
| 35 | + |
| 36 | +This issue is likely caused by the font encoding used in the [AcroForm]({%slug radpdfprocessing-model-interactive-forms-acroform%}) fields. If the font does not properly support the character encoding for the apostrophe or is not embedded or referenced correctly, such substitution may occur. |
| 37 | + |
| 38 | +To resolve this issue, set the font of the AcroForm fields to one of the [14 standard PDF fonts]({%slug radpdfprocessing-concepts-fonts%}), such as Helvetica, Times, or Courier. These fonts have broad character support and do not require embedding. |
| 39 | + |
| 40 | +### Steps: |
| 41 | + |
| 42 | +1. Iterate through all form fields in `RadFixedDocument.AcroForm.FormFields`. |
| 43 | +2. Check if the field type is [TextBox]({%slug radpdfprocessing-model-interactive-forms-form-fields-textboxfield%}) or [CombTextBox]({%slug radpdfprocessing-model-interactive-forms-form-fields-combtextboxfield%}). |
| 44 | +3. Set the widget font and text properties font to `FontsRepository.HelveticaBold`. |
| 45 | + |
| 46 | +### Code Implementation |
| 47 | + |
| 48 | +Use the following code snippet to update the font for all text fields in the PDF document: |
| 49 | + |
| 50 | +```csharp |
| 51 | +foreach (FormField field in document.AcroForm.FormFields) |
| 52 | +{ |
| 53 | + if (field.FieldType == FormFieldType.TextBox || field.FieldType == FormFieldType.CombTextBox) |
| 54 | + { |
| 55 | + TextField textBox = (TextField)field; |
| 56 | + |
| 57 | + // Set the font for the text field widgets |
| 58 | + textBox.Widgets.First().TextProperties.Font = FontsRepository.HelveticaBold; |
| 59 | + |
| 60 | + // Set the font for the text field text properties |
| 61 | + textBox.TextProperties.Font = FontsRepository.HelveticaBold; |
| 62 | + } |
| 63 | +} |
| 64 | +``` |
| 65 | +After applying the code, the apostrophe character will render correctly in the filled PDF. |
| 66 | + |
| 67 | +## See Also |
| 68 | +- [Fonts in RadPdfProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/concepts/fonts) |
| 69 | +- [RadPdfProcessing Overview](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) |
| 70 | +- [Working with AcroForm Fields](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/features/interactive-forms) |
| 71 | + |
| 72 | +--- |
0 commit comments