We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word to PDF conversion loosing fonts and format in PDF

We are using Aspose.Word and Aspose.PDF both.


We are having some word documents which contains many fonts and formatting. The office version is 2010 & above. We create document on different machine and conversion happens on different machine.

We do conversion on different machine where we sending this document and convert into PDF format. We tried different approaches by saving a file, memorystream but result is same.

After analsysis, got some information about embed fonts in document. Can you please share any sample code or example. That will be a great help.

using (MemoryStream dstStream = new MemoryStream())
{
var doc = new Aspose.Words.Document(new MemoryStream(formDownload.FormContent.ToArray()));
doc .Save(dstStream, Aspose.Words.SaveFormat.Pdf);
}


Appreciate !!
Sohan

Hi Sohan,


Thanks for your inquiry. Please use PdfSaveOptions class of Aspose.Words for saving word document to PDF. It includes EmbedFullFonts property to embed full fonts in the resultant PDF. Please check following sample code snippet for your reference, hopefully it will help you to accomplish the task.

Document doc = new
Document(“input.docx”);<o:p></o:p>

PdfSaveOptions option = new PdfSaveOptions();

option.EmbedFullFonts = true;

doc.Save("output.pdf",option);


Best Regards,

Thank you Ahmad, I will try and get back to you on this soon. Thanks !