Idea have been changed -Xss512m -Xms16000m -Xmx16000m
demo (2).zip (784.1 KB)
package com.aspose.cad.examples.DWGDrawings;
import com.aspose.cad.*;
import com.aspose.cad.examples.Utils.Utils;
import com.aspose.cad.imageoptions.CadRasterizationOptions;
import com.aspose.cad.imageoptions.PdfOptions;
import java.awt.Image;
public class ConvertDWGFileToPDF {
public static void main(String[] args) {
// The path to the resource directory.
long s = System.currentTimeMillis();
System.out.println();
String dataDir = Utils.getDataDir(ConvertDWGFileToPDF.class) + "DWGDrawings/";
//ExStart:ConvertDWGFileToPDF
String srcFile = dataDir + "ddd.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(4000);
rasterizationOptions.setPageHeight(4000);
rasterizationOptions.setAutomaticLayoutsScaling(true);
// Create an instance of PdfOptions
PdfOptions pdfOptions = new PdfOptions();
// Set the VectorRasterizationOptions property
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
// Export the DWG to PDF
objImage.save(dataDir + "ddd.pdf", pdfOptions);
//ExEnd:ConvertDWGFileToPDF
long e = System.currentTimeMillis();
System.out.println("Time taken: " + (e - s) + " ms");
}
}