Free Support Forum - aspose.com

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.

Hi

<?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:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/howto-load-and-save-a-document-to-database.html

Hope this helps.

Best regards.