With DocConverter version 10.3.0+ DocConverter now accepts a file in memory, and outputs the file in memory. (.NET only.)


 For older versions of DocConverter:


>>My source is always in a byte stream, and I have to store the byte stream of the output PDF


DocConverter requires a file input and outputs to a PDF file.


To convert your input stream to a file:

//write all bytes back to a file
File.WriteAllBytes(strPath +"pow.docx", sf.StreamFile(strPath + "test.docx"));

https://msdn.microsoft.com/en-us/library/system.io.file.writeallbytes.aspx


 


To convert the output file to a byte array:


private byte[] StreamFile(string filename)
{
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);

// Create a byte array of file stream length
byte[] bytes = System.IO.File.ReadAllBytes(filename);


//Read block of bytes from stream into the byte array
fs.Read(bytes, 0, System.Convert.ToInt32(fs.Length));

//Close the File Stream
fs.Close();
return bytes; //return the byte data
}