Read PDF file from URL to byte array

In XML, WebResponseI get a URL that has a link to a PDF file. Example URL value:) https://www.member-data.com/files/hb/c8955fc4d6160ec0fd87f4879c6496d3.pdf. I need to convert this PDF to an array of bytes, how to do this in C #?

+5
source share
3 answers
+11
source

You can use WebClient.DownloadDatathat has a default byte array value. eg.

byte[] bytes = myClient.DownloadData("https://www.member-data.com/files/hb/c8955fc4d6160ec0fd87f4879c6496d3.pdf");

In addition, it is assumed that you want the actual file to be in an array of bytes, and not in the contents (text) of the PDF. This is a whole different wax.

+16
source

PDF , ReadAllBytes System.IO

-2

All Articles