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

Free Support Forum - aspose.com

Fonts not copying in RenderNode when trying to save cell as Image

I am using the RenderNode function as found here https://github.com/aspose-words/Aspose.Words-for-Java/blob/master/Examples/src/main/java/com/aspose/words/examples/rendering_printing/RenderShapes.java#L208.

It works fine except the font of the Node being added to the Shape is not preserved. Other style properties such as bold etc. are however. Am I missing something?

@amankapur91,

Please ZIP and attach your input Word document you are getting this problem with here for testing. Also, please mention the node that you want to render. We will then investigate the issue on our end and provide you more information.

So I found the FontSettings.getDefaultInstance().setFontsFolder method, and set the folder and the fonts are rendering, however I am using custom fonts for a local language. For most cases this is fine, but as you can see in the files attached the the generated png and the cell text dont match exactly. The characters are overlapping which is not happening in the word document. Not sure why.

Attached Image, Font File, and Word Document.
files.zip (105.0 KB)

Also, images placed inside the Table cell also don’t get rendered into the final image, only text does.

@amankapur91,

I am afraid, we are unable to extract/view the PNG file on our end. Please share the PNG file again here for testing. Do you see the same problem on your end when converting “test-3.docx” to PDF format by using the following code?

Document doc = new Document("D:\\temp\\test-3.docx");
doc.save("D:\\temp\\awjava-18.10.pdf");

If yes, please also attach the generated PDF file here for further testing. Thanks for your cooperation.

test.png (2.3 KB)

test.pdf (26.2 KB)

so the pdf looks ok, however renderNode doesn’t have the same output image (ive attached test png) which is created by running RenderNode on that cell.

@amankapur91,

We are working on your query and will get back to you soon.

@amankapur91,

But, we have converted this test-3.zip (12.5 KB) document to PDF format on our end by using MS Word 2016 and Aspose.Words for Java 18.10 and were unable to get correct foreign (non-English) language characters. See the following PDF files:

We did install the fonts you shared.

Please also ZIP and attach the following font file here for further testing:

  • SHREE-DEV-0708E