为了账号安全,请及时绑定邮箱和手机立即绑定

如何使用 Aspose 在 pdf 中添加图像水印?

如何使用 Aspose 在 pdf 中添加图像水印?

C#
qq_笑_17 2021-07-15 13:05:03
以下代码在pdf页面的中心添加指定图像的水印。我希望图像作为整个 pdf 页面上的水印重复出现,而不仅仅是在中心。水印应该重复 background-repeat 属性在 css 中的工作方式。static void Main(string[] args){    Document pdfDocument = new Document(@"C:\Users\code.wines\Downloads\old.pdf");    pdfDocument.Pages.Add();    ImageStamp imageStamp = new ImageStamp(@"C:\Users\code.wines\Desktop\image.jpg");    imageStamp.Background = true;    imageStamp.Height = 350;    imageStamp.Width = 350;    imageStamp.Opacity = 0.5;    imageStamp.HorizontalAlignment = HorizontalAlignment.Center;    imageStamp.VerticalAlignment = VerticalAlignment.Center;    for (int j = 1; j <= pdfDocument.Pages.Count; j++)    {        pdfDocument.Pages[j].AddStamp(imageStamp);    }    pdfDocument.Save(@"C:\Users\code.wines\Desktop\new.pdf");}
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 499 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号