Hello, in an MVC application I need to convert a .docx that contains images into a pdf. My code below works if the docx does not contain an image. If the docx contains an image I get an object reference error when importing the document on this line: document = providerDocx.Import(stream);
RadFlowDocument document = null;
DocxFormatProvider providerDocx = new DocxFormatProvider();
using (FileStream stream = File.Open(@"C:\\test\myWordDoc.docx", FileMode.Open))
{
document = providerDocx.Import(stream);
var providerPdf = new PdfFormatProvider();
Stream outStream = new MemoryStream();
providerPdf.Export(document, outStream);
//Test the conversion:
var fileStream = File.Create(@"C:\\test\myWordDoc.pdf");
outStream.Seek(0, SeekOrigin.Begin);
outStream.CopyTo(fileStream);
fileStream.Close();
}
How can I convert an existing word document with images to a new pdf document?