개정판 43e1d368
issue #0000 코드 정리
Change-Id: I7c8ba4ef6d78a7e4f51b72f226507cddac722939
KCOM/Controls/PrintControl.xaml.cs | ||
---|---|---|
452 | 452 |
//bitmap.Width = Convert.ToDouble(currentPage.PAGE_WIDTH); |
453 | 453 |
//bitmap.Height = Convert.ToDouble(currentPage.PAGE_HEIGHT); |
454 | 454 |
|
455 |
if (uri.Scheme == Uri.UriSchemeFile) |
|
456 |
{ |
|
457 |
var cloneUri = new Uri(System.IO.Path.Combine(System.IO.Path.GetTempPath(),System.IO.Path.GetRandomFileName()),UriKind.Absolute); |
|
458 |
File.Copy(uri.LocalPath, cloneUri.LocalPath); |
|
455 |
//if (uri.Scheme == Uri.UriSchemeFile)
|
|
456 |
//{
|
|
457 |
// var cloneUri = new Uri(System.IO.Path.Combine(System.IO.Path.GetTempPath(),System.IO.Path.GetRandomFileName()),UriKind.Absolute);
|
|
458 |
// File.Copy(uri.LocalPath, cloneUri.LocalPath);
|
|
459 | 459 |
|
460 |
uri = cloneUri; |
|
461 |
} |
|
460 |
// uri = cloneUri;
|
|
461 |
//}
|
|
462 | 462 |
|
463 | 463 |
printCanvas.Children.Clear(); |
464 | 464 |
printCanvas.Width = Convert.ToDouble(currentPage.PAGE_WIDTH); |
... | ... | |
627 | 627 |
} |
628 | 628 |
|
629 | 629 |
//Export 버튼 클릭 이벤트 |
630 |
[System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptions] |
|
631 |
[System.Security.Permissions.FileIOPermission(System.Security.Permissions.SecurityAction.LinkDemand)] |
|
630 | 632 |
async void ExportMethod(object sender, RoutedEventArgs e) |
631 | 633 |
{ |
632 | 634 |
try |
... | ... | |
709 | 711 |
{ |
710 | 712 |
case (0): |
711 | 713 |
{ |
712 |
using (FileStream fs = new FileStream(SaveDig.FileName, FileMode.Create)) |
|
714 |
FileStream fs = new FileStream(SaveDig.FileName, FileMode.Create, FileAccess.Write); |
|
715 |
|
|
716 |
Document doc = new Document(); |
|
717 |
PdfWriter writer = PdfWriter.GetInstance(doc, fs); |
|
718 |
|
|
719 |
doc.Open(); |
|
720 |
|
|
721 |
float height = doc.PageSize.Height; |
|
722 |
float width = doc.PageSize.Width; |
|
723 |
|
|
724 |
foreach (var item in PrintimgPath_List) |
|
713 | 725 |
{ |
714 |
using (Document doc = new Document()) |
|
726 |
System.Drawing.Image image = System.Drawing.Image.FromFile(item.Value); |
|
727 |
Export_img = iTextSharp.text.Image.GetInstance(image,System.Drawing.Imaging.ImageFormat.Jpeg); |
|
728 |
|
|
729 |
if (Export_img.Width > Export_img.Height) |
|
730 |
{ |
|
731 |
doc.SetPageSize(new Rectangle(height, width)); |
|
732 |
Export_img.ScaleToFit(height, width); |
|
733 |
} |
|
734 |
else |
|
715 | 735 |
{ |
716 |
PdfWriter writer = PdfWriter.GetInstance(doc, fs); |
|
717 |
|
|
718 |
doc.Open(); |
|
719 |
|
|
720 |
float height = doc.PageSize.Height; |
|
721 |
float width = doc.PageSize.Width; |
|
722 |
|
|
723 |
foreach (var item in PrintimgPath_List) |
|
724 |
{ |
|
725 |
System.Drawing.Image image = System.Drawing.Image.FromFile(item.Value); |
|
726 |
Export_img = iTextSharp.text.Image.GetInstance(image,System.Drawing.Imaging.ImageFormat.Jpeg); |
|
727 |
|
|
728 |
if (Export_img.Width > Export_img.Height) |
|
729 |
{ |
|
730 |
doc.SetPageSize(new Rectangle(height, width)); |
|
731 |
Export_img.ScaleToFit(height, width); |
|
732 |
} |
|
733 |
else |
|
734 |
{ |
|
735 |
doc.SetPageSize(new Rectangle(width, height)); |
|
736 |
Export_img.ScaleToFit(width, height); |
|
737 |
} |
|
738 |
|
|
739 |
Export_img.SetAbsolutePosition(0, 0); |
|
740 |
|
|
741 |
doc.NewPage(); |
|
742 |
doc.Add(Export_img); |
|
743 |
} |
|
736 |
doc.SetPageSize(new Rectangle(width, height)); |
|
737 |
Export_img.ScaleToFit(width, height); |
|
744 | 738 |
} |
739 |
|
|
740 |
Export_img.SetAbsolutePosition(0, 0); |
|
741 |
|
|
742 |
doc.NewPage(); |
|
743 |
doc.Add(Export_img); |
|
745 | 744 |
} |
746 | 745 |
break; |
747 | 746 |
} |
... | ... | |
996 | 995 |
{ |
997 | 996 |
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
998 | 997 |
{ |
999 |
if (Directory.Exists(TempImageDir)) |
|
1000 |
Directory.Delete(TempImageDir, true); |
|
998 |
//if (Directory.Exists(TempImageDir))
|
|
999 |
// Directory.Delete(TempImageDir, true);
|
|
1001 | 1000 |
|
1002 | 1001 |
sliderPages.Value = 1; |
1003 | 1002 |
printIndy.IsBusy = false; |
내보내기 Unified diff