개정판 c73426a9
issue #926 이미지생성오류(imagecontrol, 외부이미지붙여넣기, symbol)
Change-Id: I5376bab4a5bff122eee8e0f38aa49b0e64d18c0b
KCOM/Common/Converter/SvgConverter.cs | ||
---|---|---|
9 | 9 |
{ |
10 | 10 |
class SvgConverter |
11 | 11 |
{ |
12 |
//public DOCUMENT_ITEM _DocItem; |
|
13 |
|
|
14 | 12 |
public void SvgConvert(string fileurl, string guid, string DOCUMENT_NO) |
15 | 13 |
{ |
16 |
var defaultBitmapImage = new BitmapImage(); |
|
17 |
defaultBitmapImage.BeginInit(); |
|
18 |
defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
|
19 |
defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
|
20 |
defaultBitmapImage.UriSource = new Uri(fileurl); |
|
21 |
defaultBitmapImage.EndInit(); |
|
14 |
try |
|
15 |
{ |
|
16 |
var defaultBitmapImage = new BitmapImage(); |
|
17 |
defaultBitmapImage.BeginInit(); |
|
18 |
defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
|
19 |
defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
|
20 |
defaultBitmapImage.UriSource = new Uri(fileurl); |
|
21 |
defaultBitmapImage.EndInit(); |
|
22 | 22 |
|
23 |
GC.Collect(); |
|
24 |
System.Drawing.Bitmap image; |
|
23 |
GC.Collect();
|
|
24 |
System.Drawing.Bitmap image;
|
|
25 | 25 |
|
26 |
if (defaultBitmapImage.IsDownloading) |
|
27 |
{ |
|
28 |
defaultBitmapImage.DownloadCompleted += (ex, arg) => |
|
26 |
if (defaultBitmapImage.IsDownloading) |
|
29 | 27 |
{ |
30 |
defaultBitmapImage.Freeze(); |
|
31 |
GC.Collect(); |
|
28 |
defaultBitmapImage.DownloadCompleted += (ex, arg) => |
|
29 |
{ |
|
30 |
defaultBitmapImage.Freeze(); |
|
31 |
GC.Collect(); |
|
32 | 32 |
|
33 |
image = GetBitmap(defaultBitmapImage); |
|
33 |
image = GetBitmap(defaultBitmapImage);
|
|
34 | 34 |
|
35 |
image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp); |
|
35 |
image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
|
|
36 | 36 |
|
37 |
Process potrace = new Process |
|
38 |
{ |
|
39 |
StartInfo = new ProcessStartInfo |
|
37 |
Process potrace = new Process |
|
40 | 38 |
{ |
41 |
//FileName = @"http://cloud.devdoftech.co.kr:5977/UserData/"+ "potrace.exe", |
|
42 |
FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe", |
|
43 |
//Arguments = "-s -u 1", //SVG |
|
44 |
//Arguments = "- -o- --svg", |
|
45 |
//Arguments = filename2 + " --backend svg", |
|
46 |
//Arguments = @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp" + " --backend svg -i", |
|
47 |
//Arguments = "-b svg -i " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", |
|
48 |
Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", |
|
49 |
RedirectStandardInput = true, |
|
50 |
RedirectStandardOutput = true, |
|
51 |
//RedirectStandardError = Program.IsDebug, |
|
52 |
RedirectStandardError = true, |
|
53 |
UseShellExecute = false, |
|
54 |
CreateNoWindow = true, |
|
55 |
WindowStyle = ProcessWindowStyle.Hidden |
|
56 |
}, |
|
57 |
EnableRaisingEvents = false |
|
58 |
}; |
|
39 |
StartInfo = new ProcessStartInfo |
|
40 |
{ |
|
41 |
//FileName = @"http://cloud.devdoftech.co.kr:5977/UserData/"+ "potrace.exe", |
|
42 |
FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe", |
|
43 |
//Arguments = "-s -u 1", //SVG |
|
44 |
//Arguments = "- -o- --svg", |
|
45 |
//Arguments = filename2 + " --backend svg", |
|
46 |
//Arguments = @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp" + " --backend svg -i", |
|
47 |
//Arguments = "-b svg -i " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", |
|
48 |
Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", |
|
49 |
RedirectStandardInput = true, |
|
50 |
RedirectStandardOutput = true, |
|
51 |
//RedirectStandardError = Program.IsDebug, |
|
52 |
RedirectStandardError = true, |
|
53 |
UseShellExecute = false, |
|
54 |
CreateNoWindow = true, |
|
55 |
WindowStyle = ProcessWindowStyle.Hidden |
|
56 |
}, |
|
57 |
EnableRaisingEvents = false |
|
58 |
}; |
|
59 | 59 |
|
60 |
StringBuilder svgBuilder = new StringBuilder(); |
|
61 |
potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => { |
|
62 |
svgBuilder.AppendLine(e2.Data); |
|
63 |
}; |
|
60 |
StringBuilder svgBuilder = new StringBuilder(); |
|
61 |
potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => |
|
62 |
{ |
|
63 |
svgBuilder.AppendLine(e2.Data); |
|
64 |
}; |
|
65 |
|
|
66 |
potrace.Start(); |
|
64 | 67 |
|
65 |
potrace.Start(); |
|
66 | 68 |
|
69 |
byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp"); |
|
70 |
kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
|
71 |
fileurl = fileUploader.Run(App.ViewInfo.ProjectNO, DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes); |
|
67 | 72 |
|
68 |
byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp"); |
|
69 |
kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
|
70 |
fileurl = fileUploader.Run(App.ViewInfo.ProjectNO, DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes); |
|
71 |
}; |
|
73 |
Check_Uri.UriCheck(fileurl); |
|
74 |
}; |
|
75 |
} |
|
76 |
} |
|
77 |
catch (Exception ex) |
|
78 |
{ |
|
79 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert"); |
|
72 | 80 |
} |
73 | 81 |
} |
74 | 82 |
|
내보내기 Unified diff