使用iTextSharp时,如何将垂直对齐设置为PDF字段的中心? 我已经在Acrobat中将字段设置为垂直对齐中心,但是当我将应用程序中的文本写入PDF时,它会对齐顶部。如果我在Acrobat中取消选中多行框,则文本将对齐到中心,但不适用于多行。这是我的代码:
var reader = new PdfReader(Server.MapPath("PDFs/SuperiorSubShell1.pdf"));
var output = new MemoryStream();
var stamper = new PdfStamper(reader, output);
stamper.AcroFields.SetField("paperTitle", paperTitle.ToUpper());
stamper.FormFlattening = true;
stamper.Close();
reader.Close();
Response.AddHeader("Content-Disposition", "attachment; filename=YourPdf.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(output.ToArray());
Response.End();