Skip to content

Instantly share code, notes, and snippets.

@juanonsoftware
Last active October 1, 2020 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanonsoftware/49002c57fa54448e70216981718936ab to your computer and use it in GitHub Desktop.
Save juanonsoftware/49002c57fa54448e70216981718936ab to your computer and use it in GitHub Desktop.
C# How to get text from PDF file with iTextSharp
// 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