markus / FinalService / KCOM_FinalService / MarkupToPDF / MarkupToPDF.cs @ 582896d2
이력 | 보기 | 이력해설 | 다운로드 (69.1 KB)
1 |
using IFinalPDF; |
---|---|
2 |
using iTextSharp.text.pdf; |
3 |
using KCOMDataModel.Common; |
4 |
using KCOMDataModel.DataModel; |
5 |
using MarkupToPDF.Controls.Common; |
6 |
using MarkupToPDF.Serialize.Core; |
7 |
using MarkupToPDF.Serialize.S_Control; |
8 |
using System; |
9 |
using System.Collections.Generic; |
10 |
using System.Configuration; |
11 |
using System.IO; |
12 |
using System.Linq; |
13 |
using System.Net; |
14 |
using System.Runtime.InteropServices; |
15 |
using System.Text; |
16 |
using System.Web; |
17 |
using System.Windows; |
18 |
using System.Windows.Media; |
19 |
|
20 |
namespace MarkupToPDF |
21 |
{ |
22 |
public class MarkupToPDF : IDisposable |
23 |
{ |
24 |
#region 초기 데이터 |
25 |
private static iTextSharp.text.Rectangle mediaBox; |
26 |
private FileInfo PdfFilePath = null; |
27 |
private FileInfo FinalPDFPath = null; |
28 |
private string _FinalPDFStorgeLocal = null; |
29 |
private string _FinalPDFStorgeRemote = null; |
30 |
private string OriginFileName = null; |
31 |
public FINAL_PDF FinalItem; |
32 |
public DOCINFO DocInfoItem = null; |
33 |
public List<DOCPAGE> DocPageItem = null; |
34 |
public MARKUP_INFO MarkupInfoItem = null; |
35 |
public List<MARKUP_DATA> MarkupDataSet = null; |
36 |
//private string _PrintPDFStorgeLocal = null; |
37 |
//private string _PrintPDFStorgeRemote = null; |
38 |
public event EventHandler<MakeFinalErrorArgs> FinalMakeError; |
39 |
public event EventHandler<EndFinalEventArgs> EndFinal; |
40 |
|
41 |
private iTextSharp.text.Rectangle pdfSize { get; set; } |
42 |
private double pageW = 0; |
43 |
private double pageH = 0; |
44 |
|
45 |
//private const double zoomLevel = 3.0; |
46 |
private const double zoomLevel = 1.0; // 지금은 3배수로 곱하지 않고 있음 |
47 |
#endregion |
48 |
|
49 |
#region 메서드 |
50 |
public static bool IsLocalIPAddress(string host) |
51 |
{ |
52 |
try |
53 |
{ |
54 |
IPAddress[] hostIPs = Dns.GetHostAddresses(host); |
55 |
IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName()); |
56 |
|
57 |
foreach (IPAddress hostIP in hostIPs) |
58 |
{ |
59 |
if (IPAddress.IsLoopback(hostIP)) return true; |
60 |
|
61 |
foreach (IPAddress localIP in localIPs) |
62 |
{ |
63 |
if (hostIP.Equals(localIP)) return true; |
64 |
} |
65 |
} |
66 |
} |
67 |
catch { } |
68 |
return false; |
69 |
} |
70 |
|
71 |
private void SetNotice(string finalID, string message) |
72 |
{ |
73 |
if (FinalMakeError != null) |
74 |
{ |
75 |
FinalMakeError(this, new MakeFinalErrorArgs { FinalID = finalID, Message = message }); |
76 |
} |
77 |
} |
78 |
|
79 |
private string GetFileName(string hrefLink) |
80 |
{ |
81 |
try |
82 |
{ |
83 |
if (hrefLink.Contains("vpcs_doclib")) |
84 |
{ |
85 |
return System.IO.Path.GetFileName(hrefLink.Replace("/", "\\")); |
86 |
} |
87 |
else |
88 |
{ |
89 |
Uri fileurl = new Uri(hrefLink); |
90 |
int index = hrefLink.IndexOf("?"); |
91 |
string filename = HttpUtility.ParseQueryString(fileurl.Query).Get("fileName"); |
92 |
return filename; |
93 |
} |
94 |
} |
95 |
catch (Exception ex) |
96 |
{ |
97 |
throw ex; |
98 |
} |
99 |
} |
100 |
|
101 |
public Point GetPdfPointSystem(Point point) |
102 |
{ |
103 |
/// 주어진 좌표를 pdf의 (Left, Top - Bottom(?)) 좌표에 맞추어 변환한다. |
104 |
return new Point(pdfSize.Left + (float)(point.X / scaleWidth), pdfSize.Top - (float)(point.Y / scaleHeight) - pdfSize.Bottom); |
105 |
} |
106 |
|
107 |
public double GetPdfSize(double size) |
108 |
{ |
109 |
return (size / scaleWidth); |
110 |
} |
111 |
|
112 |
public List<Point> GetPdfPointSystem(List<Point> point) |
113 |
{ |
114 |
List<Point> dummy = new List<Point>(); |
115 |
foreach (var item in point) |
116 |
{ |
117 |
dummy.Add(GetPdfPointSystem(item)); |
118 |
} |
119 |
return dummy; |
120 |
} |
121 |
|
122 |
public double returnAngle(Point start, Point end) |
123 |
{ |
124 |
double angle = MathSet.getAngle(start.X, start.Y, end.X, end.Y); |
125 |
//angle *= -1; |
126 |
|
127 |
angle += 90; |
128 |
//if (angle < 0) |
129 |
//{ |
130 |
// angle = angle + 360; |
131 |
//} |
132 |
return angle; |
133 |
} |
134 |
|
135 |
#endregion |
136 |
|
137 |
#region 생성자 & 소멸자 |
138 |
public void MakeFinalPDF(object _FinalPDF) |
139 |
{ |
140 |
|
141 |
DOCUMENT_ITEM documentItem; |
142 |
FINAL_PDF FinalPDF = (FINAL_PDF)_FinalPDF; |
143 |
FinalItem = FinalPDF; |
144 |
|
145 |
|
146 |
string PdfFilePathRoot = null; |
147 |
string TestFile = System.IO.Path.GetTempFileName(); |
148 |
|
149 |
#region 문서 경로를 가져오는 것과 Status를 Create (1단계) 로 수정 |
150 |
try |
151 |
{ |
152 |
using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
153 |
{ |
154 |
var _properties = _entity.PROPERTIES.Where(pro => pro.PROPERTY == FinalPDF.PROJECT_NO); |
155 |
|
156 |
if (_properties.Count() > 0) |
157 |
{ |
158 |
PdfFilePathRoot = _properties.Where(t => t.TYPE == PropertiesType.Const_TileSorcePath).First().VALUE; |
159 |
_FinalPDFStorgeLocal = _properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeLocal).First().VALUE; |
160 |
_FinalPDFStorgeRemote = _properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeRemote).First().VALUE; |
161 |
} |
162 |
else |
163 |
{ |
164 |
SetNotice(FinalPDF.ID, "프로퍼티를 가지고 올 수 없습니다."); |
165 |
return; |
166 |
} |
167 |
var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID); |
168 |
if (finalList.Count() > 0) |
169 |
{ |
170 |
finalList.FirstOrDefault().START_DATETIME = DateTime.Now; |
171 |
finalList.FirstOrDefault().STATUS = (int)FinalStatus.Create; |
172 |
_entity.SaveChanges(); |
173 |
} |
174 |
|
175 |
} |
176 |
} |
177 |
catch (Exception ex) |
178 |
{ |
179 |
SetNotice(FinalPDF.ID, "프로퍼티 에러: " + ex.ToString()); |
180 |
return; |
181 |
} |
182 |
#endregion |
183 |
|
184 |
#region 문서 복사 |
185 |
try |
186 |
{ |
187 |
using (CIEntities _entity = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(FinalPDF.PROJECT_NO).ToString())) |
188 |
{ |
189 |
var _DOCINFO = _entity.DOCINFO.Where(doc => doc.ID == FinalPDF.DOCINFO_ID); |
190 |
|
191 |
if (_DOCINFO.Count() > 0) |
192 |
{ |
193 |
DocInfoItem = _DOCINFO.FirstOrDefault(); |
194 |
DocPageItem = DocInfoItem.DOCPAGE.ToList(); |
195 |
|
196 |
PdfFilePathRoot = PdfFilePathRoot + @"\" + FinalPDF.PROJECT_NO + "_Tile" + @"\" |
197 |
+ (System.Convert.ToInt64(FinalPDF.DOCUMENT_ID) / 100).ToString() |
198 |
+ @"\" + FinalPDF.DOCUMENT_ID + @"\"; |
199 |
|
200 |
MarkupInfoItem = DocInfoItem.MARKUP_INFO.Where(data => data.CONSOLIDATE == 1 && data.AVOID_CONSOLIDATE == 0 && data.PART_CONSOLIDATE == 0).FirstOrDefault(); |
201 |
|
202 |
if (MarkupInfoItem == null) |
203 |
{ |
204 |
throw new Exception("콘솔리데잇이 작업 요청 후에 수정 / 삭제 되었습니다"); |
205 |
} |
206 |
else |
207 |
{ |
208 |
if (MarkupInfoItem.MARKUP_INFO_VERSION.Count > 0) |
209 |
{ |
210 |
MarkupDataSet = MarkupInfoItem.MARKUP_INFO_VERSION.OrderBy(d => d.CREATE_DATE).LastOrDefault().MARKUP_DATA.ToList().OrderBy(d => d.PAGENUMBER).ToList(); |
211 |
} |
212 |
else |
213 |
{ |
214 |
throw new Exception("MARKUP_INFO_VERSION 이 존재 하지 않습니다"); |
215 |
} |
216 |
} |
217 |
|
218 |
documentItem = _entity.DOCUMENT_ITEM.Where(data => data.DOCUMENT_ID == DocInfoItem.DOCUMENT_ID).FirstOrDefault(); |
219 |
if (documentItem == null) |
220 |
{ |
221 |
throw new Exception("DocInfo와 DocumentItem의 documentItemID가 같지 않습니다. 데이터를 확인해주세요"); |
222 |
} |
223 |
|
224 |
var _files = new DirectoryInfo(PdfFilePathRoot).GetFiles("*.pdf"); //해당 폴더에 파일을 |
225 |
|
226 |
#region 파일 체크 |
227 |
if (_files.Count() == 1) |
228 |
{ |
229 |
if (_files.First().Name.ToLower() == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower())) |
230 |
{ |
231 |
OriginFileName = _files.First().Name; |
232 |
PdfFilePath = _files.First().CopyTo(TestFile, true); |
233 |
} |
234 |
else |
235 |
{ |
236 |
throw new Exception("현재 폴더 내 파일명이 데이터베이스와 상이합니다.filename:" + _files.First().Name.ToLower() + ",url:" + HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower()); |
237 |
} |
238 |
} |
239 |
else if (_files.Count() > 1) |
240 |
{ |
241 |
var originalFile = _files.Where(data => data.Name == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE))).FirstOrDefault(); |
242 |
|
243 |
if (originalFile == null) |
244 |
{ |
245 |
throw new Exception("해당 폴더에 복수로 PDF들 존재하고 document_Item의 문서는 존재하지 않습니다"); |
246 |
} |
247 |
else |
248 |
{ |
249 |
OriginFileName = originalFile.Name; |
250 |
PdfFilePath = originalFile.CopyTo(TestFile, true); |
251 |
} |
252 |
} |
253 |
else |
254 |
{ |
255 |
throw new Exception("PDF를 찾지 못하였습니다"); |
256 |
} |
257 |
#endregion |
258 |
|
259 |
#region 예외처리 |
260 |
if (PdfFilePath == null) |
261 |
{ |
262 |
throw new Exception("작업에 필요한 PDF가 정상적으로 복사되지 않았거나 DB정보가 상이합니다"); |
263 |
} |
264 |
if (!PdfFilePath.Exists) |
265 |
{ |
266 |
throw new Exception("PDF원본이 존재하지 않습니다"); |
267 |
} |
268 |
#endregion |
269 |
|
270 |
} |
271 |
else |
272 |
{ |
273 |
throw new Exception("일치하는 DocInfo가 없습니다"); |
274 |
} |
275 |
} |
276 |
} |
277 |
catch (Exception ex) |
278 |
{ |
279 |
if (ex.Message == "사용 가능한" || ex.Message == "작업을 완료했습니다") |
280 |
{ |
281 |
SetNotice(FinalPDF.ID, "Desktop 내 힙메모리 부족으로 서비스 진행이 되지 않아 재시작 합니다"); |
282 |
System.Diagnostics.Process process = new System.Diagnostics.Process(); |
283 |
process.StartInfo.FileName = "cmd"; |
284 |
process.StartInfo.Arguments = "/c net stop \"FinalService\" & net start \"FinalService\""; |
285 |
process.Start(); |
286 |
} |
287 |
else |
288 |
{ |
289 |
SetNotice(FinalPDF.ID, "PDF를 Stamp 중 에러 : " + ex.Message); |
290 |
} |
291 |
} |
292 |
#endregion |
293 |
|
294 |
try |
295 |
{ |
296 |
|
297 |
using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
298 |
{ |
299 |
var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID); |
300 |
|
301 |
if (finalList.Count() > 0) |
302 |
{ |
303 |
TestFile = SetFlattingPDF(TestFile); |
304 |
//finalList.FirstOrDefault().STATUS = (int)FinalStatus.Insert; |
305 |
//_entity.SaveChanges(); |
306 |
|
307 |
SetStampInPDF(FinalItem, TestFile, MarkupInfoItem); |
308 |
//finalList.FirstOrDefault().STATUS = (int)FinalStatus.PdfStamp; |
309 |
//_entity.SaveChanges(); |
310 |
} |
311 |
} |
312 |
if (EndFinal != null) |
313 |
{ |
314 |
EndFinal(this, new EndFinalEventArgs |
315 |
{ |
316 |
OriginPDFName = OriginFileName, |
317 |
FinalPDFPath = FinalPDFPath.FullName, |
318 |
Error = "", |
319 |
Message = "", |
320 |
FinalPDF = FinalPDF, |
321 |
}); |
322 |
} |
323 |
} |
324 |
catch (Exception ex) |
325 |
{ |
326 |
|
327 |
throw; |
328 |
} |
329 |
} |
330 |
#endregion |
331 |
|
332 |
#region PDF |
333 |
public static float scaleWidth = 0; |
334 |
public static float scaleHeight = 0; |
335 |
|
336 |
private string SetFlattingPDF(string tempFileInfo) |
337 |
{ |
338 |
if (File.Exists(tempFileInfo)) |
339 |
{ |
340 |
FileInfo TestFile = new FileInfo(System.IO.Path.GetTempFileName()); |
341 |
|
342 |
PdfReader pdfReader = new PdfReader(tempFileInfo); |
343 |
for (int i = 1; i < pdfReader.NumberOfPages; i++) |
344 |
{ |
345 |
var mediaBox = pdfReader.GetPageSize(i); |
346 |
var cropbox = pdfReader.GetCropBox(i); |
347 |
|
348 |
//using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString().ToString())) |
349 |
//{ |
350 |
// _entity.DOCPAGE.Where(d=>d.DOCINFO_ID == DocInfoItem.DOCPAGE) |
351 |
//} |
352 |
var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == i).FirstOrDefault(); |
353 |
|
354 |
//scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / mediaBox.Width; |
355 |
//scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / mediaBox.Height; |
356 |
//scaleWidth = 2.0832634F; |
357 |
//scaleHeight = 3.0F; |
358 |
|
359 |
PdfRectangle rect = new PdfRectangle(cropbox, pdfReader.GetPageRotation(i)); |
360 |
//강인구 수정 |
361 |
//if (cropbox != null && (cropbox.Width < mediaBox.Width || cropbox.Height < cropbox.Height)) |
362 |
//if (cropbox != null && (cropbox.Width < mediaBox.Width || cropbox.Height < mediaBox.Height)) |
363 |
//{ |
364 |
// var pageDict = pdfReader.GetPageN(i); |
365 |
// pageDict.Put(PdfName.MEDIABOX, rect); |
366 |
//} |
367 |
} |
368 |
|
369 |
var memStream = new MemoryStream(); |
370 |
var stamper = new PdfStamper(pdfReader, memStream) |
371 |
{ |
372 |
FormFlattening = true, |
373 |
FreeTextFlattening = true, |
374 |
AnnotationFlattening = true, |
375 |
}; |
376 |
|
377 |
stamper.Close(); |
378 |
pdfReader.Close(); |
379 |
var array = memStream.ToArray(); |
380 |
File.Delete(tempFileInfo); |
381 |
File.WriteAllBytes(TestFile.FullName, array); |
382 |
|
383 |
return TestFile.FullName; |
384 |
} |
385 |
else |
386 |
{ |
387 |
return tempFileInfo; |
388 |
} |
389 |
} |
390 |
|
391 |
public void flattenPdfFile(string src, ref string dest) |
392 |
{ |
393 |
PdfReader reader = new PdfReader(src); |
394 |
var memStream = new MemoryStream(); |
395 |
var stamper = new PdfStamper(reader, memStream) |
396 |
{ |
397 |
FormFlattening = true, |
398 |
FreeTextFlattening = true, |
399 |
AnnotationFlattening = true, |
400 |
}; |
401 |
|
402 |
stamper.Close(); |
403 |
var array = memStream.ToArray(); |
404 |
File.WriteAllBytes(dest, array); |
405 |
} |
406 |
|
407 |
public bool SetStampInPDF(FINAL_PDF finaldata, string testFile, MARKUP_INFO markupInfo) |
408 |
{ |
409 |
try |
410 |
{ |
411 |
string pdfFilePath = null; |
412 |
List<MEMBER> memberlist = null; |
413 |
FileInfo tempFileInfo = new FileInfo(testFile); |
414 |
|
415 |
if (!Directory.Exists(_FinalPDFStorgeLocal)) |
416 |
{ |
417 |
Directory.CreateDirectory(_FinalPDFStorgeLocal); |
418 |
} |
419 |
pdfFilePath = _FinalPDFStorgeLocal + @"\" + tempFileInfo.Name; |
420 |
using (CIEntities cIEntities = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(finaldata.PROJECT_NO).ToString())) |
421 |
{ |
422 |
memberlist = cIEntities.MEMBER.ToList(); |
423 |
} |
424 |
using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
425 |
{ |
426 |
FINAL_PDF pdfLink = _entity.FINAL_PDF.Where(data => data.ID == finaldata.ID).FirstOrDefault(); |
427 |
|
428 |
#region 코멘트 적용 + 커버시트 |
429 |
using (Stream pdfStream = new FileInfo(testFile).Open(FileMode.Open, FileAccess.ReadWrite)) // |
430 |
{ |
431 |
PdfReader pdfReader = new PdfReader(pdfStream); |
432 |
//List<Dictionary<string, object>> lstoutlineTop = new List<Dictionary<string, object>>(); |
433 |
Dictionary<string, object> bookmark; |
434 |
List<Dictionary<string, object>> outlines; |
435 |
outlines = new List<Dictionary<string, object>>(); |
436 |
List<Dictionary<string, object>> root = new List<Dictionary<string, object>>(); |
437 |
|
438 |
var dic = new Dictionary<string, object>(); |
439 |
foreach (var data in MarkupDataSet) |
440 |
{ |
441 |
|
442 |
string userid = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID; |
443 |
|
444 |
var member = memberlist.Where(u => u.ID == userid).FirstOrDefault(); |
445 |
string username = member.NAME; |
446 |
string userdept = member.DEPARTMENT; |
447 |
bookmark = new Dictionary<string, object>(); |
448 |
bookmark.Add("Title", string.Format("User:{0}[{1}] Commented Page : {2}", username, userdept, data.PAGENUMBER)); |
449 |
bookmark.Add("Page", data.PAGENUMBER + " Fit"); |
450 |
bookmark.Add("Action", "GoTo"); |
451 |
bookmark.Add("Kids", outlines); |
452 |
root.Add(bookmark); |
453 |
} |
454 |
|
455 |
|
456 |
using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfFilePath, FileMode.Create))) |
457 |
{ |
458 |
var _SetColor = new SolidColorBrush(Colors.Red); |
459 |
|
460 |
string[] delimiterChars = { "|DZ|" }; |
461 |
string[] delimiterChars2 = { "|" }; |
462 |
|
463 |
//pdfStamper.FormFlattening = true; //이미 선처리 작업함 |
464 |
pdfStamper.SetFullCompression(); |
465 |
_SetColor = new SolidColorBrush(Colors.Red); |
466 |
|
467 |
foreach (var markupItem in MarkupDataSet) |
468 |
{ |
469 |
pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER); |
470 |
var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER).FirstOrDefault(); |
471 |
|
472 |
mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER); |
473 |
var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER); |
474 |
|
475 |
//강인구 테스트 |
476 |
scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / pdfSize.Width; |
477 |
scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / pdfSize.Height; |
478 |
|
479 |
//if (cropBox != null && cropBox.Width < mediaBox.Width || cropBox.Height < mediaBox.Height) |
480 |
//{ |
481 |
// mediaBox = cropBox; |
482 |
//} |
483 |
|
484 |
pdfLink.CURRENT_PAGE = markupItem.PAGENUMBER; |
485 |
_entity.SaveChanges(); |
486 |
|
487 |
string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
488 |
|
489 |
PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER); |
490 |
|
491 |
|
492 |
foreach (var data in markedData) |
493 |
{ |
494 |
var item = JsonSerializerHelper.UnCompressString(data); |
495 |
var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item); |
496 |
|
497 |
try |
498 |
{ |
499 |
switch (ControlT.Name) |
500 |
{ |
501 |
#region LINE |
502 |
case "LineControl": |
503 |
{ |
504 |
using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item)) |
505 |
{ |
506 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
507 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
508 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
509 |
DoubleCollection DashSize = control.DashSize; |
510 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
511 |
|
512 |
var Opacity = control.Opac; |
513 |
string UserID = control.UserID; |
514 |
double Interval = control.Interval; |
515 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
516 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, control.DashSize, _SetColor, Opacity); |
517 |
switch (control.LineStyleSet) |
518 |
{ |
519 |
case LineStyleSet.ArrowLine: |
520 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, LineSize, contentByte, _SetColor, Opacity); |
521 |
break; |
522 |
case LineStyleSet.CancelLine: |
523 |
{ |
524 |
var x = Math.Abs((Math.Abs(StartPoint.X) - Math.Abs(EndPoint.X))); |
525 |
var y = Math.Abs((Math.Abs(StartPoint.Y) - Math.Abs(EndPoint.Y))); |
526 |
|
527 |
if (x > y) |
528 |
{ |
529 |
StartPoint = new Point(StartPoint.X, StartPoint.Y - (float)(control.Interval / 3.0)); |
530 |
EndPoint = new Point(EndPoint.X, EndPoint.Y - (float)(control.Interval / 3.0)); |
531 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, Opacity); |
532 |
} |
533 |
} |
534 |
break; |
535 |
case LineStyleSet.TwinLine: |
536 |
{ |
537 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, LineSize, contentByte, _SetColor, Opacity); |
538 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, LineSize, contentByte, _SetColor, Opacity); |
539 |
} |
540 |
break; |
541 |
case LineStyleSet.DimLine: |
542 |
{ |
543 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.DimAllow(StartPoint, EndPoint, LineSize, contentByte, _SetColor, Opacity); |
544 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, LineSize, contentByte, _SetColor, Opacity); |
545 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, LineSize, contentByte, _SetColor, Opacity); |
546 |
} |
547 |
break; |
548 |
default: |
549 |
break; |
550 |
} |
551 |
|
552 |
|
553 |
} |
554 |
} |
555 |
break; |
556 |
#endregion |
557 |
#region ArrowControlMulti |
558 |
case "ArrowControl_Multi": |
559 |
{ |
560 |
using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item)) |
561 |
{ |
562 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
563 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
564 |
Point MidPoint = GetPdfPointSystem(control.MidPoint); |
565 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
566 |
DoubleCollection DashSize = control.DashSize; |
567 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
568 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
569 |
|
570 |
double Opacity = control.Opac; |
571 |
|
572 |
if (EndPoint == MidPoint) |
573 |
{ |
574 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, LineSize, contentByte, _SetColor, Opacity); |
575 |
} |
576 |
else |
577 |
{ |
578 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity); |
579 |
} |
580 |
|
581 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity); |
582 |
|
583 |
} |
584 |
} |
585 |
break; |
586 |
#endregion |
587 |
#region PolyControl |
588 |
case "PolygonControl": |
589 |
using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item)) |
590 |
{ |
591 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
592 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
593 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
594 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
595 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
596 |
double Opacity = control.Opac; |
597 |
DoubleCollection DashSize = control.DashSize; |
598 |
|
599 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity); |
600 |
} |
601 |
break; |
602 |
#endregion |
603 |
#region ArcControl |
604 |
case "ArcControl": |
605 |
{ |
606 |
using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item)) |
607 |
{ |
608 |
string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
609 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
610 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
611 |
Point MidPoint = GetPdfPointSystem(control.MidPoint); |
612 |
DoubleCollection DashSize = control.DashSize; |
613 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
614 |
|
615 |
var Opacity = control.Opac; |
616 |
string UserID = control.UserID; |
617 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First())); |
618 |
bool IsTransOn = control.IsTransOn; |
619 |
|
620 |
if (control.IsTransOn) |
621 |
{ |
622 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true); |
623 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true); |
624 |
} |
625 |
else |
626 |
{ |
627 |
Controls_PDF.HoneyPDFLib_DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
628 |
} |
629 |
|
630 |
} |
631 |
} |
632 |
break; |
633 |
#endregion |
634 |
#region RectangleControl |
635 |
case "RectangleControl": |
636 |
using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item)) |
637 |
{ |
638 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
639 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
640 |
var PaintStyle = control.PaintState; |
641 |
double Angle = control.Angle; |
642 |
DoubleCollection DashSize = control.DashSize; |
643 |
double Opacity = control.Opac; |
644 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
645 |
|
646 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity); |
647 |
} |
648 |
break; |
649 |
#endregion |
650 |
#region TriControl |
651 |
case "TriControl": |
652 |
using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item)) |
653 |
{ |
654 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
655 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
656 |
var PaintStyle = control.Paint; |
657 |
double Angle = control.Angle; |
658 |
//StrokeColor = _SetColor, //색상은 레드 |
659 |
DoubleCollection DashSize = control.DashSize; |
660 |
double Opacity = control.Opac; |
661 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
662 |
|
663 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity); |
664 |
} |
665 |
break; |
666 |
#endregion |
667 |
#region CircleControl |
668 |
case "CircleControl": |
669 |
using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item)) |
670 |
{ |
671 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
672 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
673 |
var StartPoint = GetPdfPointSystem(control.StartPoint); |
674 |
var EndPoint = GetPdfPointSystem(control.EndPoint); |
675 |
var PaintStyle = control.PaintState; |
676 |
double Angle = control.Angle; |
677 |
DoubleCollection DashSize = control.DashSize; |
678 |
double Opacity = control.Opac; |
679 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
680 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet); |
681 |
|
682 |
} |
683 |
break; |
684 |
#endregion |
685 |
#region RectCloudControl |
686 |
case "RectCloudControl": |
687 |
using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item)) |
688 |
{ |
689 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
690 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
691 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
692 |
double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint)); |
693 |
|
694 |
double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight); |
695 |
|
696 |
var PaintStyle = control.PaintState; |
697 |
double Opacity = control.Opac; |
698 |
DoubleCollection DashSize = control.DashSize; |
699 |
|
700 |
//드로잉 방식이 표현되지 않음 |
701 |
var rrrr = returnAngle(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint)); |
702 |
|
703 |
double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet)); |
704 |
bool reverse = (area < 0); |
705 |
if (PaintStyle == PaintSet.None) |
706 |
{ |
707 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
708 |
} |
709 |
else |
710 |
{ |
711 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
712 |
} |
713 |
} |
714 |
break; |
715 |
#endregion |
716 |
#region CloudControl |
717 |
case "CloudControl": |
718 |
using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item)) |
719 |
{ |
720 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
721 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
722 |
double Toler = control.Toler; |
723 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
724 |
double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight); |
725 |
var PaintStyle = control.PaintState; |
726 |
double Opacity = control.Opac; |
727 |
bool isTransOn = control.IsTrans; |
728 |
bool isChain = control.IsChain; |
729 |
|
730 |
DoubleCollection DashSize = control.DashSize; |
731 |
|
732 |
if (isChain) |
733 |
{ |
734 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity); |
735 |
} |
736 |
else |
737 |
{ |
738 |
if (isTransOn) |
739 |
{ |
740 |
double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet)); |
741 |
bool reverse = (area < 0); |
742 |
|
743 |
if (PaintStyle == PaintSet.None) |
744 |
{ |
745 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
746 |
} |
747 |
else |
748 |
{ |
749 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity); |
750 |
} |
751 |
} |
752 |
else |
753 |
{ |
754 |
Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity); |
755 |
} |
756 |
} |
757 |
} |
758 |
break; |
759 |
#endregion |
760 |
#region TEXT |
761 |
case "TextControl": |
762 |
using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item)) |
763 |
{ |
764 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
765 |
string Text = control.Text; |
766 |
|
767 |
bool isUnderline = false; |
768 |
control.BoxW -= scaleWidth; |
769 |
control.BoxH -= scaleHeight; |
770 |
System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxW, (float)control.BoxH); |
771 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
772 |
Point EndPoint = GetPdfPointSystem(new Point(control.StartPoint.X + control.BoxW, control.StartPoint.Y + control.BoxH)); |
773 |
|
774 |
List<Point> pointSet = new List<Point>(); |
775 |
pointSet.Add(StartPoint); |
776 |
pointSet.Add(EndPoint); |
777 |
|
778 |
PaintSet paint = PaintSet.None; |
779 |
switch (control.paintMethod) |
780 |
{ |
781 |
case 1: |
782 |
{ |
783 |
paint = PaintSet.Fill; |
784 |
} |
785 |
break; |
786 |
case 2: |
787 |
{ |
788 |
paint = PaintSet.Hatch; |
789 |
} |
790 |
break; |
791 |
default: |
792 |
break; |
793 |
} |
794 |
if (control.isHighLight) paint |= PaintSet.Highlight; |
795 |
|
796 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
797 |
double TextSize = Convert.ToDouble(data2[1]); |
798 |
SolidColorBrush FontColor = _SetColor; |
799 |
double Angle = control.Angle; |
800 |
double Opacity = control.Opac; |
801 |
FontFamily fontfamilly = new FontFamily(control.fontConfig[0]); |
802 |
var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]); |
803 |
|
804 |
FontStyle fontStyle = FontStyles.Normal; |
805 |
if (FontStyles.Italic == TextStyle) |
806 |
{ |
807 |
fontStyle = FontStyles.Italic; |
808 |
} |
809 |
|
810 |
FontWeight fontWeight = FontWeights.Black; |
811 |
|
812 |
var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]); |
813 |
//강인구 수정(2018.04.17) |
814 |
if (FontWeights.Bold == TextWeight) |
815 |
//if (FontWeights.ExtraBold == TextWeight) |
816 |
{ |
817 |
fontWeight = FontWeights.Bold; |
818 |
} |
819 |
|
820 |
TextDecorationCollection decoration = TextDecorations.Baseline; |
821 |
if (control.fontConfig.Count() == 4) |
822 |
{ |
823 |
decoration = TextDecorations.Underline; |
824 |
} |
825 |
|
826 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString(StartPoint, EndPoint, LineSize, contentByte, _SetColor, paint, TextSize, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
827 |
} |
828 |
break; |
829 |
#endregion |
830 |
#region ArrowTextControl |
831 |
case "ArrowTextControl": |
832 |
using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item)) |
833 |
{ |
834 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
835 |
Point tempStartPoint = GetPdfPointSystem(control.StartPoint); |
836 |
Point tempMidPoint = GetPdfPointSystem(control.MidPoint); |
837 |
Point tempEndPoint = GetPdfPointSystem(control.EndPoint); |
838 |
bool isUnderLine = false; |
839 |
string Text = ""; |
840 |
double fontsize = 30; |
841 |
|
842 |
System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight); |
843 |
Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight)); |
844 |
List<Point> tempPoint = new List<Point>(); |
845 |
|
846 |
var tempRectMidPoint = MathSet.getRectMiddlePoint(rect); |
847 |
|
848 |
tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y)); |
849 |
tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top)); |
850 |
tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y)); |
851 |
tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom)); |
852 |
double Angle = control.Angle; |
853 |
var newStartPoint = tempStartPoint; |
854 |
var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint); |
855 |
var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint); |
856 |
|
857 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First())); |
858 |
SolidColorBrush FontColor = _SetColor; |
859 |
bool isHighlight = control.isHighLight; |
860 |
double Opacity = control.Opac; |
861 |
PaintSet Paint = PaintSet.None; |
862 |
|
863 |
switch (control.ArrowStyle) |
864 |
{ |
865 |
case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal: |
866 |
{ |
867 |
Paint = PaintSet.None; |
868 |
} |
869 |
break; |
870 |
case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud: |
871 |
{ |
872 |
Paint = PaintSet.Hatch; |
873 |
} |
874 |
break; |
875 |
case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect: |
876 |
{ |
877 |
Paint = PaintSet.Fill; |
878 |
} |
879 |
break; |
880 |
default: |
881 |
break; |
882 |
} |
883 |
if (control.isHighLight) Paint |= PaintSet.Highlight; |
884 |
|
885 |
if (Paint == PaintSet.Hatch) |
886 |
{ |
887 |
Text = control.ArrowText; |
888 |
} |
889 |
else |
890 |
{ |
891 |
Text = control.ArrowText; |
892 |
} |
893 |
|
894 |
try |
895 |
{ |
896 |
if (control.fontConfig.Count == 4) |
897 |
{ |
898 |
fontsize = Convert.ToDouble(control.fontConfig[3]); |
899 |
} |
900 |
|
901 |
//강인구 수정(2018.04.17) |
902 |
var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]); |
903 |
|
904 |
FontStyle fontStyle = FontStyles.Normal; |
905 |
if (FontStyles.Italic == TextStyle) |
906 |
{ |
907 |
fontStyle = FontStyles.Italic; |
908 |
} |
909 |
|
910 |
FontWeight fontWeight = FontWeights.Black; |
911 |
|
912 |
var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]); |
913 |
if (FontWeights.Bold == TextWeight) |
914 |
{ |
915 |
fontWeight = FontWeights.Bold; |
916 |
} |
917 |
|
918 |
TextDecorationCollection decoration = TextDecorations.Baseline; |
919 |
if (control.fontConfig.Count() == 5) |
920 |
{ |
921 |
decoration = TextDecorations.Underline; |
922 |
} |
923 |
|
924 |
if (control.isTrans) |
925 |
{ |
926 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
927 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
928 |
newStartPoint, tempMidPoint, |
929 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
930 |
} |
931 |
else |
932 |
{ |
933 |
if (control.isFixed) |
934 |
{ |
935 |
var testP = new Point(0, 0); |
936 |
if (control.isFixed) |
937 |
{ |
938 |
if (tempPoint[1] == newEndPoint) |
939 |
{ |
940 |
testP = new Point(newEndPoint.X, newEndPoint.Y - 10); |
941 |
} |
942 |
else if (tempPoint[3] == newEndPoint) |
943 |
{ |
944 |
testP = new Point(newEndPoint.X, newEndPoint.Y + 10); |
945 |
} |
946 |
else if (tempPoint[0] == newEndPoint) |
947 |
{ |
948 |
testP = new Point(newEndPoint.X - 10, newEndPoint.Y); |
949 |
} |
950 |
else if (tempPoint[2] == newEndPoint) |
951 |
{ |
952 |
testP = new Point(newEndPoint.X + 10, newEndPoint.Y); |
953 |
} |
954 |
} |
955 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
956 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
957 |
tempStartPoint, testP, |
958 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, |
959 |
new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
960 |
} |
961 |
else |
962 |
{ |
963 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
964 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
965 |
newStartPoint, newMidPoint, |
966 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
967 |
} |
968 |
} |
969 |
} |
970 |
catch (Exception ex) |
971 |
{ |
972 |
|
973 |
} |
974 |
} |
975 |
break; |
976 |
#endregion |
977 |
#region SignControl |
978 |
case "SignControl": |
979 |
using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item)) |
980 |
{ |
981 |
|
982 |
double Angle = control.Angle; |
983 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
984 |
Point TopRightPoint = GetPdfPointSystem(control.TR); |
985 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
986 |
Point LeftBottomPoint = GetPdfPointSystem(control.LB); |
987 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
988 |
double Opacity = control.Opac; |
989 |
string UserNumber = control.UserNumber; |
990 |
Controls_PDF.HoneyPDFLib_DrawSet_Image.DrawSign(StartPoint, EndPoint, PointSet, contentByte, UserNumber, Angle, Opacity, finaldata.PROJECT_NO); |
991 |
} |
992 |
break; |
993 |
#endregion |
994 |
#region MyRegion |
995 |
case "DateControl": |
996 |
using (S_DateControl control = JsonSerializerHelper.JsonDeserialize<S_DateControl>(item)) |
997 |
{ |
998 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
999 |
string Text = control.Text; |
1000 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
1001 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
1002 |
List<Point> pointSet = GetPdfPointSystem(control.PointSet); |
1003 |
SolidColorBrush FontColor = _SetColor; |
1004 |
double Angle = control.Angle; |
1005 |
double Opacity = control.Opac; |
1006 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity); |
1007 |
} |
1008 |
break; |
1009 |
#endregion |
1010 |
#region SymControlN (APPROVED) |
1011 |
case "SymControlN": |
1012 |
using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item)) |
1013 |
{ |
1014 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
1015 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
1016 |
List<Point> pointSet = GetPdfPointSystem(control.PointSet); |
1017 |
SolidColorBrush FontColor = _SetColor; |
1018 |
double Angle = control.Angle; |
1019 |
double Opacity = control.Opac; |
1020 |
|
1021 |
string imgpath = CommonLib.Common.GetConfigString("ApprovedImgPath", "URL", ""); |
1022 |
Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawApproval(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath); |
1023 |
} |
1024 |
break; |
1025 |
case "SymControl": |
1026 |
using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item)) |
1027 |
{ |
1028 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
1029 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
1030 |
List<Point> pointSet = GetPdfPointSystem(control.PointSet); |
1031 |
SolidColorBrush FontColor = _SetColor; |
1032 |
double Angle = control.Angle; |
1033 |
double Opacity = control.Opac; |
1034 |
|
1035 |
string imgpath = CommonLib.Common.GetConfigString("CheckmarkImgPath", "URL", ""); |
1036 |
Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath); |
1037 |
} |
1038 |
break; |
1039 |
#endregion |
1040 |
#region Image |
1041 |
case "ImgControl": |
1042 |
using (S_ImgControl control = JsonSerializerHelper.JsonDeserialize<S_ImgControl>(item)) |
1043 |
{ |
1044 |
double Angle = control.Angle; |
1045 |
Point StartPoint = GetPdfPointSystem(control.StartPoint); |
1046 |
Point TopRightPoint = GetPdfPointSystem(control.TR); |
1047 |
Point EndPoint = GetPdfPointSystem(control.EndPoint); |
1048 |
Point LeftBottomPoint = GetPdfPointSystem(control.LB); |
1049 |
List<Point> PointSet = GetPdfPointSystem(control.PointSet); |
1050 |
double Opacity = control.Opac; |
1051 |
string FilePath = control.ImagePath; |
1052 |
//Uri uri = new Uri(s.ImagePath); |
1053 |
|
1054 |
Controls_PDF.HoneyPDFLib_DrawSet_Image.DrawImage(StartPoint, EndPoint, PointSet, contentByte, FilePath, Angle, Opacity); |
1055 |
} |
1056 |
break; |
1057 |
#endregion |
1058 |
default: |
1059 |
break; |
1060 |
} |
1061 |
} |
1062 |
catch (Exception ex) |
1063 |
{ |
1064 |
|
1065 |
} |
1066 |
} |
1067 |
} |
1068 |
pdfStamper.Outlines = root; |
1069 |
pdfStamper.Close(); |
1070 |
pdfReader.Close(); |
1071 |
} |
1072 |
} |
1073 |
#endregion |
1074 |
} |
1075 |
if (tempFileInfo.Exists) |
1076 |
{ |
1077 |
tempFileInfo.Delete(); |
1078 |
} |
1079 |
|
1080 |
if (File.Exists(pdfFilePath)) |
1081 |
{ |
1082 |
try |
1083 |
{ |
1084 |
FinalPDFPath = new FileInfo(pdfFilePath); |
1085 |
|
1086 |
string pdfmovepath = CommonLib.Common.GetConfigString("PDFMovePath", "URL", ""); |
1087 |
string destfilepath = Path.Combine(pdfmovepath,FinalPDFPath.Name.Replace(".tmp", ".pdf")); |
1088 |
if (File.Exists(destfilepath)) |
1089 |
File.Delete(destfilepath); |
1090 |
File.Move(FinalPDFPath.FullName, destfilepath); |
1091 |
FinalPDFPath = new FileInfo(destfilepath); |
1092 |
File.Delete(pdfFilePath); |
1093 |
} |
1094 |
catch (Exception ex) |
1095 |
{ |
1096 |
SetNotice(finaldata.ID, "File move error: " + ex.ToString()); |
1097 |
} |
1098 |
// |
1099 |
|
1100 |
return true; |
1101 |
} |
1102 |
} |
1103 |
catch (Exception) |
1104 |
{ |
1105 |
throw; |
1106 |
} |
1107 |
return false; |
1108 |
} |
1109 |
|
1110 |
public void Dispose() |
1111 |
{ |
1112 |
throw new NotImplementedException(); |
1113 |
} |
1114 |
|
1115 |
#endregion |
1116 |
} |
1117 |
} |