Attached is my relevant code:
- Code: Select all
using (MemoryStream pdfDocument = new MemoryStream())
{
Spire.Doc.Document doc = new Spire.Doc.Document(wordStream, Spire.Doc.FileFormat.Auto);
doc.SaveToFile(Path.Combine(BulkEmailTemplateSavePath, fileName), Spire.Doc.FileFormat.PDF); //-Works producing PDF that is readable
doc.SaveToStream(pdfDocument, Spire.Doc.FileFormat.PDF); //-PDF saved out later is corrupt
attachmentsToAdd.Add(new KeyValuePair<string, byte[]>(fileName, pdfDocument.GetBuffer()));
}
I've tried combinations of saving the PDF to disk and to stream and I can't get the saving to stream working.
Thanks