private void CreatePicDir(int dID, string path) { if (!Directory.Exists(path)) { //string pdfPath = Server.MapPath("/Cache/PDF/" + dID + "/"); Directory.CreateDirectory(path); string pdfFilePath = Path.Combine(path, "test.pdf"); if (!System.IO.File.Exists(pdfFilePath)) { var file = _repository.GetFileDataById(dID); System.IO.File.WriteAllBytes(pdfFilePath, file == null ? null : file.Content); } lock (pdf) { pdf.pdf2jpg(pdfFilePath, dID, path); } } }