PDFからテキストを抽出 - Facades
Contents
[
Hide
]
ドキュメントのすべてのページからテキストを抽出する
PDFドキュメントのすべてのページからテキストを抽出するために、**Aspose.PDF for C++**はFacades名前空間の下でPdfExtractorクラスを提供します。PDFドキュメントからすべてのテキストを抽出して、MemoryStreamオブジェクトに保存し、文字列として取得することができます。これは、さらなる操作に使用したい場合に便利です。次のコードスニペットは、PDFドキュメントのすべてのページからテキストを抽出するためにPdfExtractorクラスを使用する方法を示します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-C | |
auto extractor = MakeObject<Facades::PdfExtractor>(); | |
extractor->BindPdf(L"..\\Data\\Text\\input.pdf"); | |
extractor->ExtractText(); | |
auto memStream = MakeObject<IO::MemoryStream>(); | |
extractor->GetText(memStream); | |
auto unicode = System::Text::Encoding::get_Unicode(); | |
String allText = unicode->GetString(memStream->ToArray()); | |
Console::WriteLine(allText); |