Free Support Forum - aspose.com

Export to pdf cannot render chinese

my code:

            var loadOptions = new LoadOptions() {
                SpecifiedEncoding = CodePages.SimpChinese,
            };
            using (Image image = Image.Load("/Users/imac/Projects/CADExport/排产单 -  样板.dxf", loadOptions))
            {
                var cadImage = (CadImage)image;

                foreach (CadStyleTableObject style in cadImage.Styles)
                {
                    Console.WriteLine(style.StyleName + " - " + style.PrimaryFontName);
                }


                CadRasterizationOptions dwfRasterizationOptions = new CadRasterizationOptions();                

                dwfRasterizationOptions.PageHeight = 1000;
                dwfRasterizationOptions.PageWidth = 1000;

                PdfOptions pdfOptions = new PdfOptions();
                pdfOptions.VectorRasterizationOptions = dwfRasterizationOptions;

                image.Save("/Users/imac/Projects/CADExport/排产单 -  样板.pdf", pdfOptions);
            }

os: macos
aspose.cad version: latest

the font i used is KaiTi and this font is installed into system already. but i have noticed that cadImage.Styles cannot enumerate KaiTi, only has Arial.

my dxf
排产单 - 样板.dxf.zip (39.4 KB)

chinese view in autocad just fine.
image.png (199.9 KB)

but when i export to pdf using aspose.cad, chinese looks like this.
image.png (55.7 KB)

font has been installed into system.
image.png (165.1 KB)

Kaiti.ttf.zip (6.4 MB)

@liesauer,

I have observed the details shared by you. An issue with ID CADNET-1026 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.

1 Like

@liesauer,

We have investigated the issue on our end. Can you please check on your end that where the font was installed. The font must be installed in the folder: / Library/Fonts.

i checked just now, and i found the font is under /Library/Fonts/Microsoft, and i copy the font to both /Library/Fonts and ~/Library/Fonts. The first time, i got error message “Fontconfig warning: ignoring UTF-8: not a valid region tag”, so i copy the following lines into my .bash_profile and restart the bash
export LC_PAPER=en_US.UTF-8
export LC_ADDRESS=en_US.UTF-8
export LC_MONETARY=en_US.UTF-8
export LC_NUMERIC=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_TELEPHONE=en_US.UTF-8
export LC_MESSAGES=en_US.UTF-8
export LC_IDENTIFICATION=en_US.UTF-8
export LC_COLLATE=en_US.UTF-8
export LC_MEASUREMENT=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LC_TIME=en_US.UTF-8
export LC_NAME=en_US.UTF-8

the error gone, but still no chinese in the pdf, my dxf is utf-8 encoding.
btw, does the font must be installed in /Library/Fonts? because the fonts under /Library/Fonts/Microsoft can be found by the os and autocad.

@liesauer,

Thank you for your kind feedback. We will share further updates with you as soon as they will be available.

@mudassir.fayyaz how is it going? do you still working on this issue?

@liesauer,

The issue is still in progress and we will apprise you a soon as the issue will be fixed.

The issues you have found earlier (filed as CADNET-1026) have been fixed in this update.