DGN 오토캐드 내보내기

DGN 오토캐드 형식을 PDF로 내보내기

Aspose.CAD for Java API는 DGN 오토캐드 파일을 로드하고 PDF 형식으로 변환하는 기능을 도입했습니다. DgnImage 클래스가 이 목적을 제공합니다.

기존 DGN 파일을 DgnImage로 로드해야 합니다. CadRasterizationOptions 클래스의 인스턴스를 생성하고 다양한 속성을 설정합니다. PdfOptions 클래스의 인스턴스를 생성하고 CadRasterizationOptions 인스턴스를 전달합니다. 이제 DgnImage 클래스 인스턴스의 save 메서드를 호출합니다.

샘플 코드

다음은 DGN을 PDF 형식으로 변환/내보내는 코드 예제입니다.

// load an existing DGN file as DgnImage.
DgnImage dgnImage = (DgnImage)Image.load(dataDir + "Nikon_D90_Camera.dgn");
// Create an object of CadRasterizationOptions class and define/set different properties
PdfOptions options = new PdfOptions();
CadRasterizationOptions vectorOptions = new CadRasterizationOptions();
vectorOptions.setPageWidth(1500);
vectorOptions.setPageHeight(1500);
vectorOptions.setNoScaling(true);
vectorOptions.setAutomaticLayoutsScaling(false);
options.setVectorRasterizationOptions(vectorOptions);
OutputStream outStream = new FileOutputStream(dataDir + "ExportDGNToPdf_Out.pdf");
// Call the save method of the DgnImage class object.
dgnImage.save(outStream, options);

DGN 오토캐드 형식을 래스터 이미지 형식으로 내보내기

Aspose.CAD for Java API는 DGN 오토캐드 파일을 로드하고 래스터 이미지로 변환하는 기능을 도입했습니다. DgnImage 클래스가 이 목적을 제공합니다.

기존 DGN 파일을 DgnImage로 로드해야 합니다. CadRasterizationOptions 클래스의 인스턴스를 생성하고 다양한 속성을 설정합니다. JpegOptions 클래스의 인스턴스를 생성하고 CadRasterizationOptions 인스턴스를 전달합니다. 이제 DgnImage 클래스 인스턴스의 save 메서드를 호출합니다.

샘플 코드

다음은 DGNJPEG 이미지로 변환/내보내는 코드 예제입니다.

// Load an existing DGN file as DgnImage.
DgnImage dgnImage = (DgnImage) Image.load(dataDir + "Nikon_D90_Camera.dgn");
// Create an object of JpegOptions class as we are converting the DGN to JPEG and assign DgnRasterizationOptions object to it.
ImageOptionsBase options = new JpegOptions();
CadRasterizationOptions vectorOptions = new CadRasterizationOptions();
vectorOptions.setPageWidth(600);
vectorOptions.setPageHeight(400);
vectorOptions.setNoScaling(true);
vectorOptions.setAutomaticLayoutsScaling(false);
options.setVectorRasterizationOptions(vectorOptions);
OutputStream outStream = new FileOutputStream(dataDir + "ExportDGNToRasterImage_Out.jpg");
// Call the save method of the CadImage class object.
dgnImage.save(outStream, options);