Free Support Forum - aspose.com

Chinese font and hatch logo Problem DWG To PDF

I’m used version 20.3 convert dwg to pdf. Entities contain traditional Chinese font and hatch logo,
but conversion result text doesn’t fully display and logo only displays hollow.
Excepted like F-0A1004(other apps).pdf. How do I solve it?

F-0A1004(other app).pdf (171.0 KB)
F-0A1004(v20.3).pdf (181.9 KB)

F-0A1004.zip (176.2 KB)

@gjwang_tunghosteel_com,

I have observed the issue shared by you and request you to please share the working sample code reproducing the issue on your end. We will be able to proceed further with investigation on our end on provision of requested information.

 public byte[] DwgToPdf(FileInfo sourceFile)
{
    var sourceFilePath = sourceFile.FullName;
    using (var cadImage = (CadImage)Image.Load(sourceFilePath))
    {
        var layoutWidth = cadImage.Width;
        var cadImageHeight = cadImage.Height;
        var layoutValueDictionary = cadImage.Layouts.Values;
        var layoutValues = new List<CadLayout>();
        foreach (CadLayout layoutsValue in layoutValueDictionary)
        {
            layoutValues.Add(layoutsValue);
        }

        var layouts = layoutValues.Take(1).ToArray();

        var pageWidth = layoutWidth * 1.0;
        var pageHeight = cadImageHeight * 1.0;
        var maxValue = pageWidth > pageHeight ? pageWidth : pageHeight;
        var scale = 3508.0 / maxValue;
        pageWidth *= scale;
        pageHeight *= scale;
        var rasterizationOptions = new CadRasterizationOptions
        {
            PageWidth = (int)pageWidth,
            PageHeight = (int)pageHeight,
            ContentAsBitmap = true,
            Layouts = layouts.Select(p => p.LayoutName).ToArray()
        };

        var pdfOptions = new PdfOptions
        {
            VectorRasterizationOptions = rasterizationOptions,
        };
      
        using (var memoryStream = new MemoryStream())
        {
            cadImage.Save(memoryStream, pdfOptions);
            return memoryStream.ToArray();
        }
    }
}

@gjwang_tunghosteel_com,

I have observed the issue shared by you and a ticket with ID CADNET-1060 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.

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