Conversion to PDF fails


#1

The following code fails:

        try {

            CadImage image = (CadImage) Image.load(filePath);

            // Create an instance of CadRasterizationOptions class
            CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();

            // Most CAD are in landscape, so use 4x standard landscape size
            rasterizationOptions.setPageHeight(DefaultPageWidth * 2);
            rasterizationOptions.setPageWidth(DefaultPageHeight * 2);

            rasterizationOptions.setAutomaticLayoutsScaling(true);
            rasterizationOptions.setNoScaling(false);
            rasterizationOptions.setContentAsBitmap(true);

            // Set Layouts
            rasterizationOptions.setLayouts(new String[]{"Model"});

            // Set Graphics options
            rasterizationOptions.getGraphicsOptions().setSmoothingMode(SmoothingMode.HighQuality);
            rasterizationOptions.getGraphicsOptions().setTextRenderingHint(TextRenderingHint.AntiAliasGridFit);
            rasterizationOptions.getGraphicsOptions().setInterpolationMode(InterpolationMode.HighQualityBicubic);

            // Create an instance of CadRasterizationOptions and set its various properties
            rasterizationOptions.setBackgroundColor(com.aspose.cad.Color.getWhite());

            // Create an instance of PDF options class
            PdfOptions pdfOptions = new PdfOptions();
            pdfOptions.setVectorRasterizationOptions(rasterizationOptions);

            image.save(filePath + ".pdf", pdfOptions);

        } catch (Exception e){
            System.out.println("Exception:\n"+ e.toString());
        }

Using any of the seven files included in this ZIP file:

I am using Aspose CAD 19.7

The conversion never terminates for this file:

which used to work on a previous version of Aspose CAD


#2

@russ.nichols,

I have been able to observe issue and created an issue with ID CADJAVA-527 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.


#3

In addition to the files cited above, this file is an example of a class of 2013/2014 CAD files that fails to process correctly with Aspose, this kind of file produces an ImageLoadException within Aspose:

We also have a few files which cause an ImageSaveException within Aspose, like this file:

In your investigation please test against these 2 files as well as the previously supplied files in this thread. Thanks,

Mike


#4

@michaelpcard,

I have been able to observe issue and created an issue with ID CADJAVA-532 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.


#5

Hey thanks @Adnan.Ahmad. I forgot to mention there is a third kind of error I have seen with Aspose, there are some .dwg files which cause Aspose to go into an infinite loop. The following is a file that will cause this error:


#6

@michaelpcard,

I have worked with source file shared by you and unable to observe any infinite loop issue. I have also successfully generated PDF file. Can you please share environment details along with which version you are using on your end.resultdwg.pdf (882.2 KB)