How do I use PDFDraw to rasterize a single annotation?


How can I convert a single annotation to an image?


To rasterize only one section of a page, you can reduce the crop box to the area you want (as shown in Example 5 of For an annotation, you can grab its bounding box by calling GetRect(), then converting its coordinates from user coordinate space (which is what annotations are in) to page coordinate space (as shown in

The resulting code would look something like the following:

Rect box = stamp_annot.GetRect();
Matrix2D m = first_page.GetDefaultMatrix();

double x1=box.x1, y1=box.y1;
m.Mult(ref x1, ref y1);

double x2=box.x2, y2=box.y2;
m.Mult(ref x2, ref y2);

first_page.SetCropBox(new Rect(x1, y1, x2, y2));