我正在使用 PDFsharp,并且尝试打开一个表示为 Byte[] 变量的 PDF。这是一个简化的示例:
public Byte[] myFunc(Byte[] PDF)
{
PdfDocument document = PdfReader.Open(PDF_Path); // <-- My problem is here
// do some modification on the document
return document;
}
Run Code Online (Sandbox Code Playgroud)
我可以从 PDF 的路径中读取 PDF,但我宁愿将 PDF 作为字节数组来使用。将字节数组另存为 PDF 然后读取它,然后删除我创建的文件是否是更好的选择?我觉得这种方法不合适。