简体   繁体   English

PDF 使用 JavaScript Adobe Acrobat Pro 以编程方式访问和复制字段属性

[英]PDF Access and Copy Field Properties Programmatically Using JavaScript Adobe Acrobat Pro

I am currently creating a document that changes field visiblty and changes field positions, i can manipulate fields just fine but what i want to do is move objects between pages.我目前正在创建一个更改字段可见性并更改字段位置的文档,我可以很好地操作字段,但我想要做的是在页面之间移动对象。 From what i have discovered this is not possible without removing the field from the page and recreating it on another.根据我的发现,如果不从页面中删除该字段并在另一个页面上重新创建它,这是不可能的。 To do this i will require to copy all properties to the new object.为此,我需要将所有属性复制到新的 object。

Is there a way for me to get field properties as a dictionary to then populate the new field properties?有没有办法让我将字段属性作为字典来填充新的字段属性? Below is what i was expecting to use:以下是我期望使用的:

var field = this.getField("myFieldName");
var properties = field.properties;

UPDATE: I have found the code below but it returns an error after iterating a few entries:更新:我找到了下面的代码,但它在迭代几个条目后返回错误:

InvalidGetError: Get not possible, invalid or unknown. InvalidGetError:无法获取、无效或未知。

var field = this.getField("myFieldName");
for (x in field) {
    console.println(x);
    console.println(field[x]);
}

I manged to figure it out:我设法弄清楚:

var field = this.getField("myFieldName");
for (x in field) {
    console.println(x);
    try {
        console.println(field[x]);
    }
    catch(err) {
        console.println("Error: " + err);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM