Delay PDF converting time for Aspose.CAD for Java

Hello,

I have a customer in Japan who is currently evaluating Aspose.CAD for Java and have sent us question.
Can you please answer their questions?


There will take many time (3 seconds to dwg load and 21 seconds to image save ) to convert to PDF from a dwg file.
I have attached the dwg file.

How can I speed up the PDF conversion time?

Windows 10 64bit: Intel Core i7-8550U
Memory: 16GB
Jave version: 1.8.0_60

Here is the my reference sample source:

public class ConvertDWGFileToPDF {

public static void main(String[] args) {
// The path to the resource directory.
String dataDir = Utils.getDataDir(ConvertDWGFileToPDF.class) + "DWGDrawings/";
//ExStart:ConvertDWGFileToPDF
                String srcFile = dataDir + "Bottom_plate.dwg";

 com.aspose.cad.Image objImage = com.aspose.cad.Image.load(srcFile);

                // Create an instance of CadRasterizationOptions and set its various properties

CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();

                rasterizationOptions.setBackgroundColor(Color.getWhite());
                rasterizationOptions.setPageWidth(1600);
                rasterizationOptions.setPageHeight(1600);

                // Create an instance of PdfOptions
                PdfOptions pdfOptions = new PdfOptions();

                // Set the VectorRasterizationOptions property
                pdfOptions.setVectorRasterizationOptions(rasterizationOptions);

                // Export the DWG to PDF
                objImage.save(dataDir + "Bottom_plate_out_.pdf", pdfOptions);

               //ExEnd:ConvertDWGFileToPDF

}

}

Thank you in advance for your help.test6.zip (230.4 KB)

Best regards,

ComponentSource
Thomas Moon

@ThomasMBK

I have worked with the sample file and total rendering time is 18 seconds from loading till rendering. This is pretty normal time as rendering take place in memory and time is required by API for saving to PDF.

image.png (451.9 KB)

Hollo,

Thank you for your help.

Can you plase confimr customer feedback and addaitional below?


I understood but do you have any idea to speed up the PDF conversion?

Also, I have additional quistion.
Korean characters(Font name:GHS.SHX) will be garbled when converted to dwg to pdf from dwg.(Plase see attached image)
Can you plase tell me how to set Korean character?


Best regards,

ComponentSource
Thomas MoonKorean_characters.png (47.8 KB)

@ThomasMBK

In the sample code that you have shared earlier, you are already using the minimum rasterization settings. One thing that you can further do is to reduce the page width and height. However, as I said earlier that the time taken is fair enough for the shared file to render.

At present, Aspose.CAD does not support .SHX fonts. All SHX font are replaced with default TTF font on the machine where rendering is done. So, you can override style font but only with TTF font.
Also, you can specify a font path if it differs from the system default path, for example:

String customFonts = "C:\\CustomFonts\\x.d";
LoadOptions loadOptions = new LoadOptions();
loadOptions.setCustomFontFolders( new String[] { customFonts } );
loadOptions.setCustomFontFolderOptions( CustomFontFolderOptions.AddFolderForAll );
CadImage cadImage = (CadImage)Image.load(fileName, loadOptions);
for (Object style : cadImage.getStyles()) {
    ((CadStyleTableObject)style).setPrimaryFontName("Arial");
}


//Perform rendering  now