Aspose.CAD 24.10.0 Cloud lines are converted to straight lines,and the PDF is missing within the file,Partial style conversion exception

TestDxfDocument.zip
image
image

using Aspose.CAD;
using Aspose.CAD.FileFormats.Cad;
using Aspose.CAD.ImageOptions;

namespace CAD2PDF
{
    internal class doCadToPdf
    {
        public static string run(string inputStream, String outputFilePath=null)
        {
            if (!File.Exists(inputStream)) return null;

            LoadOptions opts = new LoadOptions();
            opts.SpecifiedEncoding=CodePages.SimpChinese;
            opts.CustomFontFolders=new String[] { Path.GetDirectoryName(inputStream) };
            opts.CustomFontFolderOptions=CustomFontFolderOptions.ReplaceFolderForAll;
           
            CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
            cadRasterizationOptions.BackgroundColor=Color.White;
            cadRasterizationOptions.PageWidth=1600;
            cadRasterizationOptions.PageHeight=1600 + 105F;
            cadRasterizationOptions.AutomaticLayoutsScaling=true;
            cadRasterizationOptions.NoScaling=false;
            cadRasterizationOptions.DrawType= CadDrawTypeMode.UseObjectColor;
            PdfOptions pdfOptions = new PdfOptions();
            pdfOptions.VectorRasterizationOptions=cadRasterizationOptions;
            using (CadImage cadImage = (CadImage)Image.Load(inputStream, opts))
            {
                if (string.IsNullOrEmpty(outputFilePath))
                    outputFilePath = inputStream + ".pdf";
                cadImage.Save(outputFilePath, pdfOptions);
                return outputFilePath;
            }
    }
    }
}

@Sring65,
Hello.
There are some features we don’t support, we have created CADNET-9973 to investigate all issues with this file in details. There are also additional options like cadRasterizationOptions.PdfProductLocation (you need to have Aspose.PDF product to export PDF files the drawing may refer to), and cadRasterizationOptions.ShxFonts (e.g. some linestyles use SHX symbols), it could be helpful for us if you specify where the shape.shx file is used.

image
TestDxfDocument.zip

Added support for the directory, but it still cannot be displayed properly.

public static string run(string inputStream, String outputFilePath = null)
{
    Console.WriteLine("开始转换文件"+inputStream);
    if (!File.Exists(inputStream)) return null;
    Aspose.CAD.LoadOptions opts = new Aspose.CAD.LoadOptions();

    opts.SpecifiedEncoding = CodePages.SimpChinese;
    string[] supportPaths = new String[] { Path.GetDirectoryName(inputStream), AppContext.BaseDirectory + "Support" };
    opts.CustomFontFolders = supportPaths;
    opts.CustomFontFolderOptions = CustomFontFolderOptions.ReplaceFolderForAll;
    using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(inputStream, opts))
    {
        if (string.IsNullOrEmpty(outputFilePath))
            outputFilePath = inputStream + ".pdf";
        CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
        cadRasterizationOptions.BackgroundColor = Aspose.CAD.Color.White;
        cadRasterizationOptions.PageWidth = cadImage.Width*10;
        cadRasterizationOptions.PageHeight = cadImage.Height*10;
        cadRasterizationOptions.AutomaticLayoutsScaling = true;
        cadRasterizationOptions.NoScaling = false;
        cadRasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor;
        cadRasterizationOptions.ShxFonts = supportPaths;
        cadRasterizationOptions.PdfProductLocation = AppContext.BaseDirectory;
        cadRasterizationOptions.Layouts = new string[] { "Model" };
        PdfOptions pdfOptions = new PdfOptions();
        pdfOptions.VectorRasterizationOptions = cadRasterizationOptions;
        cadImage.Save(outputFilePath, pdfOptions);
        Console.WriteLine("已转换文件:" + outputFilePath);
        return outputFilePath;
    }
}

@Sring65,
please let us check these issues and come back with more details.

@Sring65,
here is the brief list of issues found in this test file:

  1. Export of the PdfUnderlay is available via cadRasterizationOptions.PdfProductLocation. This path should contain Aspose.Pdf.dll and corresponding license for it (Aspose.Pdf, Aspose.Total, or Conholdate.Total). The latest Aspose.Pdf version we support at the moment is 23.1.
  2. “sample binary.dxf” is unreadable, we will fix that.
  3. The linestyles used in test files require ltypeshp.shx and simplex.shx to be applied via cadRasterizationOptions.ShxFonts. But it causes error and incorrect export result because of different reasons. We will fix these issues.
  4. We have support for polylines that have bulges or variable widths but not at the same time. This is planned to implement.
  5. We don’t have support for gradient hatches, and it is unknown at the moment whether it is possible to implement. We will do additional research on this question.
  6. We support polygon mesh with None smooth only, working on fixing this issue. The support for polylines with cubic smooth seems to be possible to fix also.
  7. Only default style for Point entity is supported now, but the implementation of proper style is possible.
  8. XLine and Ray entities are present in result PDF but because of the linestyle applied for them they are almost invisible.
  9. Export of SHAPE is pending for the further investigation.