NEW: dialog to generate pdf is working, needs adaptation from exportToPDF.