Converting Chinese or Kanji text file result in blocks in pdf file

Using groupdocs converter 22.8 version to convert chinese or kanji text file results in blocks in pdf file.

kanjiconversion.zip (26.6 KB)

@Ash_pot

Please take a look at these PDF results.zip (16.9 KB). We cannot reproduce this issue at our end.
Make sure that the font is installed on your machine. Could you please share all details regarding your development or deployment environment? Could you please also share a list of installed fonts on the machine? Also share the conversion code.

I thought groupdocs is automatically handling that. I do not have any fonts installed in my local machine or on liberty server. Can you please guide me how to install fonts in local machine or in WebSphere liberty server?

1 Like

@Ash_pot

Installing Fonts on a Local Machine:

  1. Download the font file (usually in .ttf or .otf format) to your computer
  2. Locate the downloaded font file and double-click on it
  3. A preview of the font will be displayed, along with an “Install” button. Click on “Install” to install the font on your local machine
  4. The font should now be installed and available for use in various applications on your computer

Installing Fonts in WebSphere Liberty Server:

  1. Copy the font file (usually in .ttf or .otf format) to a directory within your WebSphere Liberty server’s file system. For example, you can create a “fonts” directory inside the server’s installation directory
  2. Open the server.xml file located in the Liberty server’s configuration directory
  3. Within the element, add a element to define the font library. For example:
<library id="fontLibrary">
   <fileset dir="${server.config.dir}/fonts" includes="*.ttf"/>
</library>
  1. Save the server.xml file
  2. Restart the WebSphere Liberty server for the changes to take effect
  3. The installed fonts should now be available for use within the applications deployed on the server

Remember to ensure that the fonts you install are properly licensed for use in your environment.

1 Like

@atir.tahir
can we have 'fonts ’ directory outside of ${server.config.dir} like may be /usr/share/fonts location (having rwx permissions)?
Is it mandatory to add files/fonts directory insides the server’s installation directory?

@Ash_pot

We have getFontDirectories() in ConverterSettings class. Please take a look at the API references. You can specify custom font directories.

@atir.tahir
In my case, font directory will be having only double byte character fonts like CJK (Chinese, Korean, Japnese).

Will passing font directory to converter work in other cases where CJK fonts not there?


ConverterSettingsProvider csp = new ConverterSettingsProvider(){
@Override
public ConverterSettings get() {
// TODO Auto-generated method stub
ConverterSettings cs= new ConverterSettings();
List fontDir=cs.getFontDirectories();
logger.debug(“get all font directories : “+cs.getFontDirectories());
fontDir.add(”/managefiles/additional-server-files/fonts”);
logger.debug(“Added new directory: /managefiles/additional-server-files/fonts”);
cs.setFontDirectories(fontDir);
logger.debug(“font directory set”);
logger.debug("After addition get font directories : “+cs.getFontDirectories());
}
};
logger.debug(”***** Font directories outside : "+csp.get().getFontDirectories());
Converter converter = new Converter(tempFile.getAbsolutePath(), csp);

Does above code look good?

@Ash_pot

It is expected to work fine. You can try the conversion by passing the font directory, and if the issue persists, kindly let us know. As demonstrated in this message, we were able to successfully convert the source file to PDF.

@atir.tahir : Above test failed. Groupdocs Converter unable to find the fonts set in particular location i.e. ‘/managefiles/additional-server-files/fonts’ directory. After conversion, pdf file still showing blocks.

Installing fonts locally worked for me too but on server by passing font directory it failed.

Can you please take a look on your end.

@Ash_pot
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): CONVERSIONJAVA-2068

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.
We’ll let you know if any further details are required.

@atir.tahir:
Do you have steps to Install fonts in Weblogic Server? like the steps for installing fonts in local machine and on webSphere Liberty, as you provided in earlier post.

1 Like

@Ash_pot

Installing fonts in WebLogic Server is a bit different from WebSphere Liberty Server. In WebLogic Server, you typically don’t install fonts directly within the server’s configuration. Instead, you can make fonts available to your web applications deployed on WebLogic Server. Here’s how you can do it:

  1. Prepare Your Font Files:
    Obtain the font files you want to install in a format like .ttf or .otf.

  2. Place Fonts in a Directory:
    Create a directory where you will store your font files. This can be on the server or any other location accessible to your application. For example, you can create a directory called “fonts” within your web application’s directory.

  3. Configure Font Path in Your Application:
    You need to configure your web application to look for fonts in the directory where you placed them. This can be done in your web application’s code or configuration. For example, in a Java web application, you can set the font directory using a system property or configuration file.

  4. Use the Fonts in Your Application:
    Once you have configured the font directory in your application, you can use these fonts in your application’s CSS or HTML files. Specify the font names in your CSS styles.

  5. Deploy Your Application:
    Deploy your web application to WebLogic Server as you normally would. Make sure the fonts directory is included in your application package if it’s not located on the server itself.

  6. Restart WebLogic Server (if necessary):
    If you made changes to your web application or server configuration, you might need to restart WebLogic Server for the changes to take effect.

  7. Test the Fonts:
    Verify that the fonts are working as expected in your web application. You can do this by accessing your application through a web browser and checking that the specified fonts are being used.

Remember that WebLogic Server itself doesn’t have a specific mechanism for installing fonts like some other software platforms. Instead, fonts are typically managed and used within the context of your web applications running on the server.
Please note that the steps we provided are the standard approach for making fonts available to web applications deployed on WebLogic Server. However, depending on your specific use case and requirements, there may be some alternate steps.

@atir.tahir:
I also encountered the same problem.
But adding fonts to the system is not allowed on my server.
I am trying to add a font directory through the ConverterSettingsProvider. However, as it is a jar package, the fonts directory under resource cannot be found. Have you encountered similar problems and proposed solutions? Or can I import fonts by passing in InputStream?

@capAlvin

You can only set custom font folder. And this folder can be anywhere in the storage (e.g. not needed to be a system folder).
Please take a look at the following API references:

@atir.tahir:
Thank you very much for your answer
I know this API, but my situation is that my font folder can only be placed in one zip file (. jar). Is there anything I can do about this situation?
like :
image.png (2.2 KB)
Or can you tell me how you find the font folder in your code?
by new File(String) ?

@capAlvin

We are investigating this scenario. Your investigation ticket ID is CONVERSIONJAVA-2236.

@atir.tahir:
How should I confirm CONVERSIONJAVA-2236 status?

@capAlvin

It’s an internal ticket, and we’ll keep you informed of any developments. The latest update suggests extracting the fonts to the temp folder and utilizing them. The key question is, do you have the necessary access to the temp folder? Currently, this is the only solution supported by the API.

@atir.tahir:
Due to some special reasons, these fonts are saved in a zip file and cannot be decompressed. So we can’t give a file path as usual.
I can ensure that I have access to the zip file

@capAlvin

Yes, a font folder must be provided.