Skip to content

Commit 5fd44ac

Browse files
committed
add kb for text extracting from pdf
1 parent 3a8a11f commit 5fd44ac

File tree

4 files changed

+60
-8
lines changed

4 files changed

+60
-8
lines changed

introduction.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ table th:first-of-type {
2828

2929
Telerik Document Processing features the following libraries:
3030

31-
|Library|Description||
32-
|----|----|----|
33-
| [RadPdfProcessing]({%slug radpdfprocessing-overview%})|A processing library that allows you to create, import, and export PDF documents from your code. You can use it in any web or desktop .NET application without relying on third-party software like Adobe Acrobat.|![Pdf](images/dpl-pdf.png)|
34-
|[RadSpreadProcessing]({%slug radspreadprocessing-overview%})|A powerful library that enables you to create applications with native support for spreadsheet documents. With RadSpreadProcessing, you can create spreadsheets from scratch, modify existing documents or convert between the most common spreadsheet formats. You can save the generated workbook to a local file, stream, or stream it to the client browser.|![Spread](images/dpl-spread.png)|
35-
|[RadSpreadStreamProcessing]({%slug radspreadstreamprocessing-overview%})|Spread streaming is a document processing paradigm that allows you to create or read big spreadsheet documents with great performance and minimal memory footprint. The key for the memory efficiency is that the spread streaming library writes the spreadsheet content directly to a stream without creating and preserving the spreadsheet document model in memory.|![SpreadStream](images/dpl-spread.png)|
36-
|[RadWordsProcessing]({%slug radwordsprocessing-overview%})|A processing library that allows you to create, modify and export documents to a variety of formats. Through the API, you can access each element in the document and modify, remove it or add a new one. The generated content you can save as a stream, as a file, or sent it to the client browser.|![Words](images/dpl-words.png)|
37-
|[RadZipLibrary]({%slug radziplibrary-overview%})| It allows you to compress and combine files in ZIP archives, browse and extract files from existing ZIP archives and compress streams for easy file shipping and reduced storage space.|![Zip](images/dpl-zip.png)|
31+
|Library|Description|
32+
|----|----|
33+
| [RadPdfProcessing]({%slug radpdfprocessing-overview%}) ![Pdf](images/dpl-pdf.png)|A processing library that allows you to create, import, and export PDF documents from your code. You can use it in any web or desktop .NET application without relying on third-party software like Adobe Acrobat.|
34+
|[RadSpreadProcessing]({%slug radspreadprocessing-overview%}) ![Spread](images/dpl-spread.png)|A powerful library that enables you to create applications with native support for spreadsheet documents. With RadSpreadProcessing, you can create spreadsheets from scratch, modify existing documents or convert between the most common spreadsheet formats. You can save the generated workbook to a local file, stream, or stream it to the client browser.|
35+
|[RadSpreadStreamProcessing]({%slug radspreadstreamprocessing-overview%}) ![SpreadStream](images/dpl-spread.png)|Spread streaming is a document processing paradigm that allows you to create or read big spreadsheet documents with great performance and minimal memory footprint. The key for the memory efficiency is that the spread streaming library writes the spreadsheet content directly to a stream without creating and preserving the spreadsheet document model in memory.|
36+
|[RadWordsProcessing]({%slug radwordsprocessing-overview%}) ![Words](images/dpl-words.png)|A processing library that allows you to create, modify and export documents to a variety of formats. Through the API, you can access each element in the document and modify, remove it or add a new one. The generated content you can save as a stream, as a file, or sent it to the client browser.|
37+
|[RadZipLibrary]({%slug radziplibrary-overview%}) ![Zip](images/dpl-zip.png)| It allows you to compress and combine files in ZIP archives, browse and extract files from existing ZIP archives and compress streams for easy file shipping and reduced storage space.|
3838

3939
## Key Features
4040

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Extracting Text from PDF Documents
3+
description: Learn how to extract the text from a PDF document using RadPdfProcessing from the Telerik Document Processing libraries.
4+
type: how-to
5+
page_title: How to Extract the Text from PDF documents
6+
slug: extract-text-from-pdf
7+
tags: pdf, document, processing, text, extract, content
8+
res_type: kb
9+
ticketid: 1657503
10+
---
11+
12+
## Environment
13+
14+
| Version | Product | Author |
15+
| ---- | ---- | ---- |
16+
| 2025.1.128| RadPdfProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)|
17+
18+
## Description
19+
20+
Learn how to extract the text content in a PDF document.
21+
22+
## Solution
23+
24+
Follow the steps:
25+
26+
1\. Import the PDF document using the [PdfFormatProvider]({%slug radpdfprocessing-formats-and-conversion-pdf-pdfformatprovider%}).
27+
28+
2\. Export the RadFixedDocument's content to text using the [TextFormatProvider]({%slug radpdfprocessing-formats-and-conversion-plain-text-textformatprovider%}). Thus, if the PDF document contains text fragments, it will be exported to the plain text result.
29+
30+
```csharp
31+
string filePath = "input.pdf";
32+
PdfFormatProvider pdf_provider = new PdfFormatProvider();
33+
RadFixedDocument fixed_document;
34+
using (Stream stream = File.OpenRead(filePath))
35+
{
36+
fixed_document = pdf_provider.Import(stream);
37+
}
38+
Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider provider = new Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider();
39+
40+
string documentContent = provider.Export(fixed_document);
41+
Debug.WriteLine(documentContent);
42+
```
43+
>important However, depending on the internal document's content, the **TextFormatProvider** may not be applicable for covering all the cases. A common scenario is a document with scanned images which contain text information. In this case, the above approach wouldn't parse the content to plain text because all the text inside is actually not text but [Path]({%slug radpdfprocessing-model-path%}) elements. Here comes the benefit of using the [OcrFormatProvider]({%slug radpdfprocessing-formats-and-conversion-ocr-ocrformatprovider%}) allowing you to convert images of typed, handwritten, or printed text into machine-encoded text from a scanned document.
44+
45+
## See Also
46+
47+
- [RadPdfProcessing]({%slug radpdfprocessing-overview%})
48+
- [OcrFormatProvider]({%slug radpdfprocessing-formats-and-conversion-ocr-ocrformatprovider%})
49+
- [TextFormatProvider]({%slug radpdfprocessing-formats-and-conversion-plain-text-textformatprovider%})
50+

libraries/radpdfprocessing/formats-and-conversion/ocr/ocrformatprovider.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ position: 1
1212

1313
Since _Q1 2025_ the __RadPdfProcessing__ library supports Optical Character Recognition (OCR). OCR is the electronic or mechanical conversion of images of typed, handwritten, or printed text into machine-encoded text from a scanned document. The library uses the **OcrFormatProvider** class that allows you to import an image which is returned as a [RadFixedPage]({%slug radpdfprocessing-model-radfixedpage%}). By default, the **OcrFormatProvider** takes as a parameter a **TesseractOcrProvider** implementation which is achieved by using the third-party library [Tesseract](https://github.com/tesseract-ocr/tesseract), however you can provide any [custom implementation]({%slug radpdfprocessing-formats-and-conversion-ocr-custom-ocrprovider%}) instead.
1414

15-
You can find all the dependencies and required steps for the implementation in the [Prerequisites]({%slug radpdfprocessing-formats-and-conversion-ocr-prerequisites%}) artilce.
15+
You can find all the dependencies and required steps for the implementation in the [Prerequisites]({%slug radpdfprocessing-formats-and-conversion-ocr-prerequisites%}) article.
1616

1717
## TesseractOcrProvider Public API
1818

@@ -35,3 +35,4 @@ You can find all the dependencies and required steps for the implementation in t
3535
* [Prerequisites]({%slug radpdfprocessing-formats-and-conversion-ocr-prerequisites%})
3636
* [Timeout Mechanism]({%slug timeout-mechanism-in-dpl%})
3737
* [Implementing a Custom OCR Provider]({%slug radpdfprocessing-formats-and-conversion-ocr-custom-ocrprovider%})
38+
* [Extracting Text from PDF Documents]({%slug extract-text-from-pdf%})

libraries/radpdfprocessing/formats-and-conversion/plain-text/textformatprovider.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ __Example 1__ shows how to use __TextFormatProvider__ to export __RadFixedDocume
4141
* [Plain text]({%slug radpdfprocessing-formats-and-conversion-plain-text-text%})
4242
* [TextFormatProvider Settings]({%slug radpdfprocessing-formats-and-conversion-plain-text-settings%})
4343
* [Timeout Mechanism]({%slug timeout-mechanism-in-dpl%})
44+
* [Extracting Text from PDF Documents]({%slug extract-text-from-pdf%})

0 commit comments

Comments
 (0)