Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Save this SVG into a file (required by SVG -> PDF transformation process)
- File svgFile = File.createTempFile("graphic-", ".svg");
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- DOMSource source2 = new DOMSource(svgXmlDoc);
- FileOutputStream fOut = new FileOutputStream(svgFile);
- try { transformer.transform(source2, new StreamResult(fOut)); }
- finally { fOut.close(); }
- // Convert the SVG into PDF
- File outputFile = File.createTempFile("result-", ".pdf");
- SVGConverter converter = new SVGConverter();
- converter.setDestinationType(DestinationType.PDF);
- converter.setSources(new String[] { svgFile.toString() });
- converter.setDst(outputFile);
- converter.execute();
Add Comment
Please, Sign In to add comment