diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts index 7b62ba24b..d0ee7c469 100644 --- a/app/src/menus/commonMenuItem.ts +++ b/app/src/menus/commonMenuItem.ts @@ -752,7 +752,24 @@ export const exportMd = (id: string) => { } }, ] - } + }, + /// #else + { + id: "exportPDF", + label: "PDF", + icon: "iconPDF", + ignore: !isInAndroid(), + click: () => { + const localData = window.siyuan.storage[Constants.LOCAL_EXPORTPDF]; + fetchPost("/api/export/exportPreviewHTML", { + id: "${id}", + keepFold: localData.keepFold, + merge: localData.mergeSubdocs, + }, response => { + window.JSAndroid.exportPDF(response.data.content); + }); + } + }, /// #endif ] }).element; diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 7c3a927f3..136544917 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -245,6 +245,7 @@ interface Window { readHTMLClipboard(): string getBlockURL(): string hideKeyboard(): void + exportPDF(html: string): void }; JSHarmony: { openExternal(url: string): void