read a pdf file from url to to byte array

后端 未结 3 1060
故里飘歌
故里飘歌 2021-02-15 23:33

In an XML WebResponse I get a URL tag which has a link to a PDF file. Example of the URL value is: https://www.member-data.com/files/hb/c8955fc4d6160ec0fd87f4

3条回答
  •  情话喂你
    2021-02-16 00:01

    You can use WebClient.DownloadData, which has a default return value of a byte array. e.g.

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

    Also, this assumes that you want the actual file in a byte array, not the content (text) of the PDF. That's a whole other ball of wax.

提交回复
热议问题