[英]In Adobe Acrobat X Pro, how do I use javascript to prefill text fields in an acrobat pdf form?
[英]How to make part of annotation text bold using javascript in Adobe Acrobat Pro
我想在内容中添加内联加粗样式。 我该如何实现? 下面的代码输出粗体标签标记,而不是应用粗体格式。
var annot = this.addAnnot({
page: 0,
type: "FreeText",
rect: [50, 50, 300, 100], // location and size of text field in points
contents: "<b>Links to</b>: http://www.example.com",
});
需要设置文本字段属性以允许RTF格式。 然后,您需要创建一个Span对象数组,其中包含具有所需格式的文本。
var spans = new Array();
spans[0] = new Object();
spans[0].text = "Attention:\r";
spans[0].textStyle = "bold";
spans[0].textSize = 18;
spans[1] = new Object();
spans[1].text = "Adobe Acrobat DC\r";
spans[1].textColor = color.red;
spans[1].textSize = 20;
spans[1].alignment = "center";
spans[2] = new Object();
spans[2].text = "will soon be here!";
spans[2].textColor = color.green;
spans[2].fontStyle = "italic";
spans[2].underline = true;
spans[2].alignment = "right";
// Now create the annot with spans as it's richContents
var annot = this.addAnnot({
page: 0,
type: "FreeText",
rect: [50, 50, 300, 100],
richContents: spans
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.