小编cro*_*717的帖子

iTextSharp - 移动Acrofield

我有一个将内容表插入现有Acroform的过程,并且我能够跟踪启动该内容所需的位置.但是,根据我插入的表的高度,我在该点之下存在需要向上或向下移动的Acrofield.有了这个,我怎样才能改变Acrofield的位置?下面是我可以用来"获得"位置的代码......但是现在我还需要能够"设置"它.

....

            // Initialize Stamper ("output" is a MemoryStream object)
            PdfStamper stamper = new PdfStamper(pdf_rdr, output);

            // Get Reference to PDF Document Fields
            AcroFields fields = stamper.AcroFields;

            //call method to get the field's current position
            AcroFields.FieldPosition pos = GetFieldPosition(fields, "txt_footer");
Run Code Online (Sandbox Code Playgroud)

//**需要明确地为这里的田野设置一个新的位置

            //assuming a call to "RegenerateField" will be required
            fields.RegenerateField(txt_footer);
Run Code Online (Sandbox Code Playgroud)

....

    //helper method for capturing the position of a field
    private static AcroFields.FieldPosition GetFieldPosition(AcroFields fields, string field_nm)
    {

        ////////////////////////////////////////////////////////////////////////////////////
        //get the left margin of the page, and the "top" location …
Run Code Online (Sandbox Code Playgroud)

.net c# itextsharp acrofields

4
推荐指数
1
解决办法
2910
查看次数

标签 统计

.net ×1

acrofields ×1

c# ×1

itextsharp ×1