asset忘了上传了,重新传一下,增加了模板引擎(见README),修复了printable的目录bug

This commit is contained in:
Nobody committed 2026-11-10 00:35:41 +08:00
1 parent 0817d33309
commit 8b88de4942
7268 files changed
+1257020

No files matched your search

@@ -0,0 +1,26 @@
import { assertEquals } from "@std/assert";
import { DocuBuilder } from "./docu_builder.ts";
Deno.test("PDF rendering loads relative assets from configured file base", async () => {
const chromiumPath = Deno.env.get("CHROMIUM_PATH");
if (!chromiumPath) {
console.warn("Skipping Chromium asset test: CHROMIUM_PATH is unset");
return;
}
const builder = new DocuBuilder({
asset_base: "../../assets",
journal: { build_js_script: false },
});
const pdfPath = await Deno.makeTempFile({ suffix: ".pdf" });
await builder.with_browser();
try {
await builder.build_as_pdf({ path: pdfPath, format: "A4" }, [
'<img src="pictures/rsf.png" alt="Asset">',
]);
} finally {
await builder.close_browser();
}
assertEquals((await Deno.stat(pdfPath)).size > 0, true);
await Deno.remove(pdfPath);
});