2

I'm making some illustrations for a dissertation in Inkscape and I like this software. However, when inserting those illustrations to Word files, there appear some weird artifacts like:

  • disappeared end of arrows
  • text render (spacing, etc.)

NB!: weird behavior. At insertion svg file it seems to look OK, but after saving and re-opening docx-files, the artifacts appear.

I figured out it can be fixed by converting all objects with artifacts to paths and saving as plain svg. Inserting obtained files has no problem after re-opening.

I found info, how to batch convert Inkscape svg to plain svg here, and how to convert all objects and text to path.

I combined everything in a PowerShell script, but it fixes only issues with texts, not with objects like arrows. How to fix that?

My scripts is:

$input_folder_name='as is'
$output_folder_name='as path'

# ------------------------------------------
$input_folder=$(Join-Path -Path "$PSScriptRoot" -ChildPath "$input_folder_name")
$output_folder=$(Join-Path -Path "$PSScriptRoot" -ChildPath "$output_folder_name")

# This will work if Inkscape is installed from the installer, not from Microsoft Store
set-alias inkscape "C:\Program Files\Inkscape\inkscape.exe"

# ------------------------------------------

$svg_selector_filter = $(Join-Path -Path $input_folder -ChildPath "*.svg")

# ------------------------------------------

$files = Get-ChildItem "$svg_selector_filter"
foreach ($file in $files){

    $output_file=$(Join-Path -Path "$output_folder" -ChildPath "$($file.Name)")

    # key "--export-area-drawing" will export anly area occupied by drawing!
    # key "-T" will export all font text as vectors, but not objects like arrows!
    inkscape -f "$file" --verb=EditSelectAll --verb=ObjectToPath --export-area-drawing --export-plain-svg="$output_file" -T
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.