In this step you'll save the document using the Save method.
In the MainPage.xaml.cs file immediately following the code you used to add content to the document in step 2, add the following code:
// Save the document
SaveFileDialog dlg = this.GetFileDialog();
if (dlg != null)
{
using (Stream stream = dlg.OpenFile())
{
pdf.Save(stream);
}
}
}
private SaveFileDialog GetFileDialog()
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.DefaultExt = ".pdf";
bool? dr = dlg.ShowDialog();
return ((dr.HasValue && dr.Value) ? dlg : null);
}