Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
SVG is Scalable Vector Graphics. This is a vector image format for creating graphics and images that can be scaled up or down without losing quality. SVG images are created using XML code that describes the shapes, paths, lines, and colors that make up the image.
One of the main features of Aspose.HTML is its conversion capability. Aspose.HTML for Java provides easy access to conversion methods through its Converter class, which is a shared facade for most often conversion scenarios and offers a wide range of SVG conversions to popular formats like PDF, XPS, JPG, PNG, BMP, TIFF, and GIF.
The articles in the “SVG Converter” chapter give information on the list of supported SVG conversions and how to perform them using the Converter class.
To convert SVG, you should take a few steps:
Please take a look over the following Java code snippet that shows the SVG to GIF conversion using the
convertSVG(document, options, savePath) method.
1// Convert SVG to GIF in Java
2
3// Prepare SVG code and save it to a file
4String code = "<svg xmlns='http://www.w3.org/2000/svg'>\n" +
5 "<circle cx='50' cy='50' r='40' stroke='black' stroke-width='3' fill='red' />\n" +
6 "</svg>\n";
7try (java.io.FileWriter fileWriter = new java.io.FileWriter("document.svg")) {
8 fileWriter.write(code);
9}
10
11// Initialize an SVG document from the SVG file
12SVGDocument document = new SVGDocument("document.svg");
13
14// Initialize ImageSaveOptions
15ImageSaveOptions options = new ImageSaveOptions(ImageFormat.Gif);
16
17// Convert SVG to GIF
18Converter.convertSVG(document, options, "output.gif");convertSVG() methods of the Converter class and how to apply ImageSaveOptions.Aspose.HTML offers a free online SVG Converter for converting SVG files to various popular formats. You can easily convert SVG to PDF, SVG to XPS, SVG to PNG, SVG to JPG, etc. Select the file and the format to convert, and you’re done. It’s fast and completely free!
You can download the complete Java examples and data files from GitHub.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.