public static bool GenerateAndCompareAgainstPdf(TestContext testContext, IPDFReport report, string filenameShall, int nAcceptedDifferences = 0) { string filenameOutput = report.ProposeFilePath(); report.Generate(filenameOutput); return(CompareAgainstPdf(testContext, filenameOutput, filenameShall, nAcceptedDifferences)); }
public static void CreateAndOpenReport(IPDFReport report) { if (report == null) { return; } Microsoft.Win32.SaveFileDialog openFileDialog = new Microsoft.Win32.SaveFileDialog(); string filePath = report.ProposeFilePath(); openFileDialog.FileName = System.IO.Path.GetFileName(filePath); openFileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(filePath); openFileDialog.DefaultExt = ".pdf"; openFileDialog.Filter = "PDF documents (.pdf)|*.pdf"; try { if (openFileDialog.ShowDialog() == true) { filePath = openFileDialog.FileName; report.Generate(filePath); System.Diagnostics.Process.Start(filePath); } } catch (Exception ex) { System.Windows.MessageBox.Show( "Datei " + System.IO.Path.GetFileName(filePath) + " konnte nicht gespeichert werden.\n\n" + ex.Message, "Fehler", System.Windows.MessageBoxButton.OK, MessageBoxImage.Exclamation); } }