C# PDF 解析器

This article was translated from English: Does it need improvement?
Translated
View the article in English

擁有適當的工具,您可以輕鬆地在 C# 中處理 PDF 檔案,並使用所有適用於 .NET 應用程式所需的功能,包括使用 C# 解析 PDF 檔案的能力。 本教程將使用 IronPDF 這個 C# 函式庫,只需幾個簡單的步驟即可完成。

Csharp Parse Pdf1 related to C# PDF 解析器
Csharp Parse Pdf2 related to C# PDF 解析器
Csharp Parse Pdf3 related to C# PDF 解析器

開始使用 IronPDF

立即在您的專案中使用IronPDF,並享受免費試用。

第一步:
green arrow pointer


C# 解析 PDF 檔案

解析 PDF 文件相當容易。 在下面的代碼中,我們使用 ExtractAllText 方法從整個 PDF 文件中提取每一行文本。 稍後您可以看到提取的PDF內容的並排輸出。

:path=/static-assets/pdf/content-code-examples/how-to/csharp-parse-pdf-parse-pdf.cs
using IronPdf;

// Select the desired PDF File
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");

// Extract all text from an pdf
string allText = pdf.ExtractAllText();

// Extract all text from page 1
string page1Text = pdf.ExtractTextFromPage(0);
Imports IronPdf

' Select the desired PDF File
Private pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")

' Extract all text from an pdf
Private allText As String = pdf.ExtractAllText()

' Extract all text from page 1
Private page1Text As String = pdf.ExtractTextFromPage(0)
VB   C#

查看解析的 PDF 內容

我們使用了一個 C# 表單來顯示上述代碼執行中解析的 PDF 內容。 此輸出提供了 PDF 中的確切文字,因此您可以將其用於個人或客戶的文件需求。

~ PDF ~

Csharp Parse Pdf4 related to ~ PDF ~

~ C# 表单 ~

Csharp Parse Pdf5 related to ~ C# 表单 ~

資料庫快速訪問

Documentation related to 資料庫快速訪問

文件資料

閱讀 API 參考文件,以了解 IronPDF 及其所有功能。

文件資料