Free Support Forum - aspose.com

Ultimate Challenge: Convert a Word document to PDF document without creating a disk file

All of my Word Documents are in a SQL Server Database as varbinary(max). I want to read the SQL database in order to store the Word Document in a Byte[] array and then convert that Byte[] array to a second Byte[] array. I want the second Byte[] array to be a PDF so that I can write the PDF array back to the SQL database as a varbinary(max) PDF file. Is that possible? I am not interested in creating a disk file with this process. Any help would be much appreciated.

Hi Peter,


Thank you for contacting support. Aspose.Pdf API does not support converting Word documents to PDF and you can use Aspose.Words API to convert a Word document to PDF. Aspose.Words API takes a Word document through the input stream or a file path. You can retrieve varbinary from the database, and then store in byte array using System.Data.SqlClient assembly.

The final byte array can also be converted to stream object. At the end, you will pass this stream object to Aspose.Words API to convert it to a PDF document. Please refer to these helping links: Convert Varbinary to byte array, Convert byte array to stream, Convert a Word document to PDF using Aspose.Words API and Open a Word document from a Stream using Aspose.Words