STP 도면
Contents
[
Hide
]STP 형식을 PDF로 내보내기
Aspose.CAD for .NET은 개발자가 STP 파일을 PDF 형식으로 내보낼 수 있도록 합니다. STP에서 PDF로의 변환 접근 방식은 다음과 같이 작동합니다:
- Image.Load 팩토리 메서드를 사용하여 STP 도면 파일을 로드합니다.
- CadRasterizationOptions 클래스의 객체를 생성하고 PageHeight 및 PageWidth 속성을 설정합니다.
- PdfOptions 클래스의 객체를 생성하고 VectorRasterizationOptions 속성을 설정합니다.
- Image.Save를 호출하면서 두 번째 매개변수로 PdfOptions 객체를 전달합니다.
샘플 코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string inputFile ="file.stp"; | |
using (Image image = Image.Load(inputFile)) | |
{ | |
// Initialize PdfOptions class object | |
PdfOptions options = new PdfOptions(); | |
CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions(); | |
cadRasterizationOptions.PageHeight = 500; | |
cadRasterizationOptions.PageWidth = 500; | |
options.VectorRasterizationOptions = cadRasterizationOptions; | |
// Export STP to PDF | |
string outPath = "output.pdf"; | |
image.Save(outPath, options); | |
} |