Last active
September 7, 2016 10:34
-
-
Save webgio/a95806209439b8cd319a32d9b24253f3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public static bool PdfContains(byte[] pdfcontent, string text) | |
{ | |
using (var pdfReader = new PdfReader(pdfcontent)) | |
{ | |
for (int page = 1; page <= pdfReader.NumberOfPages; page++) | |
{ | |
var strategy = new SimpleTextExtractionStrategy(); | |
string currentText = PdfTextExtractor.GetTextFromPage( | |
pdfReader, page, strategy); | |
if (currentText.Contains(text)) | |
return true | |
} | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment