Convert cmx to pdf
Contents
[
Hide
]
Convert cmx to pdf
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
import com.aspose.imaging.*; | |
import com.aspose.imaging.imageoptions.PdfOptions; | |
import com.aspose.imaging.imageoptions.VectorRasterizationOptions; | |
try (com.aspose.imaging.fileformats.cmx.CmxImage image = | |
(com.aspose.imaging.fileformats.cmx.CmxImage)Image.load("input.cmx")) | |
{ | |
com.aspose.imaging.imageoptions.PdfOptions options = new PdfOptions(); | |
options.setPdfDocumentInfo(new com.aspose.imaging.fileformats.pdf.PdfDocumentInfo()); | |
// Set rasterization options for fileformat | |
VectorRasterizationOptions rasterizationOptions = (VectorRasterizationOptions) image.getDefaultOptions(new Object[]{Color.getWhite(), image.getWidth(), image.getHeight()}); | |
options.setVectorRasterizationOptions(rasterizationOptions); | |
rasterizationOptions.setTextRenderingHint(TextRenderingHint.SingleBitPerPixel); | |
rasterizationOptions.setSmoothingMode(SmoothingMode.None); | |
image.save("output.pdf", options); | |
} |