Accessing Export to PDF from plugin code


I am trying to develop a plugin that exports .md files in Obsidian to PDF, and then uploads them to, so I can access them on my reMarkable tablet.

I have something working (see GitHub - madssf/obsidian-remarkable: Obsidian plugin for sending files to reMarkable), however it uses a Node application (md-to-pdf) to export to PDF and uploads the result of that.

The pdf conversion provided by md-to-pdf is vastly inferior to the built-in capability in Obsidian.

If I could trigger a Obsidian-built-in PDF export from my plugin code (ideally also providing some settings like file path for the export) it would make a huge difference. However there seems to be no way of doing that from code if I am not mistaken?

Anyone got any input here?