简体   繁体   中英

Cannot convert SVG file to PDF file use apache batik

I have a lot of SVG files that needed to be converted into PDF files.
When I call Batik from console, I get the following error;

~\batik-1.10>java -jar batik-rasterizer-1.10.jar -d "D:/PDF" -m application/pdf 
-dpi 1200 -w 9921 -h 14031 "D:/SVG/topic*.svg"

> About to transcode 1 SVG file(s)
> Converting d:/SVG/topic*.svg to D:\PDF\topic*.pdf ... ... error (SVGConverter.error.cannot.open.source)
> org.apache.batik.apps.rasterizer.SVGConverterException: Error: cannot open source topic*.svg java.io.IOException: Unable to make sense of URL for connection
    at org.apache.batik.apps.rasterizer.SVGConverter.transcode(SVGConverter.java:968)
    at org.apache.batik.apps.rasterizer.SVGConverter.execute(SVGConverter.java:717)
    at org.apache.batik.apps.rasterizer.Main.execute(Main.java:937)
    at org.apache.batik.apps.rasterizer.Main.main(Main.java:990)

What is the problem here?

I was able to recreate your problem (getting the IOException with message "Unable to make sense of URL for connection"), using your command as listed.

I think in this case, the easiest thing to do would be to eliminate the use of quotes on your source directory path, and execute the following:

java -jar batik-rasterizer-1.10.jar -d "D:/PDF" -m application/pdf -dpi 1200 -w 9921 -h 14031 D:/SVG/topic*.svg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM