I want to create a multiple-paged PDF document based on a PDF template using iTextSharp.
(我想使用iTextSharp基于PDF模板创建多页PDF文档。)
Unfortunately the template has only one page, but I want to multiplу it in the resulting document. (不幸的是,模板只有一页,但是我想将其乘以结果文档。)
public static void GeberateFromTamplate(string pathTamplate)
{
//string pathTamplate = Server.MapPath("PDFs");
string pdfTemplate = pathTamplate + @"
ewTemplate.pdf";
string newFile = pathTamplate + @"Filled-outForm.pdf";
PdfReader pdfReader = new PdfReader(pdfTemplate);
PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(
newFile, FileMode.Create));
AcroFields pdfFormFields = pdfStamper.AcroFields;
// set form pdfFormFields
//
pdfFormFields.SetField("f1_01(0)", "1");
pdfFormFields.SetField("f1_02(0)", "1");
pdfFormFields.SetField("f1_03(0)", "1");
pdfFormFields.SetField("f1_04(0)", "8");
pdfFormFields.SetField("f1_05(0)", "0");
pdfFormFields.SetField("f1_06(0)", "1");
pdfFormFields.SetField("f1_07(0)", "16");
pdfFormFields.SetField("f1_08(0)", "28");
pdfFormFields.SetField("f1_09(0)", "Franklin A.");
pdfFormFields.SetField("f1_10(0)", "Benefield");
pdfFormFields.SetField("f1_11(0)", "532");
pdfFormFields.SetField("f1_12(0)", "12");
pdfFormFields.SetField("f1_13(0)", "1234");
// The form's checkboxes
pdfFormFields.SetField("c1_01(0)", "0");
pdfFormFields.SetField("c1_02(0)", "Yes");
pdfFormFields.SetField("c1_03(0)", "0");
pdfFormFields.SetField("c1_04(0)", "Yes");
pdfStamper.FormFlattening = false;
// close the pdf
pdfStamper.Close();
}
ask by Max translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…