DWG to PDF - The chinese characters appear as black squares or gibberish

i want use Aspose.CAD to convert DWG to PDF, but i have a trouble, the Chinese which in my DWG file,but a few characters appear as black squares, or gibberish

I set coding as Simple Chinese


This Topic is created by mudassir.fayyaz using the Email to Topic plugin.

@kesinwang,

I have observed the information shared by you and request you to please share the source DWG file, generated PDF and used sample code. Before sharing the information, please try using Aspose.CAD for .NET 18.3 on your end as well.

there are source DWG files

temp.zip (167.1 KB)
微信图片_20180322215908.png (121.7 KB)
iHaier图片20180322220058.png (21.5 KB)

if you have a skype account?

@kesinwang,

I have worked with DWG file shared by you and have been able to observe blocked characters for Chinese characters in exported PDF. An issue with ID CADJAVA-348 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.

may the problem be solved in a week ? It’s important to our.

@kesinwang,

I have verified from our issue tracking system and have verified the issue status. The issue shared has been added recently and is awaiting investigation in waiting queue. We will share good news with you soon. I request for your patience.

hi
i see the issues is closed, and i download new version jar all is reday?

@kesinwang,

Can you please try using following sample code on your end and share the results.

  public void TestPdfExportIssue() 
       { 
           string path = "C:\\Users\\Muhammad\\Downloads\\temp\\"; 
           string srcFile = path + "demo1000.dwg"; 
           LoadOptions loadOptions = new LoadOptions(); 
           loadOptions.SpecifiedEncoding = CodePages.SimpChinese; 
           // Here you should use loadOptions in Image.Load method 
           CadImage image = (CadImage)Image.Load(srcFile, loadOptions); 
           CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions(); 
           rasterizationOptions.BackgroundColor = Color.White; 
           rasterizationOptions.PageWidth = 1600; 
           rasterizationOptions.PageHeight = 1600; 
           PdfOptions pdfOptions = new PdfOptions(); 
           pdfOptions.VectorRasterizationOptions = rasterizationOptions; 
           image.Save(path + "out_put" + ".pdf", pdfOptions); 
       }

hi
I try using fllowing code and the issue still exists.

    String path = "I:\\cadtopdf\\Aspose.CAD-for-Java-master\\Examples\\src\\main\\resources\\DWGDrawings\\temp\\"; 
    String srcFile = path + "demo1000.dwg"; 
    LoadOptions loadOptions = new LoadOptions(); 
    loadOptions.setSpecifiedEncoding(CodePages.SimpChinese); 
    // Here you should use loadOptions in Image.Load method 
    CadImage image = (CadImage)Image.load(srcFile, loadOptions); 
    CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions(); 
    rasterizationOptions.setBackgroundColor(Color.getWhite());
    rasterizationOptions.setPageWidth(1600);
    rasterizationOptions.setPageHeight(1600);
    PdfOptions pdfOptions = new PdfOptions(); 
    pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
    image.save(path + "out_put" + ".pdf", pdfOptions);

@kesinwang,

I have used the above code sample using latest Aspose.CAD for Java 18.3 on my end and the generated output is fine. Please try using specified version on your end.

output.pdf (124.2 KB)

where is the 18.3 for java’s download url

i used 18.3 jar from http://maven.aspose.com/repository/webapp/search/artifact/?2&q=aspose-cad ,but issue still exists.

@kesinwang,

Have you observed the generated PDF file shared by me in my previous post. I used Aspose.CAD for Java 18.3 in Windows 7 x64 with JDK 1.7_79 on my end. Did you use the updated code sample shared by me as well? Can you please share the details of environment as well on your end along with generated PDF for reference.

这个问题现在解决了吗?我也遇到这个问题

@bbd,

您能否尝试使用最新的Aspose.CAD for Java 19.7使用以下示例代码。

public void TestPdfExportIssue()
{
string path = "C:\Users\Muhammad\Downloads\temp\";
string srcFile = path + "demo1000.dwg";
LoadOptions loadOptions = new LoadOptions();
loadOptions.SpecifiedEncoding = CodePages.SimpChinese;
// Here you should use loadOptions in Image.Load method
CadImage image = (CadImage)Image.Load(srcFile, loadOptions);
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.BackgroundColor = Color.White;
rasterizationOptions.PageWidth = 1600;
rasterizationOptions.PageHeight = 1600;
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = rasterizationOptions;
image.Save(path + "out_put" + ".pdf", pdfOptions);
}

你好,已经使用Aspose.CAD for Java 19.7和提供的示例,在linux环境仍旧有中文乱码问题

@bbbd,

我已观察到您的意见并要求您提供最新的DWG以及生成的输出。 还请分享您的Java和操作系统详细信息。