Répondre

0

Pour autant que je sache, non, vous ne pouvez pas. Cependant, vous pouvez convertir DocumentViewer en XPS, puis en PDF.

+0

Avez-vous un code d'échantillon pour convertir XPS en PDF? –

0
<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); 
    } 
} 
Questions connexes