I created a scheduled task that is supposed to scrape data from a website, store this in the database, create a daily pdf and send a weekly mail.
The first 2 parts run smoothly, but it seems that the other 2 are skipped regardless of what I try to do.
Creating a file is not the problem because it creates a daily .log file and writes to it.
For the pdf I use the PdfSharp library, for the mail the System.Net.Mail.
PdfDocumentRenderer renderer = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);
renderer.Document = document;
renderer.RenderDocument();
string directory = DateTime.Now.Year.ToString();
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
string filename = directory + @"\NewCos" + DateTime.Now.DayOfWeek + ".pdf";
if (renderer.PageCount > 0)
renderer.PdfDocument.Save(filename);
Any help would be much appreciated.
It were simply some components that were not installed and the fact that I used relative paths iso fixed direcory settings