C# で PDF を読み込む手順

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

今日は、PDFコンテンツを読み取り、元の形式でテキストを抽出するための簡単な方法について説明します。 これは、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ファイルを読む

このC#ライブラリを使用すると、PDFファイルを読み取り、コンテンツを抽出し、さらに高品質でオリジナルの画像を抽出することができます。 以下の例を参照して、.NET環境でPDF閲覧のニーズを満たすためにさまざまな関数を使用する方法をご確認ください。

:path=/static-assets/pdf/content-code-examples/how-to/csharp-read-pdf-read-pdf.cs
using IronPdf;
using IronSoftware.Drawing;
using System.Collections.Generic;

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

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

// Get all Images
IEnumerable<AnyBitmap> AllImages = pdf.ExtractAllImages();

// Else combine above both functionality using PageCount
for (var index = 0; index < pdf.PageCount; index++)
{
    string Text = pdf.ExtractTextFromPage(index);
    IEnumerable<AnyBitmap> Images = pdf.ExtractImagesFromPage(index);
}
Imports IronPdf
Imports IronSoftware.Drawing
Imports System.Collections.Generic

' 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()

' Get all Images
Private AllImages As IEnumerable(Of AnyBitmap) = pdf.ExtractAllImages()

' Else combine above both functionality using PageCount
For index = 0 To pdf.PageCount - 1
	Dim Text As String = pdf.ExtractTextFromPage(index)
	Dim Images As IEnumerable(Of AnyBitmap) = pdf.ExtractImagesFromPage(index)
Next index
VB   C#

出力

C#フォームを使用してPDFコンテンツの読み取り結果を完璧に表示する方法を示しました。 このアプローチでは、できるだけ少ないコードでプロジェクトのニーズを達成するというシンプルさが重要です。

~ PDF ~

~ C# フォーム ~


ライブラリ クイック アクセス

Documentation related to ライブラリ クイック アクセス

ライブラリドキュメント

IronPDF ライブラリのドキュメントは、調査および共有に便利な API リファレンスで利用できます。

IronPDF APIリファレンスドキュメント