如何将可打印或不可打印的位图标记添加到PDF? [英] How to add a printable or non-printable bitmap stamp to a PDF?

查看:165
本文介绍了如何将可打印或不可打印的位图标记添加到PDF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在PDF文件中添加位图图章,根据实际的Acrobat Reader打印设置,该图案可以是可打印的或不可打印的。

I would like to add a bitmap stamp to a PDF file, that would be either printable or non-printable depending on the actual Acrobat Reader print settings.

I.e。当用户在AR打印对话框组合框中选择文档选项 - 然后它将不会被打印,但是当选择文档和标记时,将打印位图。

I.e. when user selects in AR Print dialog combo box the option "Document" - then it would not be printed, but when "Document and stamps" is selected then the bitmap would print.

现在我可以创建可打印或不可打印的位图,但我无法根据用户选择创建可打印和不可打印的位图

Right now I can create either printable or non-printable bitmap, but I am unable to create a bitmap that would be both printable and non-printable depending on users choice.

使用 PdfStamper

这可能吗?

推荐答案

创建图章注释在我的书的第7章,更具体地说是 TimeTableAnnotations3 示例:

Creating stamp annotations is described in Chapter 7 of my book, more specifically in the TimeTableAnnotations3 example:

PdfAnnotation annotation = PdfAnnotation.createStamp(stamper.getWriter(),
    rect, "Press only", "NotForPublicRelease");
annotation.setFlags(PdfAnnotation.FLAGS_PRINT);

如果您查看打印预览,可以看到如果您没有显示这些注释打印没有邮票的文件:

If you look at the print preview, you can see that these annotations don't show up if you print the Document without stamps:

在C#中,代码与Java代码非常相似:

In C#, the code is very similar to the Java code:

 PdfAnnotation annotation = PdfAnnotation.CreateStamp(
     stamper.Writer, rect, "Press only", "NotForPublicRelease"
 );
 annotation.Flags = PdfAnnotation.FLAGS_PRINT;

请注意,PDF查看器应至少具有以下名称的预定义图标:

Note that a PDF viewer should have predefined icons for at least the following names:


  • 已批准,

  • 实验,

  • 未批准,

  • AsIs,

  • 已过期,

  • NotForPublicRelease,

  • 机密,

  • 最终,

  • 已售出,

  • 部门,

  • ForComment,

  • TopSecret,

  • 草稿,

  • ForPublicRelease。

  • Approved,
  • Experimental,
  • NotApproved,
  • AsIs,
  • Expired,
  • NotForPublicRelease,
  • Confidential,
  • Final,
  • Sold,
  • Departmental,
  • ForComment,
  • TopSecret,
  • Draft,
  • ForPublicRelease.

这些图标的外观取决于观众到观众。

What these icons look like will depend from viewer to viewer.

这篇关于如何将可打印或不可打印的位图标记添加到PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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