How to convert wmf files to svg files - svg

How to convert WMF file to svg file? I have around 550 WMF files to be converted to SVG format.
For one file, I opened the WMF file in VISIO and saved it as SVG format, but to convert around 550 files is a tedious process.
Please help me
Actually, these WMF files are the converted files from the PDF document. So, any better way to convert the PDF image to an svg image ? Currently I converted the PDF schematic diagram into wmf and opened it with visio, so that I can select each circuit or connector by ungrouping and later saved it to SVG format. This svg format, I will import into another tool, where i can select each circuit and connector for further work.
Thanks
Ramm

I'll just add a link to the Free EMF/WMF to SVG File Convert Tool 2.0 for future reference.
http://visualstudiogallery.msdn.microsoft.com/dc4e0116-a730-45d2-ae9f-03be676817ea
and the WMF2SVG project over at Github:
https://github.com/hidekatsu-izuno/wmf2svg

For batch processing WMF to SVG you can use Inkscape. You must use the command line. Start it with inkscape --shell.
Then to convert automagically use:
inkscape yourfile.wmf --export-plain-svg=yourfile.svg.
To make your life easier, here is a BATCH skript. Create a text file, name it wmftosvg.bat and place it into the folder with all wmf files. The content of the file:
#ECHO OFF
echo.
echo.
echo. Enter graphic format (like wmf):
echo.
set /p Input1= Graphic file type:
echo.
echo.
FOR %%I IN (*."%Input1%") DO (
setlocal enabledelayedexpansion
C:\Portables\InkscapePortable\App\Inkscape\inkscape "%%~nI.!Input1!" --export-plain-svg="%%~nI".svg
)
With the script above you can convert arbitrary graphics to SVG. Just enter the graphic format (file extension).

If you are familiar with C#/.NET you can use WMF library from CodePlex to create a converter to SVG. Since WMF supports only basic shapes (line, rectangle, polygon, arc) and no layers nor element nesting it should be quite easy to convert as SVG supports all those features and more.
Also check out this question: WMF / EMF File Format conversion C#

I used the wmf2svg Java project to convert a load of old wmf files.
Wrote a little bash script to convert all the files in my folder to .svg
shopt -s nullglob
for file in *; do
fname="${file%.*}.svg"
java -jar wmf2svg-0.9.11.jar $file $fname
done

The WMF2SVG project was moved over to GitHub
https://github.com/hidekatsu-izuno/wmf2svg
It works fabulously on my MacBook OS X 10.10.2

Related

Inkscape doesn't allow to edit svg text lines once it has been saved as plain svg or treated with scour

I was for several days trying to find a solution to the following problem :
Create a svg with text (simply click with the text tool to add text, do not drag to open a frame)
Type enter to create a multiline text, add several lines of text
Save as plain svg or optimized svg
Or treat with scour in command-line
Reopen with Inkscape : you cannot edit the text, it shows it properly but when you go to the next line (with the mouse or keyboard arrow down) the cursor stays on the first line.
This is an annoying bug running for some time in Inkscape and doesn't help with web edition.
But there are solutions... See the following thread to manually (in vim) replace all tspans :
Vim search replace regex + incremental function
And see my answer below to correct the svg code in order to get your Inkscape files back in working order !!!
SVG files do not currently support multi-line text. Inkscape uses custom XML attributes to keep track of which spans of text are part of that block of text.
When you save as Optimized SVG, Inkscape strips out all its custom XML attributes and writes a vanilla SVG file. So the sense of what is a block of text is gone.
Sed is very useful in order to correct your files in a batch:
cd /home/user/my/svg/files
sed -i.bak 's|<svg|<svg\nxmlns:xlink="http://www.w3.org/1999/xlink"\nxmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"|g' *.svg
This runs on all svg files in the current folder and :
Creates a .bak file which you can rename to svg in order to get your original files (but I nevertheless strongly advocate to duplicate your working folder in order to avoid terrible mistakes when fiddling with sed)
Adds the correct namespaces with newlines (\n)
Then:
sed -i.2.bak 's|<tspan|<tspan sodipodi:role="line" |g' *.svg
This appends sodipodi:role="line" to all tspan tags in the current folder and creates file.2.bak backups.

Converting *.eps file to *.dxf using pstoedit linux

I am doing a process of converting SVG to EPS file and EPS file to DXF file format using shell scripting. While converting EPS file to DXF file using the following command:
pstoedit -dt -f dxf:-polyaslines ${epsfile} ${dxffile}
I am facing an issue in converting the text. In the output DXF file, the text are created using polylines, So there is no text property when I open the file in DXF viewer. I need the text should be created as text in DXF file. I gone through the following link http://manpages.ubuntu.com/manpages/hardy/man1/pstoedit.1.html. But I didn't got the exact solution what I need. Can any one help me with this?

why am I losing content when I convert a file from .ps to .svg

I need icons for a site I'm having developed, and therefore I need .svg files. I have a .psd file that I save as a .ps file. I then attempt to use cloudconvert.org to convert the .ps file to .svg. The problem is that it fails to capture the whole image -- only leaving about 40% of the original. What can I do??
Assuming you have the Adobe suite, you can use Photoshop to File - > Export-> Paths to Illustrator,
save as a .ai file and then save it as an svg from illustrator without losing quality.
Hope this helps
EDIT: you can download a trial version of illustrator for free for 30 days form the adobe website

Remove images (with transparency/alpha channel) from PDF

How to remove images with alpha channel (transparency) in a PDF file?
I need to remove all images with transparency from a PDF file because it needs to be optimized with pdf2ps and ps2pdf (to reduce filesize).. Postscript doesn't work properly when the PDF contains images with transparency and the PDF will be converted to one big image..
I have not managed to reproduce your problem.
For cons, I did the same treatment to compress my pdf except that I used pdftops instead of pdf2ps.
I hope it will help.
Sorry for my english (translate.google)
Clark,
It sounds like www.pstill.com will do everything you need and more in one tool. There is a Linux command line version available for a very reasonable price. I have used the tool on a few different PDF's for different reasons and it has always worked as advertised.
From their website.
Putting the 'Portable' back in PDF - PDF to PDF Transcoding
Your PDF cannot be printed on some printers or processed with some applications? PStill can sanitize, simplify, reprocess, flatten transparency and recompress PDF-Files, this process also known as 'transcoding' create a new PDF that has better compatibility, is often smaller in file size, can be optional encrypted/secured and contain only a uniform set of font types. Fonts can be normalized to plain PostScript Type 1 formats, can be subsetted, missing fonts included and bad fonts repaired/replaced. PStill can detect and remove duplicate elements in the PDF. Text can be converted to outlines which makes it perfect for creating 'fontless' PDF. Transcoding can be used to repair bad PDF or simplify the PDF structure so more limited output devices can process it.
Andrew.

Self Contained Linux Command line tool for converting text to doc, rtf, pdf

I'm looking for a command line tool for Linux that will allow me to convert UTF-8 plain text files to various formats. My problem is that I'm working on a secure company-specific flavour of Linux, so the tool can't rely on other packages, such as Open Office, being present. Does anyone know of such a tool?
Gnu a2ps allows you convert from anything to postscript (designed for printing). Not exactly what you want but if you have utilites to display postscript files, you can convert them into pdf.
Another option is Gnu enscript which "converts text to Postscript, HTML or RTF with syntax highlighting". I'm not sure if it supports UTF-8.
Conversion into doc will be harder since it's a closed format. But I have in the past cheated by creating an HTML file with inline css and then renaming it to .doc. Worked back in the early 2000s. DOn't know about now.

Resources