When saving documents as PDF using java words Japanese language does not render properly in PDF

Hello ,
we are testing linq report engine functionality of Aspose word java for document generation. When saving documents as PDF using java words Japanese language does not render properly in PDF
Syntax

templateDocument.save(outStream,saveFormat); //outStream is outputStream and saveFormat is PDF,docx etc 

We have also tried using simple syntax

doc.save("src/main/resources/documents/hyper.pdf");

Aspose java word version : 24.10

Payload for generating document

{
  "node": {
    "cusStringMap": {
      "190": "Lavar a máquina en frío",
      "191": "Lavage en machine à froid",
      "192": "Maschinenwäsche kalt",
      "193": "洗濯機コールド",
      "194":  "はい。"
    }
  }
}

We have attached template file for your ref and also generated document output PDF file in which Japanese language is not getting properly rendered. Please check

stringMap.pdf (17.3 KB)

stringMap 2.docx (11.7 KB)

@Ajinkya281991 I cannot reproduce the problem on my side. The problem on your side might occur because the fonts used the documents are not available in the environment where documents are converted. To build an accurate document layout the fonts are required. If Aspose.Words cannot find the fonts used in the document the fonts are substituted. This might lead into the layout differences due to differences in fonts metrics. You can implement IWarningCallback to get a notification when font substitution is performed.
The following articles can be useful for you:
https://docs.aspose.com/words/java/specify-truetype-fonts-location/
https://docs.aspose.com/words/java/install-truetype-fonts-on-linux/

We have one more question
We saw that linq report has doc tag to embed a document. Is there a way to add OLE object using linq report engine, If not is it in the road map ?

Please send your findings

@Ajinkya281991 No, unfortunately, there is no way to insert embedded OLE objects into the report using LINQ Reporting Engnine.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-17245

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hello , For Japanese language issue
On windows issue is not getting produce , only on linux machine issue is getting produce

We have tried 2 solutions
Sol 1:

On Ubuntu, use Synaptic Package Manager to find and install the ttf-mscorefonts-installer package.

We have installed Synaptic Package Manager on Linux and installed ttf-mscorefonts-installer package
But still issue continues for Japanese

Sol2:

Copying Fonts from a Windows Machine

We copied windows font to linux machine and gave path to
FontSettings.setFontsFolder(“path to fonts”, true);

This is also giving same issue

For ref followed this link:
https://docs.aspose.com/words/java/install-truetype-fonts-on-linux/

Could you please test the above code on ubuntu and let us know possible solution for above issue.

@Ajinkya281991 Could you please save your output document as DOCX and as PDF and attach the documents here for our reference? We will check the issue and provide you more information.

Please find the requested files in the attachments
Json Payload

{
  "node": {
    "cusStringMap": {
      "190": "Lavar a máquina en frío",
      "191": "Lavage en machine à froid",
      "192": "こんにちは",
      "193": "洗濯機コールド"
    },
    "url": "C371387"
  }
}

Attached files
1: input template
2: output files as pdf and docx

stringMap_op.docx (23.0 KB)

stringMap_pdf_op.pdf (39.4 KB)

stringMap_template.docx (11.7 KB)

@Ajinkya281991 Thank you for additional information. As I can see the output looks correct in DOCX document. So the problem is definitely with fonts. if convert your output to PDF with required fonts, the output looks fine:
out.pdf (54.5 KB)

If convert the same document without fonts the output looks incorrectly:
out_without_fonts.pdf (25.7 KB)

As I can see the following fonts are used in your output:

In my output the following fonts are used:

Thanks for reply,
What is the possible solution to fix this issue
bcoz we have tried solution given below

Sol1:

On Ubuntu, use Synaptic Package Manager to find and install the ttf-mscorefonts-installer package.

Sol2:

Copying Fonts from a Windows Machine

link ref: Install TrueType Fonts on Linux in Java|Aspose.Words for Java
Please let us know possible solution so that we can fix this issue.

@Ajinkya281991 Please make sure you specified the folder where fonts are installed or copied as a font source:
https://docs.aspose.com/words/java/specify-truetype-fonts-location/

Thanks for your response,
We have followed below approach and above issue is resolved.

Copying Fonts from a Windows Machine

An easy and quick way to get TrueType fonts on a Linux system is to copy .TTF and .TTC files from the C:\Windows\Fonts directory on a Windows machine to some directory on your Linux machine. You do not need to install or register these fonts on Linux in any way; you just need to specify the location of the fonts using the FontSettings class in Aspose.Words

**Documentation mention **
Different Linux distributions may store fonts in different folders. Aspose.Words looks for fonts in several locations. By default, Aspose.Words looks for the fonts in all of the following locations: /usr/share/fonts, /usr/local/share/fonts, /usr/X11R6/lib/X11/fonts. This default behavior will work for most Linux distributions, but it is not guaranteed to work all of the time, in which case you might need to specify the location of true type fonts explicitly. To do this, you need to know where TrueType fonts are installed on your Linux distribution.

Q1: After specifying custom font folder path in font setting and providing it template like
eg. doc.setFontSettings(fontObkect);
Will the aspose still look in the above location for the fonts ?

Q2: Warning from documentation
“Verify whether font licensing is required, and read the EULA carefully before installing MS Fonts on any Linux operating system.”
Is this for copying font approach from windows and placing them in linux machine
OR is this for installing trueType in Linux system approach
For ref: Install TrueType Fonts on Linux in Java|Aspose.Words for Java

@Ajinkya281991

You can specify custom font source in default font setting once per application domain and Aspose.Words will use these fronts for rendering all document:

FontSettings.getDefaultInstance().setFontsSources(new FontSourceBase[] { new SystemFontSource(),  new FolderFontSource("C:\\Temp\\fonts", true) });

For both. You should keep in mind the EULA of fonts that will be used for rendering documents in your application.

As per above discussion above copying Microsoft font from windows to Linux system works on local system.
Q1: Our question was when the application is containerize the application how we can provide these fonts to application as the folder size is above 400 MB ?
Any suggestion on this please

Is their any way that we can zip/ jar the fonts and send that path to FontSettings?

@Ajinkya281991 Unfortunately, Aspose.Words does not read fonts packed into JAR or WAR. So in your case you should either copy the fonts into the OS file system or use StreamFontSource or MemoryFontSource to get fonts from your JAR/WAR file and provide them to Aspose.Words.

Hello,
We are facing challenges with implementing null checks in if tag with
json as payload

{
"node": {
"value":null,
"arr":[
        {
"arrVal":null
        },
        {
"arrVal":"1"
        },
        {
"val":"123"
        }
    ]
  }
}

Attaching input template and its generated output
Expected behavior:
1: First simple if tag should return null but it returns not null

stringMap 4.docx (11.9 KB)

Jtest_out.docx (12.6 KB)

Can you please guide us how to implement null checks ?

@Ajinkya281991 the similar question was just answered here:
https://forum.aspose.com/t/linq-reporting-engine-null-values-and-operators/294926/4

You can use the same technique in your case.