private void CreatePdf(Dictionary<int, IExerciseDefinition> exercises) { var pdfGen = new PdfGenerator(ConfigSettings.RootPath); pdfGen.InitializePage(DateTime.Now); for (var i = 0; i < 25; i++) { var currentEx = _randomNumberGenerator.GetRandomNumber(0, exercises.Count); try { pdfGen.AddLine(string.Format("{0:00}. {1}", i + 1, exercises[currentEx].CreateExercise(_randomNumberGenerator))); } catch (Exception e) { pdfGen.AddLine(string.Format("fout bij oefening {0}: {1}", exercises[currentEx].Name, e.Message)); } } pdfGen.Write(); }