Free Support Forum -

How to save binary of pdf file into data table?

I have a file:

stirng file = "c:\\test.pdf";

Need to convert into binary and save the binary data into a table of a database.

Thank you.


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. You can do this using the following simple line of code:

// Reade PDF document bytes.

byte[] docBytes = File.ReadAllBytes(@"C:\Temp\test.pdf");

// Here should be your code to write bytes to DB.

// ................................

I think the following article could be useful for you:

Hope this helps.

Best regards.