Skip to content

Commit 08128d0

Browse files
Merge pull request #2241 from syncfusion-content/1005726-ug
1005726-ug: Extract Form Field Values from PDF documents
2 parents ec484be + 8145ba0 commit 08128d0

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

Document-Processing/PDF/PDF-Library/NET/Working-with-Security.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,10 @@ You can download a complete working sample from [GitHub](https://github.com/Sync
16081608
Read a PDF document permission flags via the [Security.Permissions](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Security.PdfSecurity.html#Syncfusion_Pdf_Security_PdfSecurity_Permissions) property, which returns a bitwise combination of values from the [PdfPermissionsFlags](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Security.PdfPermissionsFlags.html) enumeration.
16091609

16101610
{% tabs %}
1611-
{% highlight c# tabtitle="C# [Cross-platform]" %}
1611+
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/PDF-permission-viewer/.NET/PDF-permission-viewer/Program.cs" %}
1612+
1613+
using Syncfusion.Pdf.Parsing;
1614+
using Syncfusion.Pdf.Security;
16121615

16131616
// Load an existing PDF
16141617
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf"))
@@ -1633,6 +1636,9 @@ using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf"))
16331636
{% endhighlight %}
16341637
{% highlight c# tabtitle="C# [Windows-specific]" %}
16351638

1639+
using Syncfusion.Pdf.Parsing;
1640+
using Syncfusion.Pdf.Security;
1641+
16361642
// Load an existing PDF
16371643
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf"))
16381644
{
@@ -1656,6 +1662,9 @@ using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf"))
16561662
{% endhighlight %}
16571663
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
16581664

1665+
Imports Syncfusion.Pdf.Parsing
1666+
Imports Syncfusion.Pdf.Security
1667+
16591668
' Load an existing PDF
16601669
Using loadedDocument As New PdfLoadedDocument("Input.pdf")
16611670
' Access the document security settings
@@ -1678,7 +1687,7 @@ End Using
16781687
{% endhighlight %}
16791688
{% endtabs %}
16801689

1681-
You can download a complete working sample from GitHub.
1690+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Security/PDF-permission-viewer/.NET).
16821691

16831692
## Remove password from the user password PDF document
16841693

Document-Processing/PDF/PDF-Library/NET/Working-with-Text-Extraction.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,4 +651,18 @@ You can download a complete working sample from [GitHub](https://github.com/Sync
651651
<td>Finds a text string on a specific page (<code>index</code>), returning rectangles in <code>matchRect</code>.</td>
652652
</tr>
653653
</tbody>
654-
</table>
654+
</table>
655+
656+
## Troubleshooting and FAQ’s
657+
658+
### What is the recommended way to extract form field values from a PDF document?
659+
660+
The [ExtractText](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.PdfPageBase.html#Syncfusion_Pdf_PdfPageBase_ExtractText) API retrieves only the text that is visibly rendered on the page’s graphics layer. It does not extract the values contained in interactive form fields such as text boxes, combo boxes, or buttons. This is because form field data resides in the PDF’s interactive form (AcroForm) structure, separate from the page’s content stream.
661+
662+
To retrieve form field values, you have two recommended options:
663+
664+
1. [Flatten form fields](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/working-with-forms#flattening-form-fields-in-a-pdf): Converts interactive form fields into static page content, embedding their values directly into the PDF’s text stream. After flattening, any text extraction process (such as ExtractText) will include these values.
665+
666+
Refer to the text extraction section of the PDF [UG documentation](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/working-with-text-extraction) for more details.
667+
668+
2. [Iterate through form fields directly](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/working-with-forms#enumerate-the-form-fields): Access each form field in the PDF’s form collection and read its value programmatically. This approach provides the most accurate and structured method for extracting form data.

0 commit comments

Comments
 (0)