0

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?

Akbar Badhusha
  • 2,415
  • 18
  • 30

1 Answers1

2

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.

Brian Berns
  • 15,499
  • 2
  • 30
  • 40