PSD を PDF に変換する
Aspose.PSD for .NET は、PSD ファイルを読み込むための Image クラスを提供し、同じクラスを使用して画像を PDF 形式に保存することができます。以下に示すサンプルコードは、PSD を PDF に変換する方法を示しています。
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
// Add support of PSD export to PDF | |
string[] sourcesFiles = new string[] | |
{ | |
@"1.psd", | |
@"little.psb", | |
@"psb3.psb", | |
@"inRgb16.psd", | |
@"ALotOfElementTypes.psd", | |
@"ColorOverlayAndShadowAndMask.psd", | |
@"ThreeRegularLayersSemiTransparent.psd" | |
}; | |
for (int i = 0; i < sourcesFiles.Length; i++) | |
{ | |
string sourceFileName = sourcesFiles[i]; | |
using (PsdImage image = (PsdImage)Image.Load(dataDir + sourceFileName)) | |
{ | |
string outFileName = "PsdToPdf" + i + ".pdf"; | |
image.Save(dataDir + outFileName, new PdfOptions()); | |
} | |
} |
クリッピングマスクを使用した PSD から PDF への変換
クリッピングマスクを使用すると、複数のレイヤーに一度にマスクを適用できます。この記事では、クリッピングマスクを使用して PSD を PDF にエクスポートする方法が示されています。以下にこの機能を実現するためのサンプルコードが示されています。
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
using (PsdImage image = (PsdImage)Image.Load(dataDir + "clip.psd")) | |
{ | |
image.Save(dataDir + "output.pdf", new PdfOptions()); | |
} |
アジャストメントレイヤーを使用した PSD から PDF への変換
アジャストメントレイヤーを使用すると、画像のピクセル値を永続的に変更することなく、色調やトーンの調整を適用できます。この記事では、アジャストメントレイヤーを使用して PSD を PDF にエクスポートする方法が示されています。以下にコードスニペットが提供されています。
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
using (PsdImage image = (PsdImage)Image.Load(dataDir + "example.psd")) | |
{ | |
image.Save(dataDir + "document.pdf", new PdfOptions()); | |
} |
PSD ファイルを PSB に変換する
Aspose.PSD for .NET を使用すると、開発者は PSD ファイルを PSB ファイル形式に変換することができます。この記事では、Aspose.PSD を使用して PSD ファイルを PSB 形式にエクスポート/変換する方法が示されています。Aspose.PSD for .NET は、PSD ファイルを読み込むために Image クラスが公開する Load メソッドを提供し、同じ方法で結果を保存することができます。以下のコードスニペットでは、PSD を PSB ファイルに変換する方法が示されています。
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
string sourceFilePathPsd = dataDir + "2layers.psd"; | |
string outputFilePathPsb = dataDir + "ConvertFromPsd.psb"; | |
using (Image img = Image.Load(sourceFilePathPsd)) | |
{ | |
var options = new PsdOptions((PsdImage)img) { PsdVersion = PsdVersion.Psb }; | |
img.Save(outputFilePathPsb, options); | |
} |