Code for converting to PDF after switching to 19.5



We are using Aspose.CAD version 19.2 and the following code to convert DWG, DWT and DXF to PDF:

 private void DwgDwtDxfToPdf(Stream input, Stream output)
        using (var cadImage = (CadImage) Image.Load(input))
            var has3DObjects =
                cadImage.Entities.Any(cadEntity =>
                    cadEntity.TypeName == CadEntityTypeName.FACE3D
                    || cadEntity.TypeName == CadEntityTypeName.SOLID3D);

            var cadPageSizes = CadPageSizesForA4(cadImage.UnitType);

            var rasterizationOptions = new CadRasterizationOptions
                TypeOfEntities =
                        ? TypeOfEntities.Entities3D
                        : TypeOfEntities.Entities2D,
                PageWidth = cadPageSizes.PageWidth,
                PageHeight = cadPageSizes.PageHeight,
                UnitType = cadPageSizes.UnitType,
                DrawType = CadDrawTypeMode.UseObjectColor,
                CenterDrawing = true

            cadImage.Save(output, new PdfOptions
                VectorRasterizationOptions = rasterizationOptions

We switched to 19.5 that supports .NET Standard but the code will no longer build and throws:

CadRasterizationOptions’ does not contain a definition for ‘TypeOfEntities’

Can you please guide us in porting the code to 19.5?

Thank you!



Yes, they are removed in Aspose.CAD 19.5. All primitives are drawn now, these are not needed anymore. You just need to remove usage of ‘TypeOfEntities’ and CenterDrawing as well. Please share feedback with us if there is still an issue.