如何在将 PDF 作为资源添加到项目的 PDFsharp 中打开 PDF

How to open PDF in PDFsharp where PDF is added as a resource to the project

我在路径中遇到错误,因为它正在检索其中的 System.Byte[]。如何访问添加到我的资源中的 PDF?

代码:

PdfDocument = PdfSharp.Pdf.IO.PdfReader.Open(My.Resources.CANEezz_Individual.ToString, PdfDocumentOpenMode.Modify)

Dim font9 As XFont = New XFont("Arial", 8)
Dim page As PdfPage = PdfDocument.Pages(0)
Dim graph As XGraphics = XGraphics.FromPdfPage(page)
graph.DrawString("Bank Passboook", font9, XBrushes.Black, 518, 343)

Dim pdfFilename As String = "something.pdf"
PdfDocument.Save(pdfFilename)
Process.Start(pdfFilename)

byte[] 传递给 MemoryStream 的构造函数并将该内存流传递给 PdfReader.Open() 方法。