From d9355a0827221f2709f375d0d5e16f198d2ce1fb Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Thu, 13 Jan 2022 03:13:16 -0600 Subject: [PATCH] Initial commit --- main.lua | 23 +++++++++++++++++++++++ plugin.ini | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 main.lua create mode 100644 plugin.ini diff --git a/main.lua b/main.lua new file mode 100644 index 0000000..63c1811 --- /dev/null +++ b/main.lua @@ -0,0 +1,23 @@ +-- Register all Toolbar actions and intialize all UI stuff +function initUi() + app.registerUi({["menu"] = "Export to unruled PDF", ["callback"] = "exportUnruledPDF", ["accelerator"] = "u"}); +end + +local DEFAULT_PATH = "/tmp/temp" -- change this to get a different default path for xopp-files that have not been saved yet + +function exportUnruledPDF() + local pdfName = getStem() .. "_unruled.pdf" + app.export({["outputFile"] = pdfName, ["background"] = "unruled"}) + -- use the "range", "background" and "progressiveMode" fields for more customization +end + +function getStem() + local xoppName = app.getDocumentStructure()["xoppFilename"] + if (xoppName ~= "" and xoppName ~= nil) then + return xoppName:match("(.+)%..+$") + else + print("Exporting to default path. Consider saving the xopp-file before exporting! ") + return DEFAULT_PATH + end +end + diff --git a/plugin.ini b/plugin.ini new file mode 100644 index 0000000..193c013 --- /dev/null +++ b/plugin.ini @@ -0,0 +1,18 @@ +## Put this pugin.ini and main.lua in /usr/share/xournalapp/plugins/UnruledExport/ + +[about] +## Author / Copyright notice +author=Sayantan Santra + +description=Export directly as unruled PDF with alt+e + +## If the plugin is packed with Xournal++, use +## then it gets the same version number +version=1.0 + +[default] +enabled=false + +[plugin] +mainfile=main.lua +