4 Answers, 1 is accepted

I have a Byte [ ] of word document containing Text and tables.
I´m using the next code but I can´t convert the word document to pdf
byte[] documento = null;
RadFlowDocument documento2 = new RadFlowDocument();
Telerik.Windows.Documents.Common.FormatProviders.IFormatProvider<RadFlowDocument> formatProvider3 = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
string path = Path.Combine(carpetaReportes, "EstudioViabilidadF_4516_Orden_10310.docx");
documento = bytesW;
string nom="Archivo.pdf";
using (MemoryStream m = new MemoryStream())
{
using (FileStream stream = File.Open(path, FileMode.Open))
{
documento2 = formatProvider3.Import(stream);
formatProvider3.Export(documento2, m);
GuardarHistoria(nom, m);
}
}
From your code, I can see that you are trying to import a DOCX file path with the formatProvider3 variable.
I am afraid that this won't work as the formatProvider3 is an instance of the PdfFormatProvider class. If you would like to import a DOCX file you should use the DocxFormatProvider class. If you would like to export the document to PDF format then you should use the PdfFormatProvider class.
Each supported file format has its own format provider which should be used for the import/export operations.
I hope this information is helpful.
Regards,
Mihail
Telerik by Progress

Thanks for your help. Following your advice I'm using the next code:
RadFlowDocument document = provider.Import(bytesword);
Path.Combine(carpetaReportes, "Estudio_" + IdPaciente + "_Orden_" + OrdenServ + ".pdf");
PdfFormatProvider providerPdf = new PdfFormatProvider(); ---->In this line appears the exception
using (Stream c = File.Open(nombrePDF, FileMode.Create))
{
providerPdf.Export(document, c);
}
But I get the next error: Operation can not destabilize the runtime as shown in the picture
From the stack trace in the screenshot, I can see that there is some problem with a font used in the document.
My recommendation for you is to open a new support ticket with product ASP (AJAX/MVC) PdfProcessig and provide the problematic document. This way we will be able to investigate what is causing the issue.
Regards,
Mihail
Telerik by Progress