Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

SVGFilesAndInkscape

Categories: Tools
<< | Page list | >>

Directly include SVG-Images in LyX.

For a description see Use Inkscape SVG Images.

As i cannot upload files i include the source code for the two scripts needed directly.

inkscape.cmd (Windows command script)

@echo off
set INKSCAPE_DIR=C:\Program Files\Inkscape
set PNG_BACKGROUND_COLOR="#ffffff"
if "%1" == "EDIT" (
    echo start "InkScape" "%INKSCAPE_DIR%\inkscape.exe" "%~f2"
    start "InkScape" "%INKSCAPE_DIR%\inkscape.exe" "%~f2"
    exit
) ELSE IF "%1" == "SHOW" (
    echo "%INKSCAPE_DIR%\inkview.exe" "%~f2"
    start "InkScape" "%INKSCAPE_DIR%\inkview.exe" "%~f2"
    exit
) ELSE IF "%1" == "PNG" (
    echo "%INKSCAPE_DIR%\inkscape.exe" -f "%~f2" -D -b "%PNG_BACKGROUND_COLOR%" -e "%~f3"
    call "%INKSCAPE_DIR%\inkscape.exe" -f "%~f2" -D -b "%PNG_BACKGROUND_COLOR%" -e "%~f3"
) ELSE IF "%1" == "EPS" (
    echo call "%INKSCAPE_DIR%\inkscape.exe" -E "%~f3" -D -f "%~f2"
    call "%INKSCAPE_DIR%\inkscape.exe" -E "%~f3" -D -f "%~f2"
) ELSE IF "%1" == "PDF" (
    echo call "%INKSCAPE_DIR%\inkscape.exe" -A "%~f3" -D -f "%~f2"
    call "%INKSCAPE_DIR%\inkscape.exe" -A "%~f3" -D -f "%~f2"
) ELSE (
    exit
)

inkscape (Cygwin shell script)

#!/bin/bash

INKSCAPE_DIR="C:/Program Files/Inkscape"
PNG_BACKGROUND_COLOR="#ffffff"

if [ -n "$2" ]; then
  INFILE=$(cygpath -aw "$2")
fi

if [ -n "$3" ]; then
  OUTFILE=$(cygpath -aw "$3")
fi

if [ "$1" = "EDIT" ]; then
    echo "\"$INKSCAPE_DIR/inkscape\"" "\"$INFILE\""
    "$INKSCAPE_DIR/inkscape" "$INFILE"
elif [ "$1" == "SHOW" ]; then
    echo "\"$INKSCAPE_DIR/inkview\"" "\"$INFILE\""
    "$INKSCAPE_DIR/inkview" "$INFILE"
elif [ "$1" == "PNG" ]; then
    echo "\"$INKSCAPE_DIR/inkscape\"" -e "\"$OUTFILE\"" -D -b "\"$PNG_BACKGROUND_COLOR\"" -f "\"$INFILE\""
    "$INKSCAPE_DIR/inkscape" -e "$OUTFILE" -D -b "$PNG_BACKGROUND_COLOR" -f "$INFILE"
elif [ "$1" == "EPS" ]; then
    echo "\"$INKSCAPE_DIR/inkscape\"" -E "\"$OUTFILE\"" -D -f "\"$INFILE\""
    "$INKSCAPE_DIR/inkscape" -E "$OUTFILE" -D -f "$INFILE"
elif [ "$1" == "PDF" ]; then
    echo "\"$INKSCAPE_DIR/inkscape\"" -A "\"$OUTFILE\"" -D -f "\"$INFILE\""
    "$INKSCAPE_DIR/inkscape" -A "$OUTFILE" -D -f "$INFILE"
fi

inkscape (Linux shell script)

#!/bin/bash

INKSCAPE_DIR="/usr/bin"
PNG_BACKGROUND_COLOR="#ffffff"
if [ "$1" = "EDIT" ]; then
    echo "\"$INKSCAPE_DIR/inkscape\"" $2
    "$INKSCAPE_DIR/inkscape" $2
elif [ "$1" == "SHOW" ]; then
    echo "\"$INKSCAPE_DIR/inkview\"" $2
    "$INKSCAPE_DIR/inkview" $2
elif [ "$1" == "PNG" ]; then
    echo "\"$INKSCAPE_DIR/inkscape\"" -e $3 -D -b "$PNG_BACKGROUND_COLOR" -f $2
    "$INKSCAPE_DIR/inkscape" -e $3 -D -b "$PNG_BACKGROUND_COLOR" -f $2
elif [ "$1" == "EPS" ]; then
    echo "\"$INKSCAPE_DIR/inkscape\"" -E $3 -D -f $2
    "$INKSCAPE_DIR/inkscape" -E $3 -D -f $2
elif [ "$1" == "PDF" ]; then
    echo "\"$INKSCAPE_DIR/inkscape\"" -A $3 -D -f $2
    "$INKSCAPE_DIR/inkscape" -A $3 -D -f $2
fi

A "shortcut" (but not correct) method to render TrueType fonts to EPS is by adding the -T (text to path) option before the -E in the EPS output commands.

Added the convert to PDF option using the -A parameter Tools

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2009-11-23 11:30 UTC