使用iTextSharp C#更改PDF注释属性 [英] Change PDF Annotation properties using iTextSharp C#

查看:400
本文介绍了使用iTextSharp C#更改PDF注释属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在使用C#中的iTextSharp为已存在的PDF添加插入符号注释

Hi I am adding a caret annotation to an already existing PDF using iTextSharp in C#.

现在我想更改一些注释的属性,例如颜色的不透明度已锁定

Now I want to change some of the annotation's properties, such as Opacity of color and Locked.

推荐答案

假设你有一个 PdfAnnotation 对象。这是一个扩展 PdfDictionary 的类。

Suppose that you have a PdfAnnotation object. This is a class that extends PdfDictionary.

要锁定此注释字典定义的注释,您需要设置 PdfAnnotation.FLAGS_LOCKED 标志,例如 setFlags()方法:

To lock the annotation defined by this annotation dictionary, you need to set the PdfAnnotation.FLAGS_LOCKED flag, for instance with the setFlags() method:

annot.setFlags(PdfAnnotation.FLAGS_LOCKED);

请注意,使用此方法将覆盖之前已定义的标志。

Note that using this method will override the flags that were already defined before.

对于不透明度,它由注释字典的 ca 条目定义。

As for the opacity, that's define by the ca entry of the annotation dictionary.

annot.put(PdfName.ca, new PdfNumber(0.27));

你提到iText以及iTextSharp,我的代码片段是Java代码。如果要在C#代码中使用它们,则需要对方法进行小的更改。

You mention iText as well as iTextSharp, my snippets are lines of Java code. You'll need to apply small changes to the methods if you want to use them in C# code.

这篇关于使用iTextSharp C#更改PDF注释属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆