提交 7cdecfd5 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Allow PDF generation with modern Libre/Open Office with fallback to old way

上级 b5d397cf
......@@ -369,11 +369,24 @@ public class Build extends BuildBase {
delete(files("bin").keep("*.jar"));
jar();
docs();
boolean pdfReady = false;
try {
exec("soffice", args("-invisible", "macro:///Standard.Module1.H2Pdf"));
copy("docs", files("../h2web/h2.pdf"), "../h2web");
} catch (Exception e) {
print("OpenOffice is not available: " + e);
if (exec("soffice", args("--convert-to", "pdf", "--outdir", "docs/html", "docs/html/onePage.html")) == 0) {
File f = new File("docs/html/onePage.pdf");
if (f.exists() && f.renameTo(new File("docs/h2.pdf"))) {
pdfReady = true;
}
}
} catch (Exception ex) {
}
if (!pdfReady) {
// Old way
try {
exec("soffice", args("-invisible", "macro:///Standard.Module1.H2Pdf"));
copy("docs", files("../h2web/h2.pdf"), "../h2web");
} catch (Exception e) {
print("OpenOffice is not available: " + e);
}
}
delete("docs/html/onePage.html");
FileList files = files("../h2").keep("../h2/build.*");
......
......@@ -757,4 +757,4 @@ chittanoor carrot
contextual unknowns enquote respectively sessionid reconnection selfreferential bbddbb instant subprotocol ddbbbb
zzbbzz cldr booleans maria enquotes mtc cbuf checksummed nreturn despite bbzz readlimit retries cceecc reconnects
unconditionally coco aren eecccc decimals charsets zzbb lsb msb usecount
unconditionally coco aren eecccc decimals charsets zzbb lsb msb usecount outdir
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论