We need to convert a PDF to a certain dpi raster image (usually
200dpi; using PDFDraw http://www.pdftron.com/pdfnet/samplecode.html#PDFDraw),
and then find the hyperlinks on that image. With PDFNet Annotation API
we get the hyperlink objects and their bounding boxes.
How can we quickly go from the positions of the bounding box in the
original document's coordinate system to the "pixels" in the final
Can you suggest API calls or general approach?
A: You would need to transform the coordinates from PDF user space to
You could use the code along the following lines:
// In C# (other languages are the same apart from minor syntax
Matrix2D mtx = new Matrix2D(dpi/72.0, 0, 0, dpi/72.0, 0, 0);
mtx = mtx * page.GetDefaultMatrix();
Rect r = annot.GetRect();
mtx.Mult(ref r.x1, ref y.x1);
mtx.Mult(ref r.x2, ref y.x2);
... r is now in the pixel space…