I’d like to place an ImageStamp directly over a form field. I’m able to get the coordinates of the form field rectangle. The coordinates provided by the form field rectangle are: LLX, LLY, URX, URY, Width and Height. However, the ImageStamp object, unfortunately, doesn’t share the same positioning elements. It uses the less desirable XIndent, YIndent, Height and Width. XIndent is from the left and YIndent is from the bottom of the page.
I found that I cannot calculate the proper positioning for the XIndent and YIndent by using the form field rectangle coordinates. The coordinates are close but not exact, which leaves my pdf document looking sloppy. I would assume that they are based upon the same base coordinates but it doesn’t seem that way.
How can I position an ImageStamp directly on top of a form field rectangle, given the rectangle coordinates?
… get the field from AsposePdf.Forms.Field
var rect = field.GetRectangle(false);
int llx = Convert.ToInt32(rect.LLX);
int lly = Convert.ToInt32(rect.LLY);
int urx = Convert.ToInt32(rect.URX);
int ury = Convert.ToInt32(rect.URY);
AsposePdf.ImageStamp imageStamp = new AsposePdf.ImageStamp(memStreamImageOutput);
imageStamp.Background = true;
imageStamp.XIndent = llx;
imageStamp.YIndent = lly;
imageStamp.Height = ury - lly;
imageStamp.Width = urx- llx;
pdfDoc.Pages[1].AddStamp(imageStamp);
The image does not appear over the form field rectangle coordinates. Is the anchor of the imageStamp different from the form field anchor? Are there some sort of different coordinates for the ImageStamp? Can somebody lend a hand here?
thanks,
Rob