public static void RenderAnnotations(Image image, PDFDocument pdf_document, int page, PDFAnnotation specific_pdf_annotation) { int TRANSPARENCY = (int)Math.Round(ConfigurationManager.Instance.ConfigurationRecord.GUI_AnnotationPrintTransparency * 255); using (Graphics graphics = Graphics.FromImage(image)) { foreach (PDFAnnotation pdf_annotation in pdf_document.GetAnnotations()) { if (pdf_annotation.Deleted) { continue; } // Must be same page if (pdf_annotation.Page != page) { continue; } // If they want specifics, must be same annotation if (null != specific_pdf_annotation && pdf_annotation != specific_pdf_annotation) { continue; } // If we get here, do it! using (Brush highlight_pen = new SolidBrush(Color.FromArgb(TRANSPARENCY, ColorTools.ConvertWindowsToDrawingColor(pdf_annotation.Color)))) { graphics.FillRectangle(highlight_pen, (float)(pdf_annotation.Left * image.Width), (float)(pdf_annotation.Top * image.Height), (float)(pdf_annotation.Width * image.Width), (float)(pdf_annotation.Height * image.Height)); } } } }