I need a vector image of a Wikipedia navbox. Unfortunately, Inkscape can't open the HTML file, and neither Opera nor Chromium can save the page as SVG. Googling, googling, and yet more googling turned up nothing; in particular, 'HTML2svg' seems to mean functionality where the HTML 'talks to' an SVG image inside it. Does anybody how to turn HTML into SVG, either the entire page or a div on the page? I need the styled HTML, CSS and all.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
I managed to find a website that will do the conversion for you. All you have to do is paste the HTML in between line breaks and it does the rest. The URL is: http://www.hiqpdf.com/demo/ConvertHtmlToSvg.aspx
Tried xthexder's advice: printing to file. (And then converting PDF to SVG.) I tried Opera, Firefox, and Chromium under Linux; overview below. Real pity about Opera's bugs.
I've made this answer community wiki; additions for other OSes welcome.
Opera 11.61 (Linux)
.svg
file but writes PostScript code in it. :-(Firefox 11.0 (Linux)
Chromium 17 (Linux)
I've come across the same need and found the following free utilities which hold promise that this is possible:
WebVector is an HTML to SVG or PNG convertor. It converts a HTML document into a vector image in SVG format or a bitmap image in PNG format. The Standard Vector Graphics (SVG) files can be further edited by a variety of vector graphics editors such as Inkscape.
http://cssbox.sourceforge.net/webvector/
CutyCapt is a small cross-platform command-line utility to capture WebKit's rendering of a web page into a variety of vector and bitmap formats, including SVG, PDF, PS, PNG, JPEG, TIFF, GIF, and BMP. See IECapt for a similar tool based on Internet Explorer.
http://cutycapt.sourceforge.net/
wkhtmltopdf and wkhtmltoimage are open source (LGPL) command line tools to render HTML into PDF and various image formats using the QT Webkit rendering engine. These run entirely "headless" and do not require a display or display service. There is also a C library, if you're into that kind of thing.
http://wkhtmltopdf.org/
--
Unanswered Questions: I know that you can use something like rasterize.js to render DOM objects into
<canvas>
, but how are these libraries built such that they are able to export SVG? Specifically, can WebKit itself be used to output "pixel-perfect" editable SVG of web content and HTML snippets? Is this a relatively simple task for a library or is this something significantly more complex?You can try wkhtmltoimage It can convert HTML to SVG and many different formats
You can try http://www.letime.net/alpha/glm.html
it do text to HTML5 draws in css3