开发者

how to insert a table into existing PDF using itextsharp

开发者 https://www.devze.com 2023-04-11 23:02 出处:网络
Is there any way (using iTextSharp) to work with a pdf form like the following one ... where : 1- some fields to appear in the first page only( Top of the form )

Is there any way (using iTextSharp) to work with a pdf form like the following one ... where :

1- some fields to appear in the first page only ( Top of the form )

2- some field开发者_运维问答s to appear in the last page only ( Bottom of the form )

3- table to be added using C# code after the form is generated with the the first two sections and the table me consume more than one page ( between the first two )

I did the following :

        FillTable();
        Byte[] buffer = System.IO.File.ReadAllBytes(@"C:\Users\mahmod\Desktop\PDFform.pdf");
        string newFile = @"C:\Users\mahmod\Desktop\output.pdf";
        PdfReader reader = new PdfReader(buffer);
        PdfStamper pdfStamper = new PdfStamper(reader, new FileStream(newFile, FileMode.Open));
        table.SetTotalWidth(new float[] { 100, 100 });
        table.WriteSelectedRows(0, -1, 200, 200, pdfStamper.GetOverContent(1));
        pdfStamper.Close();

but the table overwrites the the content placed in region(2) and the footer and if the table needs extra pages no new pages created ....how to make the table extend the document by as much pages as needed and finally writing region(2) at the end


Yes, this is all possible. Without more specific details, however, I'm just going to point you to a couple of articles that will hopefully get you started.

  • Fill in PDF Form Fields using the Open Source iTextSharp DLL
  • How to position a table at a specific x,y coordinate
0

精彩评论

暂无评论...
验证码 换一张
取 消