Convert cmx to pdf
Contents
[
Hide
]
Using Aspose.Imaging we can convert single paged or multi-page cmx image to pdf.
The following code snippet shows you how to convert cmx to pdf.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Aspose.Imaging; | |
using Aspose.Imaging.ImageOptions; | |
using System.IO; | |
string templatesFolder = @"c:\Users\USER\Downloads\templates\"; | |
string dataDir = templatesFolder; | |
using (Aspose.Imaging.FileFormats.Cmx.CmxImage image = | |
(Aspose.Imaging.FileFormats.Cmx.CmxImage)Image.Load(dataDir + "template.cmx")) | |
{ | |
Aspose.Imaging.ImageOptions.PdfOptions options = new PdfOptions(); | |
options.PdfDocumentInfo = new Aspose.Imaging.FileFormats.Pdf.PdfDocumentInfo(); | |
// Set rasterization options for fileformat | |
options.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Color.White, image.Width, image.Height }); | |
options.VectorRasterizationOptions.TextRenderingHint = TextRenderingHint.SingleBitPerPixel; | |
options.VectorRasterizationOptions.SmoothingMode = SmoothingMode.None; | |
image.Save(dataDir + "result.pdf", options); | |
} | |
File.Delete(dataDir + "result.pdf"); |