Пример #1
0
        private void SaveCleanDocument(Stream inputDoc, string fileId, DocumentType docType)
        {
            Stream resultClean = _annotator.RemoveAnnotationStream(inputDoc, docType);

            resultClean.Seek(0, SeekOrigin.Begin);
            var uploadDir = HttpContext.Current.Server.MapPath("~/App_Data");

            var filePath = Path.Combine(uploadDir, fileId);

            if (!Directory.Exists(uploadDir))
            {
                Directory.CreateDirectory(uploadDir);
            }
            using (var stream = File.Create(filePath))
            {
                resultClean.Seek(0, SeekOrigin.Begin);
                resultClean.CopyTo(stream);
            }
            inputDoc.Dispose();
            resultClean.Dispose();
        }
        private void SaveCleanDocument(Stream inputDoc, string fileId, DocumentType docType)
        {
            Stream resultClean = _annotator.RemoveAnnotationStream(inputDoc, docType);
            resultClean.Seek(0, SeekOrigin.Begin);
            var uploadDir = HttpContext.Current.Server.MapPath("~/App_Data");

            var filePath = Path.Combine(uploadDir, fileId);

            if(!Directory.Exists(uploadDir))
            {
                Directory.CreateDirectory(uploadDir);
            }
            using(var stream = File.Create(filePath))
            {
                resultClean.Seek(0, SeekOrigin.Begin);
                resultClean.CopyTo(stream);
            }
            inputDoc.Dispose();
            resultClean.Dispose();
        }