Hi guys!
I'm enjoying using PDF sharp but now I'm struggling with working with images.
On the PDF there is an Acroform field named "imgsignature". I want to get its coordinates and put an image over it.
My code works as expected except for the Y-coordinate which is always wrong (the image is higher up on the PDF than expected).
Here is the code:
Code:
PdfPage page = pdf.Pages[0];
XGraphics gfx = XGraphics.FromPdfPage(page, XPageDirection.Downwards);
PdfTextField imageField = (PdfTextField)pdf.AcroForm.Fields["imgsignature"];
var fieldRect = imageField.Elements.GetValue("/Rect") as PdfRectangle;
XRect rect = new XRect(fieldRect.X1, fieldRect.Y1, fieldRect.Width, fieldRect.Height);
gfx.DrawImage(XImage.FromFile("pdf_overlay.jpg"), rect);
I've attached an image of the result that I am currently getting.
Any advice would be appreciated!
Using PDFsharp-MigraDoc-gdi-1.51.5186-beta