- 概要
- Document Processing Contracts
- リリース ノート
- Document Processing Contracts について
- Box クラス
- IPersistedActivity インターフェイス
- PrettyBoxConverter クラス
- IClassifierActivity インターフェイス
- IClassifierCapabilitiesProvider インターフェイス
- ClassifierDocumentType クラス
- ClassifierResult クラス
- ClassifierCodeActivity クラス
- ClassifierNativeActivity クラス
- ClassifierAsyncCodeActivity クラス
- ClassifierDocumentTypeCapability クラス
- ContentValidationData クラス
- EvaluatedBusinessRulesForFieldValue クラス
- EvaluatedBusinessRuleDetails クラス
- ExtractorAsyncCodeActivity クラス
- ExtractorCodeActivity クラス
- ExtractorDocumentType クラス
- ExtractorDocumentTypeCapabilities クラス
- ExtractorFieldCapability クラス
- ExtractorNativeActivity クラス
- ExtractorResult クラス
- FieldValue クラス
- FieldValueResult クラス
- ICapabilitiesProvider インターフェイス
- IExtractorActivity インターフェイス
- ExtractorPayload クラス
- DocumentActionPriority 列挙型
- DocumentActionData クラス
- DocumentActionStatus 列挙型
- DocumentActionType 列挙型
- DocumentClassificationActionData クラス
- DocumentValidationActionData クラス
- UserData クラス
- Document クラス
- DocumentSplittingResult クラス
- DomExtensions クラス
- Page クラス
- PageSection クラス
- Polygon クラス
- PolygonConverter クラス
- Metadata クラス
- WordGroup クラス
- Word クラス
- ProcessingSource 列挙型
- ResultsTableCell クラス
- ResultsTableValue クラス
- ResultsTableColumnInfo クラス
- ResultsTable クラス
- Rotation 列挙型
- ルール クラス
- RuleResult クラス
- RuleSet クラス
- RuleSetResult クラス
- SectionType 列挙型
- WordGroupType 列挙型
- IDocumentTextProjection インターフェイス
- ClassificationResult クラス
- ExtractionResult クラス
- ResultsDocument クラス
- ResultsDocumentBounds クラス
- ResultsDataPoint クラス
- ResultsValue クラス
- ResultsContentReference クラス
- ResultsValueTokens クラス
- ResultsDerivedField クラス
- ResultsDataSource 列挙型
- ResultConstants クラス
- SimpleFieldValue クラス
- TableFieldValue クラス
- DocumentGroup クラス
- DocumentTaxonomy クラス
- DocumentType クラス
- Field クラス
- FieldType 列挙型
- FieldValueDetails クラス
- LanguageInfo クラス
- MetadataEntry クラス
- TextType 列挙型
- TypeField クラス
- ITrackingActivity インターフェイス
- ITrainableActivity インターフェイス
- ITrainableClassifierActivity インターフェイス
- ITrainableExtractorActivity インターフェイス
- TrainableClassifierAsyncCodeActivity クラス
- TrainableClassifierCodeActivity クラス
- TrainableClassifierNativeActivity クラス
- TrainableExtractorAsyncCodeActivity クラス
- TrainableExtractorCodeActivity クラス
- TrainableExtractorNativeActivity クラス
- BasicDataPoint クラス - プレビュー
- ExtractionResultHandler クラス - プレビュー
- Document Understanding ML
- Document Understanding OCR ローカル サーバー
- Document Understanding
- IntelligentOCR
- リリース ノート
- IntelligentOCR アクティビティ パッケージについて
- プロジェクトの対応 OS
- タクソノミーを読み込み
- ドキュメントをデジタル化
- ドキュメント分類スコープ
- キーワード ベースの分類器
- Document Understanding プロジェクト分類器
- インテリジェント キーワード分類器
- ドキュメント分類アクションを作成
- ドキュメント検証成果物を作成
- ドキュメント検証成果物を取得
- ドキュメント分類アクション完了まで待機し再開
- 分類器トレーニング スコープ
- キーワード ベースの分類器トレーナー
- インテリジェント キーワード分類器トレーナー
- データ抽出スコープ
- Document Understanding プロジェクト抽出器
- Document Understanding プロジェクト抽出器トレーナー
- 正規表現ベースの抽出器
- フォーム抽出器
- インテリジェント フォーム抽出器
- ドキュメントを墨消し
- ドキュメント検証アクションを作成
- ドキュメント検証アクション完了まで待機し再開
- 抽出器トレーニング スコープ
- 抽出結果をエクスポート
- マシン ラーニング抽出器
- マシン ラーニング抽出器トレーナー
- マシン ラーニング分類器
- マシン ラーニング分類器トレーナー
- 生成 AI 分類器
- 生成 AI 抽出器
- 認証を構成する
- ML サービス
- OCR
- OCR Contracts
- リリース ノート
- OCR コントラクトについて
- プロジェクトの対応 OS
- IOCRActivity インターフェイス
- OCRAsyncCodeActivity クラス
- OCRCodeActivity クラス
- OCRNativeActivity クラス
- Character クラス
- OCRResult クラス
- Word クラス
- FontStyles 列挙型
- OCRRotation 列挙型
- OCRCapabilities クラス
- OCRScrapeBase クラス
- OCRScrapeFactory クラス
- ScrapeControlBase クラス
- ScrapeEngineUsages 列挙型
- ScrapeEngineBase
- ScrapeEngineFactory クラス
- ScrapeEngineProvider クラス
- OmniPage
- PDF
- [リストから削除済] ABBYY
- [リストから削除済] ABBYY Embedded

Document Understanding アクティビティ
PDF ファイルを読み込み
ドキュメントに含まれるすべての文字を読み取ることのできるアクティビティを使用して、.pdf ファイルの内容を読み取り、個別に抽出できます。
必要に応じて、文字を認識できるシンプルなアクティビティを使用することも、OCR エンジンを持つアクティビティを使用することもできます。OCR エンジンを使用する利点は、スキャンしたドキュメント、署名のあるドキュメント、あるいは手書きのドキュメントであっても、ドキュメントの読み取りを適用できることです。
以下の例は、.pdf ファイルを読み取る 2 つの状況を示しています。
- The first one explains how to read the
.pdffile while using the Read PDF Text activity. - The second one explains how to read the
.pdffile while using the Read PDF With OCR activity. The main difference between the two scenarios is that the second one is also using OCR engines, meaning that the details of extracted information are more accurate than in the first case if the analyzed file is an image, scanned, or includes signed or handwritten fields. You can find both activities in the UiPath.PDF.Activities package.
両方のシナリオに必要なワークフローは 1 つだけであり、任意の読み取り方法の選択をユーザーに求める時点までは共通です。
手順
- Studio を開いて、新しいプロセスを作成します。
- Add a Flowchart container in the Workflow Designer.
- Create a variable named
chooseOption, with the GenericValue type, and no default value.注:同じ場所からプロセス全体を実行できるようにするか、指定されたファイルを使用するためにこの例をダウンロードするには、プロジェクト ディレクトリに
.pdfファイルを追加します。
- Create a variable named
- Add an Input Dialog activity and connect it to the Start Node.
- [プロパティ] パネルで、式
"Choose one option below:"を [ラベル] フィールドに追加します。 - [Options] フィールドに式
{"Read PDF Text", "Read PDF With OCR"}を追加します。 - [Title] フィールドに値
"Options"を追加します。 - Result (値) フィールドに変数
chooseOptionを追加します。
- [プロパティ] パネルで、式
- Add a Flow Decision activity after the Input Dialog activity and connect it to it.
- [プロパティ] パネルで [Condition] フィールドに式
chooseOption = "Read PDF Text"を追加します。
- [プロパティ] パネルで [Condition] フィールドに式
- Add a Sequence container and connect it to the True branch of the Flow Decision activity. The name of the Sequence should be Read PDF Text. This activity extracts information by using regular expressions.
-
次の表に示す変数を作成します。
Table 1. Variables to be created
変数の型 既定値 extractedText文字列 N/A arrayTextSystem.String[] N/A addressGenericValue N/A city文字列 N/A phoneNumber文字列 N/A invoiceNumber文字列 N/A vendorGenericValue N/A bankName文字列 N/A bankAccount文字列 N/A ibanCode文字列 N/A
-
- Add a Sequence container and connect it to the False branch of the Flow Decision activity. The name of the Sequence should be Read PDF With OCR. This activity extracts information by using an OCR engine (Microsoft OCR and Tesseract OCR).
-
次の表に示す変数を作成します。
Table 2. Variables to be created
変数の型 既定値 extractedTextTesseract文字列 N/A extractedTextMicrosoft文字列 N/A Figure 1. Overview of the beginning of the workflow

-
- Read a PDF File using the Read PDF Text activity:
- Open the Read PDF Text sequence container by double-selecting it.
- Add a Read PDF Text activity inside the sequence.
- [プロパティ] パネルで [FileName] フィールドに値
"NPO Invoice.pdf"を追加します。 - [Range] フィールドに値
"All"を追加します。 - [テキスト] フィールドに変数
extractedTextを追加します。
- [プロパティ] パネルで [FileName] フィールドに値
- Add an Assign activity after the Read PDF Text activity.
- [左辺値 (To)/宛先] フィールドに変数
arrayTextを追加します。 - [右辺値 (Value)] フィールドに式
extractedText.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- [代入] アクティビティの下に [条件分岐 (if)] アクティビティを追加します。
- [条件 (Condition)] フィールドに式
arrayText(0).Equals("Tiefland Glass AG")を追加します。
- [条件 (Condition)] フィールドに式
- [シーケンス] コンテナー内に [代入] アクティビティを追加します。
- [左辺値 (To)/宛先] フィールドに変数
addressを追加します。 - [右辺値 (Value)] フィールドに式
arrayText(2)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add another Assign activity and place it after the previous one.
- [左辺値 (To)/宛先] フィールドに変数
cityを追加します。 - [右辺値 (Value)] フィールドに式
arrayText(3).Split(","c)(0)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add another Assign activity and place it after the previous one.
- [左辺値 (To)/宛先] フィールドに変数
phoneNumberを追加します。 - [右辺値 (Value)] フィールドに式
arrayText(4).Split(":"c)(1).Split({"INVOICE"},StringSplitOptions.None)(0)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add another Assign activity and place it after the previous one.
- [左辺値 (To)/宛先] フィールドに変数
invoiceNumberを追加します。 - [右辺値 (Value)] フィールドに式
arrayText(4).Split(":"c)(1).Split({"INVOICE"},StringSplitOptions.None)(1).Split("#"c)(1)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add another Assign activity and place it after the previous one.
- [左辺値 (To)/宛先] フィールドに変数
vendorを追加します。 - [右辺値 (Value)] フィールドに式
arrayText(arrayText.Count-5)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add an Assign activity inside the Else field.
- [左辺値 (To)/宛先] フィールドに変数
addressを追加します。 - [右辺値 (Value)] フィールドに式
arrayText(1)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add another Assign activity and place it after the previous one.
- [左辺値 (To)/宛先] フィールドに変数
cityを追加します。 - [右辺値 (Value)] フィールドに式
arrayText(2).Split(","c)(0)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add another Assign activity and place it after the previous one.
- [左辺値 (To)/宛先] フィールドに変数
phoneNumberを追加します。 - [右辺値 (Value)] フィールドに式
arrayText(3).Split(":"c)(1).Split({"INVOICE"},StringSplitOptions.None)(0)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add another Assign activity and place it after the previous one.
- [左辺値 (To)/宛先] フィールドに変数
invoiceNumberを追加します。 - [右辺値 (Value)] フィールドに式
arrayText(3).Split(":"c)(1).Split({"INVOICE"},StringSplitOptions.None)(1).Split("#"c)(1)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add another Assign activity and place it after the previous one.
-
[左辺値 (To)/宛先] フィールドに変数
vendorを追加します。 -
[右辺値 (Value)] フィールドに式
arrayText(arrayText.Count-5)を追加します。Figure 2. Overview of the sequence containing the Assign activities
![[代入] アクティビティを含むシーケンスの概要](https://dev-assets.cms.uipath.com/assets/images/activities/document-understanding-overview-of-the-sequence-containing-the-assign-activities-187494-17b91efc-d7673566.webp)
-
- Place a For Each activity after the If container.
- Values (値) フィールドに変数
arrayTextを追加します。
- Values (値) フィールドに変数
- Add an If activity inside the Body container of the For Each activity.
- [条件 (Condition)] フィールドに式
item.Contains("Bank Name:")を追加します。
- [条件 (Condition)] フィールドに式
- Add an Assign activity inside the Then field.
- [左辺値 (To)/宛先] フィールドに変数
bankNameを追加します。 - [右辺値 (Value)] フィールドに式
item.Split(":"c)(1)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add an If activity after the previous one.
- [条件 (Condition)] フィールドに式
item.Contains("Bank Account:")を追加します。
- [条件 (Condition)] フィールドに式
- Add an Assign activity inside the Then field.
- [左辺値 (To)/宛先] フィールドに変数
bankNameを追加します。 - [右辺値 (Value)] フィールドに式
item.Split(":"c)(1)を追加します。
- [左辺値 (To)/宛先] フィールドに変数
- Add an If activity after the previous one.
- [条件 (Condition)] フィールドに式
item.contains("IBAN Code:")を追加します。
- [条件 (Condition)] フィールドに式
- Add an Assign activity inside the Then field.
-
[左辺値 (To)/宛先] フィールドに変数
ibanCodeを追加します。 -
[右辺値 (Value)] フィールドに式
item.Split(":"c)(1)を追加します。Figure 3. Overview of the For Each activity
![[繰り返し (コレクションの各要素)] アクティビティの概要](https://dev-assets.cms.uipath.com/assets/images/activities/document-understanding-overview-of-the-for-each-activity-185318-afaa721e-f6218e6e.webp)
-
- Return to the Read PDF Text sequence and add a Write Text File activity below the For Each activity.
-
FileName フィールドに値
"InvoiceDetails.txt"を追加します。 -
[テキスト] フィールドに
"Invoice details"+Environment.NewLine+Environment.NewLine+"Vendor: "+vendor+Environment.NewLine+"Vendor address: "+address+Environment.NewLine+"City: "+city+Environment.NewLine+"Phone number:"+phoneNumber+Environment.NewLine+"Invoice number:"+invoiceNumber+Environment.NewLine+"Bank name:"+bankName+Environment.NewLine+"Bank account:"+bankAccount+Environment.NewLine+"IBAN Code:"+ibanCodeを追加します。Figure 4. Overview of the For Each container
![[繰り返し (コレクションの各要素)] コンテナーの概要](https://dev-assets.cms.uipath.com/assets/images/activities/document-understanding-overview-of-the-for-each-container-181324-6d05b3dc-9a540b9e.webp)
-
- [Main] ワークフローの作業領域に戻ります。
- Read a PDF File using the Read PDF with OCR activity.
- Open the Read PDF With OCR sequence container.
- シーケンス内に [OCR で PDF を読み込み] アクティビティをドラッグします。
- FileName フィールドに値
"Invoice02.pdf"を追加します。 - [プロパティ] パネルで [並列度] フィールドに値
1を追加します。
- FileName フィールドに値
- [OCR で PDF を読み込み] アクティビティ内に Google OCR エンジンをドラッグします。
- [プロパティ] パネルの [テキスト] フィールドに変数
extractedTextTesseractを追加します。
- [プロパティ] パネルの [テキスト] フィールドに変数
- Drag another Read PDF With OCR activity and place it after the previous one.
- FileName フィールドに値
"Invoice02.pdf"を追加します。 - [プロパティ] パネルで [並列度] フィールドに値
1を追加します。
- FileName フィールドに値
- [OCR で PDF を読み込み] アクティビティ内に Microsoft OCR エンジンをドラッグします。
- [プロパティ] パネルの [テキスト] フィールドに変数
extractedTextMicrosoftを追加します。
- [プロパティ] パネルの [テキスト] フィールドに変数
- [OCR で PDF を読み込み] アクティビティの下に [テキスト ファイルに書き込み] アクティビティをドラッグします。
- FileName フィールドに値
"OCRMicrosoft.txt"を追加します。 - [テキスト] フィールドに変数
extractedTextMicrosoftを追加します。
- FileName フィールドに値
- 前の Write Text File アクティビティの下に Write Text File アクティビティをドラッグします。
-
FileName フィールドに値
"OCRTesseract.txt"を追加します。 -
[テキスト] フィールドに変数
extractedTextTesseractを追加します。Figure 5. Overview of the Read PDF with OCR activity
![[OCR で PDF を読み込み] アクティビティの概要](https://dev-assets.cms.uipath.com/assets/images/activities/document-understanding-overview-of-the-read-pdf-with-ocr-activity-183445-40db9ce8-7a40c813.webp)
-
- プロセスを実行します。ロボットは、指定されたプロセスを使用してデータを抽出し、出力を
.txtファイルに保存します。
Visit the following link to download the example as a ZIP format: Example.