Refactor: Organize main.js

This pull request splits main.js into several logic-related modules.

##### main.js
`main.js` is now responsible for registering commands and menu items and command handling.

##### Dialog.js
`Dialogs.js ` is responsible for displaying the export and error dialogs.

##### PDFDocument.js
`PDFDocument.js` is responsible for creating and saving the PDF document from source files.