Экспорт в WPF Document Viewer в PDF

Привет! Я использую средство просмотра документов WPF для просмотра документа. Есть ли способ сохранить документ в формате PDF?

<DocumentViewer Name="documentViewer" />

Я использую WPFReports для создания отчета.

2 ответа

<Label>
  <Hyperlink Click="lnkSelectDocument_Click">
    <Label Content="{Binding ShortFielName}">
    </Label>
  </Hyperlink> 
</Label>


private void lnkSelectDocument_Click(object sender, RoutedEventArgs e) {
  try {
    System.Diagnostics.Process process = new System.Diagnostics.Process();
    string path = "d:\\test.doc";
    Uri pdf = new Uri(path, UriKind.RelativeOrAbsolute);
    process.StartInfo.FileName = pdf.LocalPath;
    process.Start();
    process.WaitForExit();
  } catch (Exception error) {
    MessageBox.Show("Could not open the file.", "Error", MessageBoxButton.OK,
      MessageBoxImage.Warning);
  }
}

Насколько я знаю, нет, ты не можешь. Однако вы можете отобразить DocumentViewer в XPS, а затем в PDF.

Другие вопросы по тегам