internal static List <PDFAnnotation> GenerateAnnotations(PDFDocument pdf_document, int page, PDFInkList ink_list) { List <RegionOfInterest> regions = new List <RegionOfInterest>(); // Collect all the highlights on this page StrokeCollection stroke_collection = ink_list.GetInkStrokeCollection(page); if (null != stroke_collection) { foreach (Stroke stroke in stroke_collection) { double SCALE = 1000.0; Rect bound = stroke.GetBounds(); bound.X /= SCALE; bound.Y /= SCALE; bound.Width /= SCALE; bound.Height /= SCALE; regions.Add(new RegionOfInterest(bound.Left, bound.Top, bound.Width, bound.Height)); } } RegionOfInterest.AggregateRegions(regions); // Build a list of annotations List <PDFAnnotation> annotations = RegionOfInterest.ConvertRegionsToPDFAnnotations(regions, INKS_TAG, pdf_document, page); return(annotations); }
internal static List <PDFAnnotation> GenerateAnnotations(PDFDocument pdf_document, int page, PDFHightlightList highlight_list) { List <RegionOfInterest> regions = new List <RegionOfInterest>(); // Collect all the highlights on this page foreach (var highlight in highlight_list.GetHighlightsForPage(page)) { if (page == highlight.Page && 0 != highlight.Width) { regions.Add(new RegionOfInterest(highlight.Left, highlight.Top, highlight.Width, highlight.Height)); } } RegionOfInterest.AggregateRegions(regions); // Build a list of annotations List <PDFAnnotation> annotations = RegionOfInterest.ConvertRegionsToPDFAnnotations(regions, HIGHLIGHTS_TAG, pdf_document, page); return(annotations); }