简体   繁体   中英

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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