スライドを SVG 画像として作成
Contents
[
Hide
]
任意のスライドから SVG 画像を生成するには、Aspose.Slides.Pptx for .NET を使用して、以下の手順に従ってください。
- Presentation クラスのインスタンスを作成します。
- ID またはインデックスを使用して目的のスライドの参照を取得します。
- メモリストリームで SVG 画像を取得します。
- メモリストリームをファイルに保存します。
Example
//Instantiate a Presentation class that represents the presentation file
using (Presentation pres = new Presentation("Slides Test Presentation.pptx"))
{
//Access the second slide
ISlide sld = pres.Slides[1];
//Create a memory stream object
MemoryStream SvgStream = new MemoryStream();
//Generate SVG image of slide and save in memory stream
sld.WriteAsSvg(SvgStream);
SvgStream.Position = 0;
//Save memory stream to file
using (Stream fileStream = System.IO.File.OpenWrite("PresentatoinTemplate.svg"))
{
byte[] buffer = new byte[8 * 1024];
int len;
while ((len = SvgStream.Read(buffer, 0, buffer.Length)) > 0)
{
fileStream.Write(buffer, 0, len);
}
}
SvgStream.Close();
Download Running Example
Download Sample Code
詳細については、Render Presentation Slides as SVG Images in .NET をご覧ください。