翻譯|使用教程|編輯:李顯亮|2021-08-16 10:30:00.297|閱讀 301 次
概述:PowerPoint中的TIFF轉換可以在各種情況下,如打印,傳真等有用的,以便以編程方式執行此轉換,本文將介紹如何使用C#PowerPoint演示PPTX / PPT轉換成TIFF。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
PowerPoint中的TIFF轉換可以在各種情況下,如打印,傳真等有用的,以便以編程方式執行此轉換,本文將介紹如何使用C#PowerPoint演示PPTX / PPT轉換成TIFF。此外,您將學習如何自定義生成的 TIFF 圖像的大小和像素格式。
為了轉換 PowerPoint 演示文稿,我們將使用Aspose.Slides for .NET,它旨在從 .NET 應用程序中創建、操作和轉換演示文檔。
>>你可以點擊這里下載Aspose.Slides 最新版測試體驗。
以下是使用 C# 將 PowerPoint PPTX/PPT 轉換為 TIFF 的步驟。
以下代碼示例顯示了如何將 PowerPoint PPTX 文件轉換為 TIFF。
// Instantiate a Presentation object that represents a presentation file
using (Presentation presentation = new Presentation("Presentation.pptx"))
{
// Saving the presentation to TIFF document
presentation.Save("output.tiff", SaveFormat.Tiff);
}
Aspose.Slides for .NET 還允許您自定義 PowerPoint 到 TIFF 轉換中生成的圖像的大小。以下是實現此目的的步驟。
下面的代碼示例演示如何PPTX格式轉換為TIFF與自定義圖像大小。
// Instantiate a Presentation object that represents a Presentation file
using (Presentation pres = new Presentation("Presentation.pptx"))
{
// Instantiate the TiffOptions class
TiffOptions opts = new TiffOptions();
// Setting compression type
opts.CompressionType = TiffCompressionTypes.Default;
// Depth depends on the compression type and cannot be set manually.
// Resolution unit is always equal to “2” (dots per inch)
// Setting image DPI
opts.DpiX = 200;
opts.DpiY = 100;
// Set Image Size
opts.ImageSize = new Size(1728, 1078);
// Save the presentation to TIFF with specified image size
pres.Save("TiffWithCustomSize_out.tiff", SaveFormat.Tiff, opts);
}
以下是使用C#定制在PPTX像素格式的步驟TIFF轉換。
以下代碼示例展示了如何在 PPTX 到 TIFF 轉換中自定義像素格式。
// Instantiate a Presentation object that represents a Presentation file
using (Presentation presentation = new Presentation("Presentation.pptx"))
{
TiffOptions options = new TiffOptions();
options.PixelFormat = ImagePixelFormat.Format8bppIndexed;
/*
ImagePixelFormat contains the following values (as could be seen from documentation):
Format1bppIndexed; // 1 bits per pixel, indexed.
Format4bppIndexed; // 4 bits per pixel, indexed.
Format8bppIndexed; // 8 bits per pixel, indexed.
Format24bppRgb; // 24 bits per pixel, RGB.
Format32bppArgb; // 32 bits per pixel, ARGB.
*/
// Save the presentation to TIFF with specified image size
presentation.Save("Tiff_With_Custom_Image_Pixel_Format_out.tiff", SaveFormat.Tiff, options);
}
如果你想試用Aspose的全部完整功能,可聯系在線客服獲取30天臨時授權體驗。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn