개정판 408e4218
issue #740 Print 미리보기 화면과 출력물의 화면이 다른 현상 수정
KCOM/Controls/PrintControl.xaml.cs | ||
---|---|---|
725 | 725 |
PageChanged(1); |
726 | 726 |
if (PrinterSettings.InstalledPrinters != null && PrinterSettings.InstalledPrinters.Count > 0) |
727 | 727 |
{ |
728 |
printDocument = new PrintDocument(); |
|
728 |
printDocument = new PrintDocument(); |
|
729 |
printDocument.OriginAtMargins = true; |
|
729 | 730 |
printDocument.BeginPrint += new System.Drawing.Printing.PrintEventHandler(printDocument_BeginPrint); |
730 | 731 |
printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument_PrintPage); |
731 | 732 |
printDocument.EndPrint += new System.Drawing.Printing.PrintEventHandler(printDocument_EndPrint); |
... | ... | |
739 | 740 |
printDocument.PrinterSettings.MinimumPage = 1; |
740 | 741 |
printDocument.PrinterSettings.MaximumPage = _lstPrintPageNo.Count(); |
741 | 742 |
printDocument.PrinterSettings.FromPage = 1; |
742 |
printDocument.PrinterSettings.ToPage = _lstPrintPageNo.Count(); |
|
743 |
|
|
743 |
printDocument.PrinterSettings.ToPage = _lstPrintPageNo.Count(); |
|
744 | 744 |
printDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); |
745 |
printDocument.PrinterSettings.PrinterName = PrintName; |
|
746 |
|
|
747 |
dlg.Document = printDocument; |
|
745 |
printDocument.PrinterSettings.PrinterName = PrintName; |
|
746 |
dlg.Document = printDocument; |
|
748 | 747 |
dlg.WindowState = System.Windows.Forms.FormWindowState.Maximized; |
749 | 748 |
dlg.ShowDialog(); |
750 | 749 |
} |
... | ... | |
770 | 769 |
PrintDocument document = sender as PrintDocument; |
771 | 770 |
currentPage = document.PrinterSettings.FromPage; |
772 | 771 |
} |
773 |
|
|
772 |
|
|
774 | 773 |
private void printDocument_PrintPage(object sender, PrintPageEventArgs e) |
775 | 774 |
{ |
776 | 775 |
//e.Graphics.DrawImage(Printimg_List.Where(info => info.Key == currentPage).FirstOrDefault().Value, 0, 0); |
... | ... | |
783 | 782 |
{ |
784 | 783 |
p_img.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone); |
785 | 784 |
} |
786 |
|
|
787 |
iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(p_img, System.Drawing.Imaging.ImageFormat.Jpeg); |
|
785 |
|
|
786 |
//iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(p_img, System.Drawing.Imaging.ImageFormat.Jpeg); |
|
787 |
System.Drawing.Image pic = p_img; |
|
788 | 788 |
System.Drawing.Rectangle m = e.MarginBounds; |
789 | 789 |
|
790 |
if ((double)pic.Width / (double)pic.Height > (double)m.Width / (double)m.Height) // image is wider |
|
791 |
{ |
|
792 |
m.Height = (int)((double)pic.Height / (double)pic.Width * (double)m.Width); |
|
793 |
} |
|
794 |
else |
|
795 |
{ |
|
796 |
m.Width = (int)((double)pic.Width / (double)pic.Height * (double)m.Height); |
|
797 |
} |
|
798 |
|
|
799 |
e.Graphics.DrawImage(p_img, m); |
|
790 |
//if ((double)pic.Width / (double)pic.Height > (double)m.Width / (double)m.Height) // image is wider |
|
791 |
//{ |
|
792 |
// m.Height = 1135;//(int)((double)pic.Height / (double)pic.Width * (double)m.Width) - 16; |
|
793 |
//} |
|
794 |
//else |
|
795 |
//{ |
|
796 |
// m.Width = 793;//(int)((double)pic.Width / (double)pic.Height * (double)m.Height) - 16; |
|
797 |
//} |
|
798 |
m.Width = (int)e.PageSettings.PrintableArea.Width; |
|
799 |
m.Height = (int)e.PageSettings.PrintableArea.Height; |
|
800 |
m.X = (int)e.PageSettings.HardMarginX; |
|
801 |
m.Y = (int)e.PageSettings.HardMarginY; |
|
802 |
|
|
803 |
e.Graphics.DrawImage(pic, m); |
|
800 | 804 |
//e.Graphics.DrawImage(p_img, e.MarginBounds); |
801 | 805 |
//e.Graphics.DrawImage(p_img, 0, 0); |
802 |
|
|
803 |
|
|
804 | 806 |
})); |
805 | 807 |
|
806 | 808 |
//다음 페이지 |
내보내기 Unified diff