Hello,
I am trying to generate a solution for processing Word .DOCX documents, adding some headers and footer and then saving them as a PDF. My original code used Aspose libraries to accomplish this. Our current version is many years old and outside the update path, their recent releases seem to handle this, so I know Telerik handles some of the same functionality and was considering standardizing on Telerik and re-writing the code.
I created a real simple example as a test to just read in the .docx as a stream and then export as a PDF. The PDF seems to be corrupted or fails with Cambodian, and if I load just a standard English, Spanish or similar document (without doing the header work, etc) it seems to save the PDF fine.
I did not know if there was additional statements I needed to get this to convert/save as a pdf because of the font family. Thanks
Telerik.Windows.Documents.Flow.Model.RadFlowDocument doc;
var docxPRovider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
var pdfProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
TimeSpan timeoutInterval = TimeSpan.FromSeconds(180);
using (FileStream stream = File.Open(@"C:\Telerik\15-190.docx", FileMode.Open))
{
doc = docxPRovider.Import(stream, timeoutInterval);
}
using (Stream output = File.Open(@"C:\Telerik\Out\15-190.pdf", FileMode.Create))
{
pdfProvider.Export(doc, output, timeoutInterval);
}