Sorry, I should have been more specific. In PDFExporter.cs, comment out all the _streamOutPDF lines and move your SaveFileDialog lines to just before the document.Save line. If that's actually the problem, then I'll revise the class accordingly.
Close. Unfortunately SaveFileDialog has to be called by a user-initiated event, like a Button_Click event. I created a new property for a SaveFileDialog object, and passed it in from my Button_Click event after showing the dialog, then created the stream from the SaveFileDialog.OpenFile() method inside PDFExporter.cs. Thanks for the suggestion, I now have a PDF file to work with.
Unfortunately, I seem to be missing layers. How exactly does your class determine the order of your layers?
using PdfSharp.Pdf; private void PDFbutton_MouseLeftButtonUp(object sender, MouseEventArgs e) { SaveFileDialog savePDF = new SaveFileDialog(); savePDF.Filter = "PDF file format|*.pdf"; savePDF.DefaultExt = ".pdf"; if (savePDF.ShowDialog() == true) { System.IO.Stream PDFstream = savePDF.OpenFile(); PDFExporter PDFNew = new PDFExporter(); PDFNew.SetMap(myMap); PDFNew.SetOutputStream(PDFstream); PDFNew.DoExport(); } }
I got it....
Thanks Kevin! Great Tool.