Inkscape.org
Beyond the Basics Export EMF files from command line with dashed lines fix
  1. #1
    kgoodrick kgoodrick @kgoodrick

    Hello,

    I am trying to convert SVGs to EMFs, to include them in PowerPoint slides. I can do this now with:

    inkscape --file $file.svg -T -M $file.emf

    However, dashed lines appear to be solid. I've seen that you can convert the dashed lines to single lines of you export using the GUI, but I need to convert dozens of files, so I would prefer to automate this. Is there a way to use the dashed lines conversion from the command line? I think I could potentially change the defaults in the source and then recompile, but if there is an easier way that would be great!

    Thanks,

    Kyle

  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    I'd use a unix/text editor like Notepad++ to batch replace all the instances of dash arrays to solid.

        <path
           style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
           d="M 133.86886,398.92998 H 460.23527"
           id="path812"
           inkscape:connector-curvature="0" />
        <path
           inkscape:connector-curvature="0"
           id="path816"
           d="M 133.86886,453.73302 H 460.23527"
           style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:3,3;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers" />

    Where the files have stroke-dasharry: n,n; (or similar), I'd replace with stroke-dasharry: none;

    A typical text editor will allow find/replace across documents.

  3. #3
    kgoodrick kgoodrick @kgoodrick

    I would like the dashed lines to stay dashed, not become solid. They become solid by themselves after importing into powerpoint right now.

  4. #4
    kgoodrick kgoodrick @kgoodrick

    Also, changing the defaults in the source and recompiling did work, so it is possible to do it from the command line, it's just a question of whether or not it's possible to set those EMF export options from the command line. 

  5. #5
    inklinea inklinea @inklinea⛰️
    *

     inkscape --export-type="emf" my_file.svg does the job.

    The emf dashes however are interpreted differently in Powerpoint.

    I opened them in Powerpoint online via my hotmail account and also in Office Professional Plus 2016.

    In each image on the right hand side you can see the original dashed path vs a Path>Convert Stroke to Path version above it.

    If you open the emf in Inkscape, you should see the dashes are correct.

    I've attached the .svg / .emf / . pptx

     

    Stroketest
  6. #6
    kgoodrick kgoodrick @kgoodrick

    That seems to do it, thanks for your help!

     

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Export EMF files from command line with dashed lines fix