public static void Run() { // Create an instance of Parser class using (Parser parser = new Parser(Constants.HyperlinksPdf)) { // Check if the document supports hyperlink extraction if (!parser.Features.Hyperlinks) { Console.WriteLine("Document isn't supports hyperlink extraction."); return; } // Create the options which are used for hyperlink extraction PageAreaOptions options = new PageAreaOptions(new Rectangle(new Point(380, 90), new Size(150, 50))); // Extract hyperlinks from the document page area IEnumerable <PageHyperlinkArea> hyperlinks = parser.GetHyperlinks(options); // Iterate over hyperlinks foreach (PageHyperlinkArea h in hyperlinks) { // Print the hyperlink text Console.WriteLine(h.Text); // Print the hyperlink URL Console.WriteLine(h.Url); Console.WriteLine(); } } }
public static void Run() { // Create an instance of Parser class using (Parser parser = new Parser(Constants.SampleImagesPdf)) { // Create the options which are used for images extraction PageAreaOptions options = new PageAreaOptions(new Rectangle(new Point(340, 150), new Size(300, 100))); // Extract images from the upper-left corner of a page: IEnumerable <PageImageArea> images = parser.GetImages(options); // Check if images extraction is supported if (images == null) { Console.WriteLine("Page images extraction isn't supported"); return; } // Iterate over images foreach (PageImageArea image in images) { // Print a page index, rectangle and image type: Console.WriteLine(string.Format("Page: {0}, R: {1}, Type: {2}", image.Page.Index, image.Rectangle, image.FileType)); } } }