- 转换的PowerPoint到TIFF
- 转换PowerPoint TIFF使用自定义图片大小
- PPTX格式TIFF使用自定义像素格式
为了转换 PowerPoint 演示文稿,我们将使用Aspose.Slides for .NET,它旨在从 .NET 应用程序中创建、操作和转换演示文档。
>>你可以点击这里下载Aspose.Slides 最新版测试体验。
使用 C# 将 PowerPoint PPTX 转换为 TIFF
以下是使用 C# 将 PowerPoint PPTX/PPT 转换为 TIFF 的步骤。
- 加载时使用PowerPoint演示文稿类。
- 使用PPTX格式转换为TIFF Presentation.Save(字符串,SaveFormat.Tiff)方法。
以下代码示例显示了如何将 PowerPoint PPTX 文件转换为 TIFF。
// Instantiate a Presentation object that represents a presentation fileusing (Presentation presentation = new Presentation("Presentation.pptx")){ // Saving the presentation to TIFF document presentation.Save("output.tiff", SaveFormat.Tiff);}
转换PowerPoint TIFF使用自定义图片大小
Aspose.Slides for .NET 还允许您自定义 PowerPoint 到 TIFF 转换中生成的图像的大小。以下是实现此目的的步骤。
- 加载时使用PowerPoint演示文稿类。
- 创建TiffOptions类的实例。
- 使用TiffOptions.ImageSize属性设置图像大小。
- 使用PPTX格式转换为TIFF Presentation.Save(字符串,SaveFormat.Tiff)方法。
下面的代码示例演示如何PPTX格式转换为TIFF与自定义图像大小。
// Instantiate a Presentation object that represents a Presentation fileusing (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);}
使用自定义像素格式将 PowerPoint 转换为 TIFF
以下是使用C#定制在PPTX像素格式的步骤TIFF转换。
- 加载时使用PowerPoint演示文稿类。
- 创建TiffOptions类的实例。
- 使用TiffOptions.PixelFormat属性将像素格式设置为所需格式。
- 使用PPTX格式转换为TIFF Presentation.Save(字符串,SaveFormat.Tiff)方法。
以下代码示例展示了如何在 PPTX 到 TIFF 转换中自定义像素格式。
// Instantiate a Presentation object that represents a Presentation fileusing (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天临时授权体验。
还想要更多吗可以点击阅读【Aspose最新资源在线文库】,查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!