프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / ConvertService / ServiceBase / Markus.Service.Convert / ConvertService.cs @ 77cdac33

이력 | 보기 | 이력해설 | 다운로드 (25.5 KB)

1
using log4net;
2
using Markus.Message;
3
using Markus.Service.Helper;
4
using Markus.Service.Interface;
5
using System;
6
using System.Collections.Generic;
7
using System.IO;
8
using System.Linq;
9
using System.Net.Http;
10
using System.ServiceModel;
11
using System.Text;
12
using Markus.Service.Extensions;
13
using Markus.Service.WcfClient.StationServiceAsync;
14

    
15
using System.Threading.Tasks;
16
using System.Web;
17
using RestSharp;
18

    
19
namespace Markus.Service.Convert
20
{
21
    public class ConvertService : IDisposable
22
    {
23
        // 1GigaBytes
24
        protected ILog logger;
25

    
26
        readonly ProcessContext ConvertProcessContext;
27
        private string gTempFileName;
28
        private Markus.SaveTask gSaveTask;
29
        private Markus.MarkusPDF gMarkusPDF;
30

    
31
        // 컨버터 완료시 파일갯수를 체크 하여 틀리면 reconvert를 1로 하고 다시 컨버팅 하도록 한다.
32
        private int ReConvert;
33

    
34

    
35
        private StationServiceClient StationServiceClient; 
36

    
37
        /// <summary>
38
        /// 프로세스 초기화
39
        /// </summary>
40
        /// <param name="convertContext"></param>
41
        public ConvertService(ProcessContext convertContext) : base()
42
        {
43
            logger = LogManager.GetLogger(typeof(ConvertService));
44

    
45
            ConvertProcessContext = convertContext;
46
            
47
            BasicHttpBinding myBinding = new BasicHttpBinding();
48
            EndpointAddress myEndpoint = new EndpointAddress(UriHelper.UriCreate(ConvertProcessContext.ServiceStationUri));
49
            StationServiceClient = new StationServiceClient(myBinding, myEndpoint);
50
           
51
            gMarkusPDF = new MarkusPDF();
52
            gSaveTask = new SaveTask();
53
            gSaveTask.StateChangeEvent += MarkusPdfStateChangeEvent;
54
        }
55

    
56
        public ConvertService()
57
        {
58
        }
59

    
60
        public void Dispose()
61
        {
62
            try
63
            {
64
                if(gMarkusPDF != null)
65
                {
66
                    gMarkusPDF.Dispose();
67
                    gMarkusPDF = null;
68
                }
69

    
70
                if (gSaveTask != null)
71
                {
72
                    gSaveTask.StateChangeEvent -= MarkusPdfStateChangeEvent;
73
                    gSaveTask.Dispose();
74
                    gSaveTask = null;
75
                }
76

    
77
                //if (System.IO.File.Exists(gTempFileName))
78
                //{
79
                //    File.Delete(gTempFileName);
80
                //}
81

    
82
            }
83
            catch (Exception ex)
84
            {
85
               logger.Error("Convert Service Dispose Error", ex);
86
            }
87
            finally
88
            {
89
                GC.Collect(2);
90
                GC.Collect(2);
91
            }
92
        }
93

    
94
        /// <summary>
95
        ///  markus lib에서 받는 이벤트
96
        /// </summary>
97
        /// <param name="sender"></param>
98
        /// <param name="e"></param>
99
        private void MarkusPdfStateChangeEvent(object sender, Markus.Message.StateEventArgs e)
100
        {
101
            try
102
            {
103
                int currentPage = e.SaveItem.CurrentPage;
104

    
105
                if (e.SaveItem.CurrentPage == 0)    /// 초기 wait status인 경우 0일수 있다. %계산시 오류 방지
106
                {
107
                    currentPage = 1;
108
                }
109

    
110
                switch (e.SaveItem.Status)
111
                {
112
                    case StatusCodeType.None:
113
                        break;
114
                    case StatusCodeType.Wait:
115
                        break;
116
                    case StatusCodeType.PageLoading:
117
                        break;
118
                    case StatusCodeType.Saving:
119
                        break;
120
                    case StatusCodeType.Completed:
121
                        break;
122
                    case StatusCodeType.FileError:
123
                        break;
124
                    case StatusCodeType.PageError:
125
                        break;
126
                    case StatusCodeType.NeedsPassword:
127
                        break;
128
                    case StatusCodeType.Error:
129
                        break;
130
                    default:
131
                        break;
132
                }
133

    
134
                StationServiceClient.ConvertProcessStateAsync(e.SaveItem.Id, (int)e.SaveItem.Status, e.SaveItem.CurrentPage, e.SaveItem.TotalPages, e.SaveItem.ErrorMessage);
135
                
136
            }
137
            catch (Exception ex)
138
            {
139
                logger.Error($"Status Change Error", ex);
140
            }
141
        }
142

    
143
        [System.Security.Permissions.FileIOPermission(System.Security.Permissions.SecurityAction.LinkDemand)]
144
        public async Task<SaveResult> SetFileAsync()
145
        {
146
            SaveResult result = new SaveResult();
147

    
148
            SaveItem saveitem = new SaveItem
149
            {
150
                Id = ConvertProcessContext.ConvertID,
151
                PdfFilePath = ConvertProcessContext.OriginFilePath,
152
                SavePath = ConvertProcessContext.SaveDirectory,
153
                Status = StatusCodeType.None,
154
                MinimumFontSize = ConvertProcessContext.MinFontSize,
155
                UseResolution = ConvertProcessContext.UseResolution
156
            };
157

    
158
            try
159
            {
160
                StationServiceClient.ConvertProcessState(ConvertProcessContext.ConvertID, (int)StatusCodeType.Wait, 0, 0, "");
161

    
162
                result = await ConvertAsync(saveitem);
163

    
164
                // 플러그인 실행
165
                PluginService.Run(saveitem.Id);
166

    
167
                this.Dispose();
168

    
169
                StationServiceClient.ConvertFinish(saveitem.Id, (int)result.StatusCode, saveitem.CurrentPage, saveitem.TotalPages,result.Message);
170
            }
171
            catch (Exception ex)
172
            {
173
                result.StatusCode = StatusCodeType.Error;
174
                logger.Error($"File Convert Error",ex);
175
                StationServiceClient.ConvertFinish(saveitem.Id, (int)result.StatusCode, saveitem.CurrentPage, saveitem.TotalPages, $"ConvertService Error    {saveitem.Id} {ex.Message} {ex.InnerException?.ToString()}");
176
            }
177

    
178
            return result;
179
        }
180

    
181
        [System.Security.Permissions.FileIOPermission(System.Security.Permissions.SecurityAction.LinkDemand)]
182
        private async Task<SaveResult> ConvertAsync(SaveItem saveitem)
183
        { 
184
            SaveResult result = new SaveResult();
185
         
186
            try
187
            {
188
                DateTime deleteTime = DateTime.Now;
189

    
190
                while (System.IO.Directory.Exists(saveitem.SavePath))
191
                {
192
                    try
193
                    {
194
                        System.IO.Directory.Delete(saveitem.SavePath, true);
195
                    }
196
                    catch (Exception)
197
                    {
198

    
199
                    }
200

    
201
                    if ((DateTime.Now - deleteTime) > new TimeSpan(0, 5, 0))
202
                    {
203
                        string msg = $"ConvertService Error {saveitem.SavePath} Delete Error";
204
                        logger.Error(msg);
205
                        result.StatusCode = StatusCodeType.FileError;
206
                        result.Message =  LogHelper.GetStack() + " " +LogHelper.GetStack() + " " + msg;
207

    
208
                        return result;
209
                    }
210

    
211
                    System.Threading.Thread.SpinWait(10);
212
                }
213

    
214
                System.IO.Directory.CreateDirectory(saveitem.SavePath);
215

    
216
                //파일 다운로드
217
                if (await DownloadFileAsync(saveitem))
218
                {
219
                    gTempFileName = saveitem.PdfFilePath;
220

    
221
                    if(gTempFileName.ToCharArray().Any(x=>x.IsKor()))
222
                    {
223
                        gTempFileName = Path.Combine(Path.GetTempPath(), GuidExtension.shortGuid() + ".pdf");
224

    
225
                        File.Copy(saveitem.PdfFilePath, gTempFileName,true);
226

    
227
                        System.Threading.Thread.Sleep(100);
228
                    }
229

    
230
                    gMarkusPDF.pdfLoad(gTempFileName, saveitem.MinimumFontSize, saveitem.UseResolution);
231

    
232
                    if(gMarkusPDF.PageCount() > 0)
233
                    {
234
                        /// 설정된 MultiThreadMaxPages에 따른 컨버터 분기
235
                        //if (gMarkusPDF.PageCount() > ConvertProcessContext.MultiThreadMaxPages)
236
                        //{
237
                        //    // 큰 사이즈의 파일 컨버팅
238
                          result = ConvertBigFileProcess(saveitem);
239
                        //}
240
                        //else
241
                        //{
242
                        //    /// 작은 사이즈의 컨버팅
243
                        //    await Task.Factory.StartNew(new Action(() =>
244
                        //    {
245
                        //        result = gSaveTask.SaveFile(saveitem);
246
                        //    }), TaskCreationOptions.LongRunning);
247
                        //}
248

    
249
                        // 파일 체크 후 갯수가 안맞으면 다시 컨버팅한다.
250
                        if (ReConvert < 1 && (result.PageInfoList.Count() != saveitem.TotalPages
251
                                       || Directory.EnumerateFiles(saveitem.SavePath, "*.png").Count() != saveitem.TotalPages
252
                                           || Directory.EnumerateFiles(saveitem.SavePath, "*.jpg").Count() != saveitem.TotalPages))
253
                        {
254
                            result.StatusCode = StatusCodeType.PageError;
255
                            result.Message =  LogHelper.GetStack() + " " +"Page Count Error";
256
                            ReConvert = 1;
257

    
258
                            result = ConvertBigFileProcess(saveitem);
259
                        }
260

    
261

    
262
                        ///  페이지 정보 저장
263
                        if (result.PageInfoList?.Count() > 0)
264
                        {
265
                            bool docSetResult = false;
266

    
267
                            using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(ConvertProcessContext.ConnectionString))
268
                            {
269
                                List<EntityModel.DOCPAGE> docPageList = new List<EntityModel.DOCPAGE>();
270

    
271
                                docPageList = result.PageInfoList.Select(f => new EntityModel.DOCPAGE
272
                                {
273
                                    ID = GuidExtension.shortGuid(),
274
                                    PAGE_WIDTH = f.Width.ToString(),
275
                                    PAGE_HEIGHT = f.Height.ToString(),
276
                                    PAGE_NUMBER = f.PageNo
277
                                }).ToList();
278

    
279
                                docSetResult = database.SetDocumentInfo(saveitem.Id, result.PageInfoList.Count, docPageList);
280
                            }
281

    
282
                            if (docSetResult)
283
                            {
284
                                result.StatusCode = StatusCodeType.Completed;
285
                            }
286
                            else
287
                            {
288
                                result.StatusCode = StatusCodeType.FileError;
289
                                result.Message = LogHelper.GetStack() + " " + $"Doc Set Error. {result.Message}";
290
                            }
291
                        }
292
                        else
293
                        {
294
                            result.StatusCode = StatusCodeType.FileError;
295
                            result.Message = LogHelper.GetStack() + " " + $"Page List Get Error. {result.Message} ";
296
                        }
297
                    }
298
                    else
299
                    {
300
                        result.Message = $"File Error Page Count:0 - File path : { saveitem.PdfFilePath}";
301
                        result.StatusCode = StatusCodeType.FileError;
302
                    }
303

    
304
                }
305
                else
306
                {
307
                    result.Message  = $"File Download Error  - File path : { saveitem.PdfFilePath}";
308
                    result.StatusCode = StatusCodeType.FileError;
309
                }
310
            }
311
            catch (Exception ex)
312
            {
313
                result.Message =  LogHelper.GetStack() + " " +"ConvertService Convert Error" + ex.Message;
314
                result.StatusCode = StatusCodeType.Error;
315

    
316
                logger.Error(ex);
317
            }
318
            finally
319
            {
320

    
321
            }
322

    
323
            return result;
324
        }
325

    
326
        /// <summary>
327
        /// 파일 다운로드
328
        /// </summary>
329
        /// <param name="saveItem"></param>
330
        /// <returns></returns>
331
        public async Task<bool> DownloadFileAsync(SaveItem saveItem)
332
        {
333
            bool result = false;
334

    
335
            try
336
            {
337
                Uri pdfFileUri = null;
338

    
339
                //if (saveItem.PdfFilePath.Contains("VPCS_DOCLIB"))
340
                //{
341
                //    FileName = DocUri.Remove(0, DocUri.LastIndexOf("/") + 1);
342
                //    ProjectFolderPath = DownloadDir_PDF + "\\" + ConverterItem.PROJECT_NO + "_Tile"; //프로젝트 폴더
343
                //    ItemListPath = ProjectFolderPath + "\\" + (System.Convert.ToInt64(ConverterItem.DOCUMENT_ID) / 100).ToString();
344
                //    ItemPath = ItemListPath + "\\" + ConverterItem.DOCUMENT_ID;
345
                //    DownloadFilePath = ItemPath + "\\" + FileName;
346
                //}
347
                //else
348
                //{
349
                //    ProjectFolderPath = DownloadDir_PDF + "\\" + ConverterItem.PROJECT_NO + "_Tile"; //프로젝트 폴더
350
                //    ItemListPath = ProjectFolderPath + "\\" + (System.Convert.ToInt64(ConverterItem.DOCUMENT_ID) / 100).ToString();
351
                //    ItemPath = ItemListPath + "\\" + ConverterItem.DOCUMENT_ID;
352
                //    FileName = HttpUtility.ParseQueryString(new Uri(DocUri).Query).Get("fileName");
353
                //    DownloadFilePath = string.IsNullOrWhiteSpace(FileName) ? ItemPath + "\\" + FileName : ItemPath + "\\" + FileName;
354

    
355
                //}
356

    
357
                saveItem.PdfFilePath = HttpUtility.UrlDecode(saveItem.PdfFilePath); //PDF 전체 경로
358

    
359

    
360
                string FileName = "";
361
                string downloadFilePath = "";
362

    
363
                // 드라이브 경로가 포함되었는지 판단.
364
                if (Path.IsPathRooted(saveItem.PdfFilePath))
365
                {
366
                    FileInfo file = new FileInfo(saveItem.PdfFilePath);
367

    
368
                    if (file.Exists)
369
                    {
370
                        FileName = file.Name;
371
                        downloadFilePath = System.IO.Path.Combine(saveItem.SavePath, FileName);
372
                        file.CopyTo(downloadFilePath, true);
373
                    }
374
                    else
375
                    {
376
                        throw new Exception("File Not Found. Please, check the file path.");
377
                    }
378
                }
379
                else if (Uri.TryCreate(saveItem.PdfFilePath, UriKind.RelativeOrAbsolute, out pdfFileUri))
380
                {
381
                    try
382
                    {
383
                       
384
                        downloadFilePath = await RestDownloadAsync(pdfFileUri, saveItem.SavePath);
385
                        /*bseng
386
   */
387
                        /* 벽산으로 임시 주석 
388
                        
389
                        FileName = DownloadUri.GetFileName(saveItem.PdfFilePath);
390
                        downloadFilePath = System.IO.Path.Combine(saveItem.SavePath, FileName);
391

    
392
                         using (System.Net.WebClient webClient = new System.Net.WebClient())
393
                         {
394
                             webClient.UseDefaultCredentials = true;//.Headers.Add("Authorization: BASIC SGVsbG8="); //가상의 인증
395
                             webClient.Proxy = null;
396
                             if (!System.IO.Directory.Exists(ConvertProcessContext.TempDirectory))
397
                             {
398
                                 System.IO.Directory.CreateDirectory(ConvertProcessContext.TempDirectory);
399
                             }
400

    
401
                             webClient.DownloadFile(pdfFileUri, downloadFilePath);
402

    
403
                             webClient.Dispose();
404
                         }
405
                       *    */
406
                        await Task.Delay(300);
407
                    }
408
                    catch (Exception ex)
409
                    {
410
                        logger.Error(ex);
411
                        throw new Exception($"File Download Error. Please, check the file path. {pdfFileUri}");
412
                    }
413
                }
414
                else
415
                {
416
                    throw new Exception("Please, check the file path.");
417
                }
418

    
419
                try
420
                {
421
                    if (File.Exists(downloadFilePath))
422
                    {
423
                        var file = File.Open(downloadFilePath, FileMode.Open);
424

    
425
                        if (file.Length == 0)
426
                        {
427
                            throw new Exception("File Size 0. Please, check the file path.");
428
                        }
429

    
430
                        file.Close();
431
                        file.Dispose();
432

    
433
                        saveItem.PdfFilePath = downloadFilePath;
434
                        result = true;
435

    
436
                    }
437
                }
438
                catch (Exception ex)
439
                {
440
                    logger.Error(ex);
441
                    throw new Exception("File Error ." + downloadFilePath);
442
                }
443
            }
444
            catch (Exception ex)
445
            {
446
                logger.Error(ex);
447
                throw new Exception(ex.ToString());
448
            }
449

    
450
            return result;
451
        }
452

    
453
        private  async Task<string> RestDownloadAsync(Uri uri,string savePath)
454
        {
455
            string downloadFilePath = "";
456

    
457
            var client = new RestClient(uri);
458
            client.Timeout = -1;
459
            var request = new RestRequest(Method.GET);
460
            IRestResponse response = await client.ExecuteAsync(request);
461

    
462
            if (response.StatusCode == System.Net.HttpStatusCode.OK)
463
            {
464
                var fileName = DownloadUri.GetFileNameInDisposition(new System.Net.Mime.ContentDisposition(response.Headers.Where(x => x.Name == "Content-Disposition").First().Value.ToString()));
465

    
466
                downloadFilePath = System.IO.Path.Combine(savePath, fileName);
467

    
468
                var fs = File.Create(downloadFilePath);
469

    
470
                await fs.WriteAsync(response.RawBytes, 0, response.RawBytes.Length);
471
                fs.Close();
472
            }
473
           
474
            //var fileInfo = new FileInfo(downloadFilePath);
475

    
476
            //using (var fileStream = fileInfo.OpenWrite())
477
            //{
478
            //    await fileStream.WriteAsync(response.RawBytes, 0, response.RawBytes.Length);
479
            //    fileStream.Close();
480
            //    //int position = 0;
481
            //    //int step = 300000;
482
            //    //int length = 300000;
483

    
484
            //    //while (position < response.RawBytes.Length)
485
            //    //{
486
            //    //    if (position + step < response.RawBytes.Length)
487
            //    //    {
488
            //    //        length = position + step;
489
            //    //    }
490
            //    //    else
491
            //    //    {
492
            //    //        length = response.RawBytes.Length - position;
493
            //    //    }
494

    
495
            //    //    await fileStream.WriteAsync(response.RawBytes, position, length);
496

    
497
            //    //    position = position + step;
498
            //    //}
499
            //}
500

    
501
            return downloadFilePath;
502
        }
503

    
504
        /// <summary>
505
        /// 큰파일 변환
506
        /// </summary>
507
        /// <param name="saveitem"></param>
508
        /// <returns></returns>
509
        private SaveResult ConvertBigFileProcess(SaveItem saveitem)
510
        {
511
            SaveResult result = new SaveResult();
512

    
513
            try
514
            {
515
                saveitem.TotalPages = gMarkusPDF.PageCount();
516

    
517
                for (int currentPageNo = 1; currentPageNo <= saveitem.TotalPages; currentPageNo++)
518
                {
519
                    try
520
                    {
521
                        string saveFile = Path.Combine(saveitem.SavePath, $"{currentPageNo}.png");
522

    
523
                        if (ReConvert < 1 || (ReConvert == 1 && !File.Exists(saveFile)))
524
                         {
525

    
526
                            var saveResult = gMarkusPDF.SavePage(currentPageNo, saveFile);
527

    
528
                            saveitem.Status = StatusCodeType.Saving;
529
                            saveitem.CurrentPage = currentPageNo;
530
                            saveitem.ErrorMessage = saveResult.Message;
531

    
532
                            int pageListCount = 0;
533

    
534
                            if(result.PageInfoList != null)
535
                            {
536
                                pageListCount = result.PageInfoList.Count(f => f.PageNo == saveResult.SavePageInfo.PageNo);
537
                            }
538
                            
539
                            if (pageListCount == 0)
540
                            {
541
                                result.PageInfoAdd(saveResult.SavePageInfo);
542
                            }
543

    
544
                            MarkusPdfStateChangeEvent(this, new StateEventArgs(saveitem));
545
                            Console.WriteLine($"CurrentPage : {currentPageNo}");
546

    
547
                            /// 설정된 최대 페이지이거나 설정된 메모리보다 크면 릴리즈
548
                            if ((currentPageNo % ConvertProcessContext.MultiThreadMaxPages == 0 && ConvertProcessContext.MultiThreadMaxPages  > 0)
549
                                || ConvertProcessContext.ReleaseWorkMemory < Environment.WorkingSet)
550
                            {
551
                                Console.WriteLine($"physical memory : {Environment.WorkingSet}");
552

    
553
                                gMarkusPDF.Dispose();
554
                                gMarkusPDF = null;
555
                                System.Threading.Thread.SpinWait(5);
556

    
557
                                gMarkusPDF = new MarkusPDF();
558
                                gMarkusPDF.pdfLoad(gTempFileName, saveitem.MinimumFontSize, saveitem.UseResolution);
559
                            }
560

    
561
                            System.Threading.Thread.SpinWait(2);
562
                        }
563
                    }
564
                    catch (Exception ex)
565
                    {
566
                        result.StatusCode = StatusCodeType.PageError;
567
                        result.Message =  LogHelper.GetStack() + " " +"Save Error - " + ex.Message;
568

    
569
                        if (gMarkusPDF != null)
570
                        {
571
                            gMarkusPDF.Dispose();
572
                            gMarkusPDF = null;
573
                        }
574

    
575
                        gMarkusPDF = new MarkusPDF();
576
                        gMarkusPDF.pdfLoad(gTempFileName, saveitem.MinimumFontSize, saveitem.UseResolution);
577

    
578
                        currentPageNo = currentPageNo - 1;
579
                    }
580
                    finally
581
                    {
582
                     
583
                    }
584
                }
585

    
586
                result.StatusCode = StatusCodeType.Completed;
587
            }
588
            catch (Exception ex)
589
            {
590
                result.StatusCode = StatusCodeType.Error;
591
                result.Message =  LogHelper.GetStack() + " " +ex.Message;
592
            }
593

    
594
            return result;
595
        }
596

    
597
        public bool Stop()
598
        {
599
            try
600
            {
601
                gSaveTask.Dispose();
602
            }
603
            catch (Exception ex)
604
            {
605
                System.Diagnostics.Debug.WriteLine(ex.ToString());
606
            }
607

    
608
            return true;
609
        }
610

    
611

    
612
        /// <summary>
613
        /// 사용안함
614
        /// </summary>
615
        /// <param name="param"></param>
616
        /// <returns></returns>
617
        //[System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptions]
618
        //[System.Security.Permissions.FileIOPermission(System.Security.Permissions.SecurityAction.LinkDemand)]
619
        //private SaveResult SetFile()
620
        //{
621
        //    var saveitem = new SaveItem
622
        //    {
623
        //        Id = ConvertProcessContext.ConvertID,
624
        //        PdfFilePath = ConvertProcessContext.OriginFilePath,
625
        //        SavePath = ConvertProcessContext.SaveDirectory,
626
        //        Status = StatusCodeType.None
627
        //    };
628

    
629
        //    if (System.IO.Directory.Exists(saveitem.SavePath))
630
        //    {
631
        //        System.IO.Directory.Delete(saveitem.SavePath, true);
632
        //    }
633

    
634
        //    System.IO.Directory.CreateDirectory(saveitem.SavePath);
635

    
636
        //    try
637
        //    {
638
        //        Uri pdfFileUri = null;
639

    
640
        //        if (Uri.TryCreate(saveitem.PdfFilePath, UriKind.RelativeOrAbsolute, out pdfFileUri))
641
        //        {
642
        //            using (System.Net.WebClient webClient = new System.Net.WebClient())
643
        //            {
644
        //                webClient.UseDefaultCredentials = true;//.Headers.Add("Authorization: BASIC SGVsbG8="); //가상의 인증
645

    
646
        //                if (!System.IO.Directory.Exists(ConvertProcessContext.TempDirectory))
647
        //                {
648
        //                    System.IO.Directory.CreateDirectory(ConvertProcessContext.TempDirectory);
649
        //                }
650

    
651
        //                var downloadFilePath = System.IO.Path.Combine(ConvertProcessContext.TempDirectory, saveitem.Id.Replace("-", "") + ".pdf");
652
        //                webClient.DownloadFile(pdfFileUri, downloadFilePath);
653

    
654
        //                saveitem.PdfFilePath = downloadFilePath;
655
        //            }
656
        //        }
657
        //    }
658
        //    catch (Exception ex)
659
        //    {
660
        //        throw new Exception($"File Download Error  - File path : {saveitem.PdfFilePath}");
661
        //    }
662

    
663
        //    StationServiceClient.ConvertProcessStateAsync(saveitem.Id, (int)saveitem.Status, saveitem.CurrentPage, saveitem.TotalPages, saveitem.ErrorMessage);
664

    
665
        //    var result = gSaveTask.SaveFile(saveitem);
666

    
667
        //    return result;
668
        //}
669

    
670
    }
671
}
클립보드 이미지 추가 (최대 크기: 500 MB)