I have a program that uses WebClient
to download a file from a remote server. I am using DownloadData
rather than DownloadFile
because I don't really need the physical file. I am just taking the byte array and converting it to a base64 string for submission through an API as part of the payload. For some files, I will download them as RTF, but they need to be converted to a searchable PDF before I send them through the API. I'd rather handle this conversion with just the byte arrays in memory, rather than saving files to disk, then converting. Is there a way for me to take the RTF byte array and convert it to a (searchable) PDF byte array?
I tried just saving the rtf byte array to a pdf, but that does not work. Here's my code for that:
System.IO.File.WriteAllBytes(@"C:\temp\pdfTest.pdf", fileBytes);