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); | |
} |