3

I'm getting an error in the path because it's retrieving System.Byte[] in it. How can I access the PDF which is added in my resources?

Code:

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)
Bugs
  • 4,491
  • 9
  • 32
  • 41
Wes Gourh
  • 69
  • 2
  • 8

1 Answers1

5

Pass the byte[] to the constructor of MemoryStream and pass that memory stream to the PdfReader.Open() method.

  • Dim ss As MemoryStream = New MemoryStream(My.Resources.CANEezz_Individual) pdfDocument = PdfSharp.Pdf.IO.PdfReader.Open(ss, PdfDocumentOpenMode.Modify) Made these changes and it works for me ty :) – Wes Gourh May 18 '17 at 08:20