我在Adobe Acrobat Pro DC定制项目中被带了进来。这个项目的目标是在每个页面的左边缘添加一个警告。我得到了一段JavaScript,它可以做到这一点,但有一个异常,并要求我修复那个异常。
代码是:
var inch = 72;
for (var p = 0; p < this.numPages; p++) {
var aRect = this.getPageBox( {nPage: p} );
aRect[0] = 8.25*inch; //how far from the left the box ends
aRect[1] = 0.5*inch; //how high from the bottom the box is
aRect[2] = 7.75*inch; //how far from the left the box starts
aRect[3] = 11.0*inch; //how tall the box is
var f = this.addField("ControlledDoc", "text", p, aRect )
f.rotation = 270;
f.delay = true;
f.textSize = 7.5;
f.textFont = font.HelvB;
f.textColor = color.red;
f.alignment = "center";
f.readonly = true;
f.display = display.visible;
f.delay = false;
}
var myWillSaveScript = 'var f = this.getField("ControlledDoc"); \r'
+ 'f.value = "This is an electronic controlled copy of a paper based document management system. When printed on the copy machine it becomes an uncontrolled paper copy valid until the end of the printing day."; \r';
this.setAction("WillSave", myWillSaveScript);当文档的长度超过一页时,就会出现问题。ControlledDoc字段按预期在每个页面上复制。每页都有一个ControlledDoc#n-1字段,其中n是页码。在第一个页面上,f.rotation设置被保留,并在UI中显示为属性对话框中的方向下拉菜单设置为270。但是,在第二页和后续页面上,方向设置为0。我可以手动编辑文档并将方向设置为270,但这违背了使用JavaScript实现自动化的目的。
我是用JavaScript控制Acrobat Pro DC的新手,所以如果我错过了一些愚蠢的东西,我不会感到惊讶。
要使旋转设置在第二页和后续页面上保持不变,我需要进行哪些更改?
https://stackoverflow.com/questions/41247013
复制相似问题