Initial commit

This commit is contained in:
Sayantan Santra 2022-01-13 03:13:16 -06:00
parent 736921a6fb
commit d9355a0827
2 changed files with 41 additions and 0 deletions

23
main.lua Normal file
View file

@ -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"] = "<Alt>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

18
plugin.ini Normal file
View file

@ -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
## <xournalpp> then it gets the same version number
version=1.0
[default]
enabled=false
[plugin]
mainfile=main.lua