问题
I need to simultaneously stamp both a string (details of the user) and an image containing an actual signature in a pdfDocument. The string and image are successfully stamped on the document, however, the image of the actual signature is being stretched to fit the rectangle of the whole signature. how do i fix this and manipulate the size and position of the image?
I used both Layer2Text and Image function in one stamper declaration. Can anyone help me? Thanks in advance
回答1:
Instead of merely setting the Layer2Text and Image and letting iTextSharp arrange everything, you can create the signature appearance all by yourself on the PdfTemplate returned by GetLayer(2).
If you need some inspiration on how to fill that layer, you can look at the PdfSignatureAppearance.cs method GetAppearance(), more exactly the section between
if (app[2] == null) {
and
}
if (app[3] == null && !acro6Layers) {
This is where iTextSharp creates the default appearance on the PdfTemplate t. Your code may vary only slightly.
来源:https://stackoverflow.com/questions/29842699/how-to-manipulate-size-and-position-of-image-inside-a-digital-signature-rectangl