user1486403
user1486403

Reputation: 39

C# : How to convert a local pdf file to a byte [][]

SITUATION

QUESTIONS

The code is as follows


   byte[][] pdfDoc= new byte[1][];
byte[] outputDoc = File.ReadAllBytes(@"d:/test.pdf");

for (int x = 0; x < pdfDoc.Length; x++) { pdfDoc[x] = outputDoc; }

But it is failing, not able to read the file from the d:/test.pdf location. Thanks.

Upvotes: 3

Views: 19157

Answers (1)

Chris Gessler
Chris Gessler

Reputation: 23113

I think this will work for you:

byte[] bytes = File.ReadAllBytes("c:\\folder\\myfile.pdf");

Upvotes: 9

Related Questions