|
| 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 |
| 9 | +res_type: kb |
| 10 | +ticketid: 1692742 |
| 11 | +--- |
| 12 | + |
| 13 | +## Environment |
| 14 | + |
| 15 | +| Version | Product | Author | |
| 16 | +| ---- | ---- | ---- | |
| 17 | +| 2025.2.520| RadPdfProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)| |
| 18 | + |
| 19 | +## Description |
| 20 | + |
| 21 | +Learn how to address the issue where a special symbol (e.g. apostrophe character) is replaced by a copyright symbol in a filled PDF AcroForm using RadPdfProcessing. When the form is opened for editing, the character appears correctly as an apostrophe in the editor itself. |
| 22 | + |
| 23 | +## Solution |
| 24 | + |
| 25 | +This issue is likely caused by the font encoding used in the 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. |
| 26 | + |
| 27 | +To resolve this issue, set the font of the AcroForm fields to one of the 14 standard PDF fonts, such as Helvetica, Times, or Courier. These fonts have broad character support and do not require embedding. |
| 28 | + |
| 29 | +### Steps: |
| 30 | + |
| 31 | +1. Iterate through all form fields in `RadFixedDocument.AcroForm.FormFields`. |
| 32 | +2. Check if the field type is `TextBox` or `CombTextBox`. |
| 33 | +3. Set the widget font and text properties font to `FontsRepository.HelveticaBold`. |
| 34 | + |
| 35 | +### Code Implementation |
| 36 | + |
| 37 | +Use the following code snippet to update the font for all text fields in the PDF document: |
| 38 | + |
| 39 | +```csharp |
| 40 | +foreach (FormField field in document.AcroForm.FormFields) |
| 41 | +{ |
| 42 | + if (field.FieldType == FormFieldType.TextBox || field.FieldType == FormFieldType.CombTextBox) |
| 43 | + { |
| 44 | + TextField textBox = (TextField)field; |
| 45 | + |
| 46 | + // Set the font for the text field widgets |
| 47 | + textBox.Widgets.First().TextProperties.Font = FontsRepository.HelveticaBold; |
| 48 | + |
| 49 | + // Set the font for the text field text properties |
| 50 | + textBox.TextProperties.Font = FontsRepository.HelveticaBold; |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | +After applying the code, the apostrophe character will render correctly in the filled PDF. |
| 55 | + |
| 56 | +## See Also |
| 57 | +- [Fonts in RadPdfProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/concepts/fonts) |
| 58 | +- [RadPdfProcessing Overview](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) |
| 59 | +- [Working with AcroForm Fields](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/features/interactive-forms) |
| 60 | + |
| 61 | +--- |
0 commit comments