I am receiving an error when trying to convert a word doc to a PDF.
Here is the code:
var docxPRovider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
var pdfProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
var docBytes = File.ReadAllBytes(path);
var document = docxPRovider.Import(docBytes);
var testFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "test.pdf");
var resultBytes = pdfProvider.Export(document);
File.WriteAllBytes(testFile, resultBytes);
Here is the error:
Could not load type 'System.Windows.Point' from assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExportSettings..ctor()
at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExportSettings..ctor()
at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider..ctor()
The line in bold is where the error occurs. I verified I have WindowsBase and System.Windows as references in my project.
Any help would be appreciated.
hello,
i'm working on function to export word to PDF, and the result is inconherent, i'm loosing the special caracter like "é" , "ô". the document is in french language, also the style of wording of the document.
this is my function, any suggestion to resolve it?
regards.
public static void ConvertWordtopdf(string input, string output)
{
var docxProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
var pdfProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
try
{
//var docxBytes = File.ReadAllBytes(input);
var docxBytes = System.IO.File.OpenRead(input);
RadFlowDocument docx = docxProvider.Import(docxBytes);
var pdfBytes = pdfProvider.Export(docx);
File.WriteAllBytes(output, pdfBytes);
docxBytes.Dispose();
}
catch (Exception ex)
{
;
}
}