读书笔记-Acrobat JavaScript Scripting Guide

Adding Watermarks and Backgrounds

The doc object’s addWatermarkFromText and addWatermarkFromFile methods create watermarks within a document, and place them in optional content groups (OCGs).The addWatermarkFromFile method adds a page as a watermark to the specified
pages in the document. The example below adds the first page of watermark.pdf as a watermark to the center of all pages within the current document: this.addWatermarkFromFile(“/C/watermark.pdf”); In the next example, the addWatermarkFromFile method is used to add the second page of watermark.pdf as a watermark to the first 10 pages of the current document. It is
rotated counterclockwise by 45 degrees, and positioned one inch down and two inches over from the top left corner of each page:

this.addWatermarkFromFile({
cDIPath: "/C/watermark.pdf",
nSourcePage: 1,
nEnd: 9,
nHorizAlign: 0,
nVertAlign: 0,
nHorizValue: 144,
nVertValue: -72,
nRotation: 45
});

It is also possible to use the addWatermarkFromText method to create watermarks. In this next example, the word Confidential is placed in the center of all the pages of the document, and its font helps it stand out:

this.addWatermarkFromText(
"Confidential",
0,
font.Helv,
24,
color.red
);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值