使用jar为 aspose-cad-18.3-jdk16
例子如下:
public static void main(String[] args) {
String fileName = "3111.dwg";
// The path to the resource directory.
String dataDir = "d:\";
//ExStart:ConvertDWGFileToPDF
String srcFile = dataDir + fileName;
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(objImage.getWidth() + 100 );
rasterizationOptions.setPageHeight(objImage.getHeight() + 100);
// Create an instance of PdfOptions
PdfOptions pdfOptions = new PdfOptions();
// Set the VectorRasterizationOptions property
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
// Export the DWG to PDF
objImage.save(dataDir + "3111.pdf", pdfOptions);
//ExEnd:ConvertDWGFileToPDF
}
问题:
复杂的CAD图转换后出现了2次,参考附件 问题图示问题图示.jpg (135.7 KB)
(图片上面是原图,但是下面红框又出现了2个一样的图)