From 63fd38ea9a864ea8db3e73a7af569f9e634de5ec Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 8 May 2024 14:49:43 +0200 Subject: [PATCH] Export Document.isReflowable(). --- src/mupdf-wasm.d.ts | 1 + src/mupdf.c | 6 ++++++ src/mupdf.ts | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mupdf-wasm.d.ts b/src/mupdf-wasm.d.ts index 595fd18..004aa07 100644 --- a/src/mupdf-wasm.d.ts +++ b/src/mupdf-wasm.d.ts @@ -249,6 +249,7 @@ interface Libmupdf { _wasm_load_outline(doc: Pointer<"any_document">): Pointer<"fz_outline">, _wasm_outline_get_page(doc: Pointer<"any_document">, outline: Pointer<"fz_outline">): number, _wasm_layout_document(doc: Pointer<"any_document">, w: number, h: number, em: number): void, + _wasm_is_document_reflowable(doc: Pointer<"any_document">): boolean, _wasm_link_set_rect(link: Pointer<"fz_link">, rect: Pointer<"fz_rect">): void, _wasm_link_set_uri(link: Pointer<"fz_link">, uri: Pointer<"char">): void, _wasm_bound_page(page: Pointer<"any_page">): Pointer<"fz_rect">, diff --git a/src/mupdf.c b/src/mupdf.c index d56f859..57a981f 100644 --- a/src/mupdf.c +++ b/src/mupdf.c @@ -931,6 +931,12 @@ void wasm_layout_document(fz_document *doc, float w, float h, float em) VOID(fz_layout_document, doc, w, h, em) } +EXPORT +boolean wasm_is_document_reflowable(fz_document *doc) +{ + BOOLEAN(fz_is_document_reflowable, doc) +} + // --- Link --- EXPORT diff --git a/src/mupdf.ts b/src/mupdf.ts index 81cb1df..80ce8ce 100644 --- a/src/mupdf.ts +++ b/src/mupdf.ts @@ -1692,8 +1692,7 @@ export class Document extends Userdata<"any_document"> { } isReflowable() { - // TODO: No HTML/EPUB support in WASM. - return false + libmupdf._wasm_is_document_reflowable(this.pointer) } layout(w: number, h: number, em: number) {