如何使用itextsharp将表插入现有PDF [英] how to insert a table into existing PDF using itextsharp

查看:100
本文介绍了如何使用itextsharp将表插入现有PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法(使用iTextSharp)使用pdf表格,如下所示......其中:

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

1-一些字段出现在第一个仅限页面(表单顶部)

2-仅在最后一页显示的某些字段(表单底部)

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

3-表使用C#代码添加生成表单后,前两个部分
和表我消耗多个页面(前两个之间)

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 )

我做了以下事情:

        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();

但表格会覆盖放置在区域(2)和页脚中的内容以及表格是否需要额外页面没有创建新页面....如何使表格根据需要扩展文档,最后在末尾写入区域(2)

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.


  • < a href =http://www.c-sharpcorner.com/UploadFile/scottlysle/PdfGenerator_CS06162007023347AM/PdfGenerator_CS.aspx =nofollow noreferrer>使用开源iTextSharp DLL填写PDF表单字段

  • 如何定位特定x,y坐标的表格

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

这篇关于如何使用itextsharp将表插入现有PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆