Hi,
I used the document editor component to save the SFDT object as pdf in our filesystem:
[AcceptVerbs("Post")]
[HttpPost]
[EnableCors("AllowAllOrigins")]
[Route("DocToPDF")]
public StatusCodeResult DocToPDF([FromBody] Models.ExportData Data)
{
string customPath = Environment.GetEnvironmentVariable("CUSTOM_PATH");
try
{
Stream document = WordDocument.Save(Data.documentData, FormatType.Docx);
document.Position = 0;
Syncfusion.DocIO.DLS.WordDocument wordDocument = new Syncfusion.DocIO.DLS.WordDocument(document, Syncfusion.DocIO.FormatType.Docx);
DocIORenderer renderer = new DocIORenderer();
renderer.Settings.AutoDetectComplexScript = true;
renderer.Settings.AutoTag = true;
renderer.Settings.EmbedFonts = true;
renderer.Settings.EmbedCompleteFonts = true;
renderer.Settings.ExportBookmarks = Syncfusion.DocIO.ExportBookmarkType.Headings;
renderer.Settings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A3B;
PdfDocument pdf = renderer.ConvertToPDF(wordDocument);
wordDocument.Close();
string path = Data.fullPath == true ? Data.fileName : customPath + Data.fileName;
FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite);
pdf.Save(fileStream);
pdf.Close(true);
fileStream.Close();
document.Dispose();
return Ok();
}
catch (Exception ex)
{
return BadRequest();
}
}
when SFDT is saved as pdf it is losing formatting one of the cases is line spacing.
line spacing 2 in document editor:
pdf generated without the formatting:
Versions:
Dotnet core 5
Syncfusion 19.1.0.65
Thank you!!
Hi Suriya,
We got the same error when we convert the docx to pdf as you can see in the screenshots attached. Version 19.4.0.52.
best regards,
Lucas Lima
Hi Lucas,
We will check and update details by February 21, 2022.
Regards,
Suriya M.
Hi Lucas,
We tried to reproduce the reported issue at our end by using provided document, But we couldn’t
Please share us the docx file and the save code snippet that you have used at your end to convert to PDF. And also share document editor version details. It may help us to validate this issue further and provide you the solution at the earliest.
Regards,
Ajithamarlin E
Hi Ajithamarlin,
sorry for the delay, we solved this using the substitute font method on the web service side.
thank you
Thanks for your update.