Skip to content

Commit 5045719

Browse files
Merge pull request #593 from telerik/new-kb-apostrophe-character-replaced-copyright-symbol-acroform-ed8a71f631fe4bd1a5e2bbb440eb311b
Added new kb article apostrophe-character-replaced-copyright-symbol-acroform
2 parents b8e3ad7 + 937522e commit 5045719

File tree

4 files changed

+75
-1
lines changed

4 files changed

+75
-1
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
![apostrophe-character-replaced-copyright-symbol-acroform ><](images/apostrophe-character-replaced-copyright-symbol-acroform.gif)
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+
---
Loading

libraries/radpdfprocessing/concepts/fonts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,5 @@ You can create fonts that are not explicitly registered. Creating a font that is
165165
* [TextFragment]({%slug radpdfprocessing-model-textfragment%})
166166
* [Preserving the Font in PDF Export from Excel]({%slug preserve-font-boldness-pdf-export-radspreadprocessing%})
167167
* [How to Prevent Text with Special Characters from Being Cut Off when converting HTML to PDF using RadWordsProcessing]({%slug prevent-text-cut-off-pdf-conversion-radwordsprocessing%})
168+
* [Resolving Apostrophe Character Being Replaced with Copyright Symbol in Filled PDF AcroForm]({%slug apostrophe-character-replaced-copyright-symbol-acroform%})
168169

libraries/radpdfprocessing/model/interactive-forms/acroform.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ The AcroForm class provides the following properties:
3232
* [FormField]({%slug radpdfprocessing-model-interactive-forms-form-fields%})
3333
* [FormFieldCollection class]({%slug radpdfprocessing-model-interactive-forms-formfieldcollection%})
3434
* [Widgets]({%slug radpdfprocessing-model-annotations-widgets%})
35-
* [Extracting Data from PDF Form Fields Using RadPdfProcessing]({%slug extract-pdf-form-fields-data-radpdfprocessing%})
35+
* [Extracting Data from PDF Form Fields Using RadPdfProcessing]({%slug extract-pdf-form-fields-data-radpdfprocessing%})
36+
* [Resolving Apostrophe Character Being Replaced with Copyright Symbol in Filled PDF AcroForm]({%slug apostrophe-character-replaced-copyright-symbol-acroform%})
3637

0 commit comments

Comments
 (0)