Reputation: 2627
I have requirement where I have to convert a doc or docx file into PDF. I have the doc file in byte array format. Need to convert that byte array into PDF without using storage. Is there anyway to do that using only memory. Code I use for conversion using storage is as below.
string outputFileName = destinationFile;
Interopwrd.Application wordApp = new Interopwrd.Application();
Interopwrd.Document wordDoc = null;
wordDoc = wordApp.Documents.Open(sourceFile);
wordDoc.ExportAsFixedFormat(outputFileName, Interopwrd.WdExportFormat.wdExportFormatPDF);
I need to do this without saving in in storage. Is it possible to do that?
Upvotes: 0
Views: 1404
Reputation: 17038
Personally, I would just use a RAM drive, which is block of memory that the OS treats as if it were a disk drive. You can then have Word save to a file on that drive, but it will only exist in memory. That gives you all the performance benefits (and impermanence) of RAM, and the benefits of a file system at the same time. Win-win.
Upvotes: 2