Last active
October 1, 2020 10:37
-
-
Save juanonsoftware/49002c57fa54448e70216981718936ab to your computer and use it in GitHub Desktop.
C# How to get text from PDF file with iTextSharp
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
// source is a byte array | |
using (var reader = new PdfReader(source)) | |
{ | |
using (var output = new StringWriter()) | |
{ | |
for (int i = 1; i <= reader.NumberOfPages; i++) | |
{ | |
output.WriteLine(PdfTextExtractor.GetTextFromPage(reader, i)); | |
} | |
return output.ToString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment