PowerPoint 到 TIFF 的转换可用于各种场景,例如打印、传真等。为了以编程方式执行此转换,本文介绍了如何使用 C# 将 PowerPoint PPTX/PPT 转换为 TIFF。此外,您将学习如何自定义生成的 TIFF 图像的大小和像素格式。
- C# PowerPoint PPT 到 TIFF 转换器 - 免费下载
- 在 C# 中将 PPT 转换为 TIFF
- C# 使用自定义图像大小将 PPTX 转换为 TIFF
- C# PPTX 到具有自定义像素格式的 TIFF
C# PowerPoint PPT 到 TIFF 转换器 - 免费下载
为了转换 PowerPoint 演示文稿,我们将使用 Aspose.Slides for .NET。该 API 旨在从 .NET 应用程序中创建、操作和转换演示文档。您可以 下载 API 或使用 NuGet 安装它。
PM> Install-Package Aspose.Slides.NET
在 C# 中将 PPTX 转换为 TIFF
以下是使用 C# 将 PowerPoint PPTX/PPT 转换为 TIFF 的步骤。
- 使用 Presentation 类加载 PowerPoint 演示文稿。
- 使用 Presentation.Save(string, SaveFormat.Tiff) 方法将 PPTX 转换为 TIFF。
以下代码示例展示了如何在 C# 中将 PPTX 转换为 TIFF。
C# 使用自定义图像大小将 PPT 转换为 TIFF
Aspose.Slides for .NET 还允许您自定义 PowerPoint 到 TIFF 转换中结果图像的大小。以下是实现此目的的步骤。
- 使用 Presentation 类加载 PowerPoint 演示文稿。
- 创建 TiffOptions 类的实例。
- 使用 TiffOptions.ImageSize 属性设置图像大小。
- 使用 Presentation.Save(string, SaveFormat.Tiff) 方法将 PPTX 转换为 TIFF。
以下代码示例显示了如何将 PPTX 转换为具有自定义图像大小的 TIFF。
C# PowerPoint 到 TIFF - 自定义像素格式
以下是在 C# 中自定义 PPT 到 TIFF 转换中的像素格式的步骤。
- 使用 Presentation 类加载 PowerPoint 演示文稿。
- 创建 TiffOptions 类的实例。
- 使用 TiffOptions.PixelFormat 属性将像素格式设置为所需的 format。
- 使用 Presentation.Save(string, SaveFormat.Tiff) 方法将 PPTX 转换为 TIFF。
以下代码示例展示了如何使用 C# 自定义 PPT 到 TIFF 转换中的像素格式。
// 实例化表示 Presentation 文件的 Presentation 对象
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.
*/
// 将演示文稿保存为具有指定图像大小的 TIFF
presentation.Save("Tiff_With_Custom_Image_Pixel_Format_out.tiff", SaveFormat.Tiff, options);
}
PowerPoint 到 TIFF C# 转换器 - 获得免费许可证
您可以通过获得 免费临时许可证 来使用 Aspose.Slides for .NET,而不受评估限制。
结论
在本文中,您学习了如何在 C# 中将 PowerPoint PPT 或 PPTX 转换为 TIFF。此外,您还了解了如何自定义 PPT TIFF 转换以及更改 TIFF 图像的大小和像素格式。您可以访问 文档 以探索 Aspose.Slides for .NET 的其他功能。此外,您可以随时通过我们的 论坛 告诉我们您的疑问。
也可以看看
提示:您可能需要在线查看 Aspose FREE PowerPoint 到海报转换器。