Hi ,
I have a .Net core Api that converts source docx document to either pdf or doc using Aspose.Words ,
On windows system this works as expected however when running on my Ubuntu Vm , I notice some rendering issues with the converted Pdf however when the same docx document is converted to doc in ubuntu I see the output document as expected, Am I missing something here ,Also I went through
https://docs.aspose.com/words/net/installing-truetype-fonts-on-linux/
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/
https://reference.aspose.com/words/net/aspose.words.fonts/fontsettings/setfontssources/
I guess if this is working fine with .doc conversion this should work the same for pdf as well I don’t see the need to explicitly add and get fonts in this scenario , Please suggest .Attaching the sample source document and output for reference
Awaiting your response
Conversion Code :
public byte[]? ConvertDocument(IFormFile file, string format)
{
using (MemoryStream stream = new MemoryStream())
{
file.CopyTo(stream);
var document = new Document(stream);
MemoryStream outputStream = new MemoryStream();
switch (format.ToLower())
{
case "pdf":
PdfSaveOptions pdfsaveOptions = new PdfSaveOptions();
pdfsaveOptions.SaveFormat = SaveFormat.Pdf;
pdfsaveOptions.EmbedFullFonts = true;
pdfsaveOptions.EmbedAttachments = true;
pdfsaveOptions.Compliance = PdfCompliance.Pdf20;
document.Save(outputStream, pdfsaveOptions);
return outputStream.ToArray();
case "doc":
document.Save(outputStream, SaveFormat.Doc);
return outputStream.ToArray();
default:
return null;
}
}
}
Error Samples.zip (1.2 MB)