Issue rendering DXF file to PDF - Issue setting custom font?


I have a problem rendering the following file to PDF

This is the output file:

I am guessing I need to use a custom font, which I am trying using Arial Unicode MS
in the code below.

   String tempFileName = FileUtilities.getTempFile( ".pdf");

    // Create an instance of CadRasterizationOptions class
    CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();

    // Set the Entities type property to Entities3D.


    // Set Layouts
    rasterizationOptions.setLayouts(new String[] {  "Model" });

    // Set Graphics options

    // Create an instance of CadRasterizationOptions and set its various properties

    // Iterate over the items of CadStyleDictionary
    for (CadStyleTableObject style : (Iterable<CadStyleTableObject>)image.getStyles())
        // Set the font name
        style.setPrimaryFontName( "Arial Unicode MS");

    // Create an instance of PDF options class
    PdfOptions pdfOptions = new PdfOptions();
    pdfOptions.setVectorRasterizationOptions(rasterizationOptions);, pdfOptions);

I also enclose a copy of the font file


I guess what might be missing is an API to specify a custom folder where to load the fonts from
like the one other Aspose Products (Words, Slides, etc…) provide



Can you please share generated result along with environment detail so that we may further investigate to help you out.


This is the output file:

As you can see on the bottom left, asian text is not correctly displayed, but you can
instead see invalid characters

I am running this code on an AWS lambda image running Amazon Linux



I have worked with the file shared by you and have been able to observe the issue specified. An issue with ID CADJAVA-467 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


I see in
that CADJAVA-467 has been fixed.

I tried with the new version and got the same results.
I suspect I might have to load the document using some special options to maybe pass
the location of a font file, like I do for other Aspose products … I also see in the release notes
that some font API have been added.

Do you know how to load the referenced file and obtain the correct PDF?



I have observed your comments. I like to inform that for correct rendering of Asian characters, you have to specify codepage on image loading. For the attached sample you have to specify Japanese codepage.
instead of using following code snippet

: CadImage cadImage = (CadImage) Image.load(path+“native-cad-foreign-language.dxf”);

you should write:

CadImage cadImage = (CadImage)Image.Load(path+“native-cad-foreign-language.dxf”, new LoadOptions() { SpecifiedEncoding = CodePages.Japanese }))

Please share feedback with us if there is still an issue.



I can see that by specifying the Japanese code-page, I get the correct PDF for this input file, but I do not know the image code-page in advance. We process arbitrary CAD files. Is there a way to determine which code-page parameter I should pass?



I have observed your comments and regret to inform that it is not possible right now. But it is in progress and we will implement this soon. For reference i have linked this thread with ticket CADNET-810 so that you may be notified when this feature will be available.