コード例 #1
0
        /// <summary>
        /// Example method to draw annotations (eg, links) on a page. Any annotations are outlined in red.
        /// </summary>
        /// <param name="pageNumber">The page number we wish to draw.</param>
        /// <returns>Returns a Bitmap object containing the rendered page with red rectangles signifying the position of each annotation.</returns>
        public static Bitmap GetPageWithAnnotations(int pageNumber)
        {
            Bitmap            page   = pRender.RenderPage(pageNumber, 1);
            Graphics          g      = Graphics.FromImage(page);
            List <Annotation> annots = pRender.GetAnnotations(pageNumber);

            foreach (Annotation a in annots)
            {
                g.DrawRectangle(Pens.Red, new Rectangle((int)Math.Round(a.Rect.X), (int)Math.Round(a.Rect.Y), (int)Math.Round(a.Rect.Width), (int)Math.Round(a.Rect.Height)));
            }
            return(page);
        }