STP図面

STP形式をPDFにエクスポートする

Aspose.CAD for .NETは、開発者がSTPファイルをPDF形式にエクスポートすることを可能にします。STPからPDFへの変換アプローチは次のように機能します:

  1. Image.Loadファクトリーメソッドを使用してSTP図面ファイルをロードします。
  2. CadRasterizationOptionsクラスのオブジェクトを作成し、PageHeightおよびPageWidthプロパティを設定します。
  3. PdfOptionsクラスのオブジェクトを作成し、VectorRasterizationOptionsプロパティを設定します。
  4. Image.Saveを呼び出し、第二パラメータとしてPdfOptionsのオブジェクトを渡します。

サンプルコード

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