The following code sample shows how to handle loading of HTML external resources.
// Create an instance of ParserSettings to pass External Resource HandlerParserSettingssettings=newParserSettings(newHandler());// Create an instance of Parser class to generate spreadsheet page previewsusing(Parserparser=newParser(Constants.SampleHtmlWithImages,settings)){// Extract images from HTML documentIEnumerable<PageImageArea>images=parser.GetImages();// Iterate over extracted imagesforeach(PageImageAreaiinimages){// Print the type of imageConsole.WriteLine(i.FileType);}}/// <summary>/// This class provides the ability to filter extracted images./// </summary>privateclassHandler:ExternalResourceHandler{/// <summary>/// Called before any external resource loads. It allows to skip unnesesary file loading./// </summary>publicoverridevoidOnLoading(ExternalResourceLoadingArgsargs){// Check if the file name ends with installation.pngif(!args.Uri.EndsWith("installation.png")){// Otherwise skip this fileargs.Skipped=true;}base.OnLoading(args);}}
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples:
Along with full featured .NET library we provide simple, but powerful free Apps.
You are welcome to parse documents and extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.