We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Save generated PDF to database

Would this be the best process to generate a pdf from an uploaded word document and save the resulting pdf file to a database?

  1. Upload word document to temp folder
  2. Stream uploaded document into PDF
  3. Save PDF to temp folder
  4. Read PDF into Stream
  5. Save stream of PDF into database

This is the currently how I have it set up, however, I would like to skip the process of saving the file to disk if at all possible.

Ideal solution:

  1. Upload word document to temp folder
  2. Stream uploaded document into PDF Stream
  3. Save stream of PDF into database.


It is possible to save to a stream from Aspose.Word and then load the document from a stream in Aspose.Pdf, but if the document contains images they still will be stored in temporary files and it is a good idea to keep that flag to remove temporary image files in Aspose.Pdf turned on.

You need to save to a stream from Aspose.Word https://docs.aspose.com/words/net/save-a-document/#save-a-document-to-a-stream

Then you need to load an XmlDocument from that stream.

stream.Position = 0;
XmlDocument xmlDoc = new XmlDocument();

Finally, you can have Aspose.Pdf to load from an XmlDocument


Sorry to re-open an old thread, but we are experiencing the same problem. We have loaded a word document into an aspose.words object, then transferred that to an aspose.pdf object.

We need to save it into our database, so we convert it to a stream then to a byte[] and save that. We have a page that pulls pdf files back from our database and displays them without using Aspose. When we open up a document that we saved using aspose we get an error from Adobe PDF viewer that the file is corrupt.

If we save the file to disk and then read it back in to a byte array and save it to the database then it works fine. This is obviously not ideal - we don’t want to write to disk just to save it to the database.



We are happy to tell you that the new Rendering Engine has replaced the “old Viewer Beta”. The Rendering Engine can print, save as images or draw onto .NET Graphics object any document page.

Please see Aspose.Words documentation to learn more about new features.

Saving to image

In additional, new Rendering engine allows you to convert Word document to PDF directly (without using Aspose.Pdf).

Saving to Pdf

The latest version of Aspose.Words is available for download from downloads section or from NuGet