PDFReader 未使用所有者密码打开 - 使用 Itextsharp PDFCopyFields.AddDocument

问题描述 投票:0回答:1
We recently changed PDFs to an encrypted\Secure PDF (no password needed to open in adobe reader) and now get the error: PDFReader not opened with owner password.

Using iTextSharp.LGPLv2.Core 3.4.3 with .Net 6.0 / c#

Error
 MemoryStream stream = new();
 PdfCopyFields copy = new(stream);
foreach (LetterTemplate t in sourceFiles)
{ 
    //This throws the error using an encrypted PDF.
    copy.AddDocument(new PdfReader(t.Data)); // t.Data is a byte array. 
}

我尝试过 PdfReader.unethicalreading = true;和 pdfReader.setUnethicalReading(true); 我在看起来较旧的帖子上发现了建议,但这些属性不可用。 有没有我可以使用的新属性\方法来取代不道德的阅读?

c# pdf
1个回答
0
投票

PdfReader.AllowOpenWithFullPermissions = true;

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.