public static Dictionary <string, int> PageContainsImages(PdfReader reader, int pageNumber) { var listener = new ImageCheckListener(); var parser = new PdfReaderContentParser(reader); parser.ProcessContent(pageNumber, listener); return(listener.Images); }
/// <summary>Checks whether a specified page of a PDF file contains images.</summary> /// <returns>True if the page contains at least one image; false otherwise.</returns> public static Dictionary <string, int> PageContainsImages(string filename, int pageNumber) { using (var reader = new PdfReader(filename)) { var parser = new PdfReaderContentParser(reader); ImageCheckListener listener = null; parser.ProcessContent(pageNumber, (listener = new ImageCheckListener())); return(listener.Images); } }