Hello, I need to export / convert an Excel file to Pdf file.
Unfortunately using Microsoft.Interop everything works in development but not in production.
I have been able to use the RadFlowDocument features to convert a Word file to pdf using the following code.
public
void
TransformPdf(
string
fileSource,
string
fileDestination)
{
IFormatProvider<RadFlowDocument> fileFormatProvider =
new
DocxFormatProvider();
using
(FileStream input =
new
FileStream(fileSource, FileMode.Open))
{
RadFlowDocument document = fileFormatProvider.Import(input);
byte
[] renderedBytes =
null
;
IFormatProvider<RadFlowDocument> formatProvider =
new
RtfFormatProvider();
using
(MemoryStream ms =
new
MemoryStream())
{
formatProvider.Export(document, ms);
renderedBytes = ms.ToArray();
File.WriteAllBytes(fileDestination, renderedBytes);
}
}
}
My question is: Do you have a similar or alternative way to make a pdf conversion using the Telerik libraries?
Thank you, Mario