Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

SVGFilesAndBatik

Categories: Tools
<< | Page list | >>

Directly include SVG-Images in LyX.

For a description see Use Batik SVG Images.

As I cannot upload files I include the source code for scripts needed directly (new incarnation of SVGFilesAndInkscape).

batik.cmd (Windows command script)

@echo off
set BATIK_DIR=C:\Projects\batik-1.7
set PNG_BACKGROUND_COLOR="#ffffff"
set JAVA_MEM=-Xms10m -Xmx128m
if "%1" == "SHOW" (
    echo "%JAVA_HOME%/bin/java.exe %JAVA_MEM% -jar %BATIK_DIR%\batik-squiggle.jar" "%~f2"
    start "%JAVA_HOME%/bin/java.exe" %JAVA_MEM% -jar "%BATIK_DIR%\batik-squiggle.jar" "%~f2"
rem    exit
) ELSE IF "%1" == "PNG" (
    echo "%JAVA_HOME%/bin/java.exe %JAVA_MEM% -jar %BATIK_DIR%\batik-rasterizer.jar %~f2 -m image/png -d %~f3"
    call "%JAVA_HOME%/bin/java.exe" %JAVA_MEM% -jar "%BATIK_DIR%\batik-rasterizer.jar" "%~f2" -m image/png -d "%~f3"
) ELSE IF "%1" == "PDF" (
    echo "%JAVA_HOME%/bin/java.exe" %JAVA_MEM% -jar "%BATIK_DIR%\batik-rasterizer.jar" "%~f2" -m application/pdf -d "%~f3"
    call "%JAVA_HOME%/bin/java.exe" %JAVA_MEM% -jar "%BATIK_DIR%\batik-rasterizer.jar" "%~f2" -m application/pdf -d "%~f3"
) ELSE IF "%1" == "EPS" (
    rem echo "%JAVA_HOME%/bin/java.exe" %JAVA_MEM% -jar "%BATIK_DIR%\batik-rasterizer.jar" "%~f2" -m application/eps -d "%~f3"
    rem call "%JAVA_HOME%/bin/java.exe" %JAVA_MEM% -jar "%BATIK_DIR%\batik-rasterizer.jar" "%~f2" -m application/eps -d "%~f3"
) ELSE (
    rem exit
)

batik (Cygwin shell script)

Has anyone needs Cygwin script?

batik (Linux shell script)

#!/bin/bash
BATIK_DIR=~/temp/batik-1.7
export PNG_BACKGROUND_COLOR=#ffffff
JAVA=/opt/java/bin/java
JAVA_MEM=-Xms10m -Xmx128m
if [[ "$1" == "SHOW" ]]; then
    echo "$JAVA $JAVA_MEM -jar $BATIK_DIR/batik-squiggle.jar $2"
    $JAVA $JAVA_MEM -jar $BATIK_DIR/batik-squiggle.jar $2
elif [[ "$1" == "PNG" ]]; then
    echo "$JAVA $JAVA_MEM -jar $BATIK_DIR/batik-rasterizer.jar $2 -m image/png -d $3"
    $JAVA $JAVA_MEM -jar $BATIK_DIR/batik-rasterizer.jar $2 -m image/png -d $3
elif [[ "$1" == "PDF" ]]; then
    echo "$JAVA $JAVA_MEM -jar $BATIK_DIR/batik-rasterizer.jar $2 -m application/pdf -d $3"
    $JAVA $JAVA_MEM -jar $BATIK_DIR/batik-rasterizer.jar $2 -m application/pdf -d $3
elif [[ "$1" == "EPS" ]]; then
    echo "$JAVA $JAVA_MEM -jar $BATIK_DIR/batik-rasterizer.jar $2 -m application/eps -d $3"
    $JAVA $JAVA_MEM -jar $BATIK_DIR/batik-rasterizer.jar $2 -m application/eps -d $3
else
    echo "unkown type $1"
fi;

Please note that batik uses width and height information from SVG file (SVG element). If that information is not present batik use it's default values of 400x400px, resulting in a clipped file. To work around the issue, please set te width and height attributes by, for example, viewing the file in batik.

Please refer to batik documentation for more details what you can achieve by Batik.

Categories

Tools

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2010-01-24 21:00 UTC