I have a file in which a picture is inserted in the form of a mathematical formula.
After converting to pdf, the image is converted to text, but I don’t need it, I need the mathematical formula to remain as an image (picture).
How can I make sure that the image is not converted to text?
Doc1.docx (12.5 KB)
Doc1.docx.pdf (20.9 KB)
If convert docx in Linux, the fonts break
Doc1_linux.docx.pdf (23.3 KB)
@PoweRDeaD The equation in your document is WMF metafile. By default it is rendered as vector image. In your case a text. You can configure Aspose.Words to render metafiles as images:
Document doc = new Document(@"C:\Temp\in.docx");
PdfSaveOptions opt = new PdfSaveOptions();
opt.MetafileRenderingOptions.RenderingMode = MetafileRenderingMode.Bitmap;
doc.Save(@"C:\Temp\out.pdf", opt);
The problem with rendering on Linux machine occur because fonts required to render the metafile are not availabe. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted . This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/