Aspose.Words.Document Font issue for PDF

I’m using .net core api with 6.0 framework in windows system. And I’m using latest version for Aspose.Words. I want to download pdf with Japanese text/fonts. I’m trying to download pdf on Docker. But Japanese font not able to support for Linux.

1.Can you please tell me the DockerFile configuration and Can you please share the .ttf file with fontName?
2. I’m trying to Japanese font file using MemoryStream. Please provide the How to use font file with MemoryStream?

@Prachi_Mankar Most likely the problem occurs because the fonts required for rendering document are not available on the machine where document is converted to PDF. 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 lean where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/

In your case you can copy the required fonts into your docker image and use them. If you need to load fonts from stream you can use StreamFontSource. Please see our documentation for more information:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/#loading-fonts-from-stream

I’ve tried both solution which is you mentioned. Can you please tell me the Docker solution?

@Prachi_Mankar The solution for docker is the same Simply copy the required fonts into the folder in your docker image and then specify this folder as fonts folder source in your code. Also, the following article might be useful for you:
https://docs.aspose.com/words/net/installing-truetype-fonts-on-linux/

Thanks @alexey.noskov! I’ve one more question Can you please tell me, How to use font file using MemoryStream, please provide the example, so I can understand.

@Prachi_Mankar If you need to load fonts from stream you can use StreamFontSource. Please see our documentation for more information:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/#loading-fonts-from-stream