Welcome to the ASP.NET Core feedback portal. We’re happy you’re here! If you have feedback on how to improve the ASP.NET Core, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Attached is an example and code, where you can see that the pdf output file incorrectly aligns a table in the DOCX file body.
what am I doing wrong?
My Code:
public static void ConvertToPdf()
{
try
{
FileStream docStream = new FileStream("sample.docx", FileMode.Open, FileAccess.Read);
Syncfusion.DocIO.DLS.WordDocument wordDocument = new Syncfusion.DocIO.DLS.WordDocument(docStream, Syncfusion.DocIO.FormatType.Docx);
DocIORenderer render = new DocIORenderer();
//Establece las opciones de renderizado de imagen
render.Settings.ChartRenderingOptions.ImageFormat = ExportImageFormat.Jpeg;
//Convierte el documento Word a formato PDF
PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
//Test de Salida
FileStream docStreamSalida = new FileStream("(SAMPLE_OUT.pdf", FileMode.Create, FileAccess.ReadWrite);
pdfDocument.Save(docStreamSalida);
//Libera recursos
docStream.Flush();
docStreamSalida.Flush();
render.Dispose();
wordDocument.Dispose();
pdfDocument.Dispose();
}
catch (Exception e)
{
}
}