Example #1
0
        public override void Execute(ConversionFile toBeConverted)
        {
            File   file   = this.UploadFile(toBeConverted.GetStream(), toBeConverted.FileName, toBeConverted.MimeType, true);
            Stream stream = this.DownloadPdf(file.Id);

            //TODO: I wonder what the effect would be if the converter callback used QueueBackgroundWorkItem too...
            if (this.Callback != null)
            {
                var dir = Path.GetDirectoryName(toBeConverted.Path);
                if (!string.IsNullOrWhiteSpace(dir))
                {
                    var output = ConversionFile.SaveAs(stream,
                                                       Path.Combine(dir, Path.GetFileNameWithoutExtension(toBeConverted.Path) + ".pdf"));
                    Callback(toBeConverted, new List <ConversionFile>(new[] { output }).AsEnumerable());
                }
            }
        }
Example #2
0
        public override void Execute(ConversionFile toBeConverted)
        {
            File file = this.UploadFile(toBeConverted.GetStream(), toBeConverted.FileName, toBeConverted.MimeType, true);
            Stream stream = this.DownloadPdf(file.Id);

            //TODO: I wonder what the effect would be if the converter callback used QueueBackgroundWorkItem too...
            if (this.Callback != null)
            {
                var dir = Path.GetDirectoryName(toBeConverted.Path);
                if (!string.IsNullOrWhiteSpace(dir))
                {
                    var output = ConversionFile.SaveAs(stream,
                    Path.Combine(dir, Path.GetFileNameWithoutExtension(toBeConverted.Path) + ".pdf"));
                    Callback(toBeConverted, new List<ConversionFile>(new[] { output }).AsEnumerable());
                }

            }
        }