mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-04-05 20:55:01 +08:00
23 lines
565 B
C#
23 lines
565 B
C#
![]() |
namespace UglyToad.Examples
|
|||
|
{
|
|||
|
using System;
|
|||
|
using PdfPig;
|
|||
|
using PdfPig.DocumentLayoutAnalysis.TextExtractor;
|
|||
|
|
|||
|
internal static class ExtractTextWithNewlines
|
|||
|
{
|
|||
|
public static void Run(string filePath)
|
|||
|
{
|
|||
|
using (var document = PdfDocument.Open(filePath))
|
|||
|
{
|
|||
|
foreach (var page in document.GetPages())
|
|||
|
{
|
|||
|
var text = ContentOrderTextExtractor.GetText(page, true);
|
|||
|
|
|||
|
Console.WriteLine(text);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|