private void cmdShowAllAnotations_Click(object sender, RoutedEventArgs e) { IList<Annotation> annotations = service.Store.GetAnnotations(); foreach (Annotation annotation in annotations) { // Check for text information. if (annotation.Cargos.Count > 1) { string base64Text = annotation.Cargos[1].Contents[0].InnerText; byte[] decoded = Convert.FromBase64String(base64Text); MemoryStream m = new MemoryStream(); m.Write(decoded, 0, decoded.Length); m.Position = 0; StreamReader r = new StreamReader(m); string annotationXaml = r.ReadToEnd(); MessageBox.Show(annotationXaml); } } PrintDialog dialog = new PrintDialog(); bool? result = dialog.ShowDialog(); if (result != null && result.Value) { System.Windows.Xps.XpsDocumentWriter writer = System.Printing.PrintQueue.CreateXpsDocumentWriter(dialog.PrintQueue); AnnotationDocumentPaginator adp = new AnnotationDocumentPaginator( ((IDocumentPaginatorSource)docReader.Document).DocumentPaginator, service.Store); writer.Write(adp); } }
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { AnnotationDocumentPaginator paginator = new AnnotationDocumentPaginator(dv.Document.DocumentPaginator, ans.Store); PrintDialog pd = new PrintDialog(); pd.PrintDocument(paginator, "annotiationPrint"); }