mirror of
				https://github.com/UglyToad/PdfPig.git
				synced 2025-10-31 08:27:06 +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);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 | 
