Free Support Forum - aspose.com

Chinese can not display right when export to DWG

when I export DWG to PDF use Aspose.CAD some Chinese can’n display . Code like as below:
image.png (40.3 KB)
dwg file is
A3 A4.zip (235.0 KB)

@lihaiwu2005

Can you please ensure if the fonts used in your DWG file are actually available on machine where you are performing rendering? Please share the used sample code along with generated output and API version information. Please also try using latest version of Aspose.CAD on your end if you are using older version.

Yes, I am sure that the fonts is in my machine when I open this in AutoCAD environment.

the code pls see below:

License license=new License();
license.setLicense(“D:\Projects\apose\Aspose.Cad.lic”);
// The path to the resource directory.
String dataDir = Utils.getDataDir(ExportSpecificDWGLayoutToPDF.class) + “DWGDrawings/”;
//ExStart:ExportSpecificDWGLayoutToPDF
String srcFile = dataDir + “A3 A4.dwg”;
LoadOptions options =new LoadOptions();
options.setCustomFontFolders(new String[]{“C:\Program Files\Autodesk\AutoCAD 2016\Fonts”});
options.setSpecifiedEncoding(CodePages.SimpChinese);

	CadImage image =(CadImage) Image.load(srcFile,options);

    // Create an instance of CadRasterizationOptions and set its various properties
    CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
    rasterizationOptions.setPageWidth(1600);
    rasterizationOptions.setPageHeight(1600);
    // Specify desired layout name
	CadLayoutDictionary layouts = image.getLayouts();



	List <String>lays=new ArrayList<String>();

	Dictionary.Enumerator<String, CadLayout> itr = layouts.iterator();
	while (itr.hasNext())
	{
		KeyValuePair<String, CadLayout> lay = itr.next();
		lays.add(lay.getKey());


	}
    rasterizationOptions.setLayouts(lays.toArray(new String[0]));

    // Create an instance of PdfOptions
    PdfOptions pdfOptions = new PdfOptions();



    // Set the VectorRasterizationOptions property
    pdfOptions.setVectorRasterizationOptions(rasterizationOptions);

    // Export the DWG to PDF
    image.save(dataDir + "A3_A4 ExportSpecificLayoutToPDF_out_.pdf", pdfOptions);
//ExEnd:ExportSpecificDWGLayoutToPDF
    }

I also try out API version is 20.09 and 20.10.

@lihaiwu2005

I have created an issue with ID CADJAVA-919 in our issue tracking system to further investigate the Chinese text rendering issue. We will share the feedback with you as soon as the issue will be fixed.

Fine, if you have any update, please share me .

@lihaiwu2005

This issue has just been added in our issue tracking system and is pending for investigation in issues queue. We request for your patience and will share the good new with you as soon as the issue will be fixed.