PDF for WPF and Silverlight Overview > Getting Started > Quick Start > Step 3 of 4: Saving the document |
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:
C# |
Copy Code
|
---|---|
// Save the document
SaveFileDialog dlg = this.GetFileDialog(); { if (dlg != null) { using (Stream stream = dlg.OpenFile()) { pdf.Save(stream); } } }
{ SaveFileDialog dlg = new SaveFileDialog(); dlg.DefaultExt = ".pdf"; bool? dr = dlg.ShowDialog(); return ((dr.HasValue && dr.Value) ? dlg : null); } |