我尝试使用“freehep”将 wmf 转换为 png。由于结果实在令人失望,我决定尝试另一种解决方案。我的程序在 Linux 操作系统下运行,因此用于转换的 imagemagick 对我不起作用,因为 wmf/emf 功能仅在 Windows 下受支持(也无法使用 wine)。然而,通过使用openoffice绘图客户端,我可以完美地将wmf/emf转换为png。但是我怎样才能从java运行这个函数呢? openoffice有没有draw的java api?
最佳答案
来自 libreoffice 的人:
OPTIONS
--accept=accept-string
Specify a UNO connect-string to create a UNO acceptor through which other programs can connect to access the API.
所以 open/libreoffice 使用这种方式来允许其他程序甚至客户端机器运行该程序。
我的建议:忘记复杂性并从程序中运行以下命令:
libreoffice --headless --convert-to png /path/to/file.wmfORemf
Here is a link to post describing how to run a command from Java
关于java - 使用openoffice draw配合Java将emf/wmf转换为png,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23598616/