We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

DWG to PDF missing some content vs TrueView-generated PDF


Saving a DWG file to PDF using Aspose.CAD for .NET 20.8 is excluding some content when compared to the PDF generated by the AutoDesk TrueView program.

Code (from https://docs.aspose.com/cad/net/converting-cad-drawings-to-pdf-and-raster-image-formats/)

using (Aspose.CAD.Image image = Aspose.CAD.Image.Load("c:\\test\\input.dwg"))
    // Create an instance of CadRasterizationOptions and set its various properties
    Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
    rasterizationOptions.PageWidth = 1600;
    rasterizationOptions.PageHeight = 1600;
    rasterizationOptions.BackgroundColor = Aspose.CAD.Color.Beige;
    rasterizationOptions.DrawType = Aspose.CAD.FileFormats.Cad.CadDrawTypeMode.UseDrawColor;
    rasterizationOptions.DrawColor = Aspose.CAD.Color.Blue;

    // Create an instance of PdfOptions
    Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
    // Set the VectorRasterizationOptions property
    pdfOptions.VectorRasterizationOptions = rasterizationOptions;

    //Export CAD to PDF
    image.Save("c:\\test\\aspose_output.pdf", pdfOptions);

Also, the Aspose output PDF includes a blank page at the start.

Here is zip file containing the input.dwg, aspose_output.pdf and trueview_output.pdf: files.zip (535.6 KB)

Is it possible for Aspose.CAD to generate a PDF closer to the TrueView-generated PDF?

Thank you


It seems to be an issue with API. A ticket with ID CADNET-1207 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.


Is there any update on this? It is still happening that a blank page is sometimes being included when converting to PDF. Here is another example DWG where this is happening: Adds blank page.zip (172.5 KB)



I have used the following sample code using Aspose.CAD for .NET 21.5 and it didn’t generate the blank PDF. Can you please check this on your end.

        using (CadImage image = (CadImage)Image.Load(sourceFilePath+ "Adds blank page.dwg"))
            CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
            rasterizationOptions.UnitType = UnitType.Millimeter;

            rasterizationOptions.PageWidth = 1600;
            rasterizationOptions.PageHeight = 1600;

            //rasterizationOptions.Layouts = new string[] { "Layout1" };

            rasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor;

            PdfOptions pdfOptions = new PdfOptions();

            pdfOptions.VectorRasterizationOptions = rasterizationOptions;

            string fileName = Path.GetFileName(sourceFilePath);
            string outputDir = Path.GetDirectoryName(sourceFilePath);
            string outputFileName = "2.pdf";
            string savePDFfilePath = outputDir + @"/" + outputFileName;
            image.Save(savePDFfilePath, pdfOptions);

2.pdf (1.2 MB)