Skip to content

Commit

Permalink
-修复无法移除某些签名保护的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wmjordan committed Oct 22, 2023
1 parent 4f42aef commit 46ddbd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions App/Processor/ContentProcessors/CommonProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using iTextSharp.text.pdf;
using PDFPatcher.Model;

namespace PDFPatcher.Processor
{
Expand All @@ -27,6 +24,19 @@ void IPageProcessor.BeginProcess(DocProcessorContext context) {
if (_options.RemoveUsageRights) {
Tracker.TraceMessage("删除权限控制。");
pdf.RemoveUsageRights();
var form = pdf.Catalog.GetAsDict(PdfName.ACROFORM);
if (form != null) {
form.Remove(PdfName.SIGFLAGS);
var fields = form.GetAsArray(PdfName.FIELDS);
if (fields != null) {
for (int i = fields.Size - 1; i >= 0; i--) {
var f = fields.GetAsDict(i);
if (f != null && PdfName.SIG.Equals(f.GetAsName(PdfName.FT))) {
fields.Remove(i);
}
}
}
}
}
if (_options.RemoveXmlMetadata) {
Tracker.TraceMessage("删除 XML 元数据。");
Expand Down
1 change: 1 addition & 0 deletions 更新历史.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
修复问题:
书签跳转目标错误导致无法打开文档。
混合合并图片和页面时,页面方向与尺寸错误。
无法移除某些签名保护。

1.0.0.4200 2021年12月23日~2023年8月30日
新增功能:
Expand Down

0 comments on commit 46ddbd9

Please sign in to comment.