|
@@ -184,7 +184,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
{
|
|
|
this.printDocumentEvent = eventAggregator;
|
|
|
printDocumentEvent.GetEvent<SendPrintSettingsInfoEvent>().Subscribe(RecvPrintSettingsInfo, e => e.Unicode == Unicode);
|
|
|
- printDocumentEvent.GetEvent<SendPrintQueueEvent>().Subscribe(RecvPrintQueue , e => e.Unicode == Unicode);
|
|
|
+ printDocumentEvent.GetEvent<SendPrintQueueEvent>().Subscribe(RecvPrintQueue, e => e.Unicode == Unicode);
|
|
|
printDocumentEvent.GetEvent<SendLabelEvent>().Subscribe(RecvLabel, e => e.Unicode == Unicode);
|
|
|
TurnPageCommand = new DelegateCommand<object>(TurnPage);
|
|
|
JumpPageCommand = new DelegateCommand<object>(JumpPage);
|
|
@@ -222,7 +222,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
var printTicket = new PrintTicket();
|
|
|
printDocument.PrinterSettings.PrinterName = printQueueWithUnicode.printQueue.Name;
|
|
|
|
|
|
- //TODO 这里要改,暂时禁用了海报模式的横向打印
|
|
|
if (PrintSettingsInfo.EnumPrintOrientation == EnumPrintOrientation.StatusPortrait)
|
|
|
{
|
|
|
printDocument.DefaultPageSettings.Landscape = false;
|
|
@@ -278,9 +277,34 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
|
|
|
printQueueWithUnicode.printQueue.DefaultPrintTicket = printTicket;
|
|
|
printDocument.DefaultPageSettings.PaperSize = PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize;
|
|
|
+ PaperSource pkSource;
|
|
|
+ List<PaperSource> paperSources = new List<PaperSource>();
|
|
|
+ paperSources.Clear();
|
|
|
+ for (int i = 0; i < printDocument.PrinterSettings.PaperSources.Count; i++)
|
|
|
+ {
|
|
|
+ pkSource = printDocument.PrinterSettings.PaperSources[i];
|
|
|
+ paperSources.Add(pkSource);
|
|
|
+ }
|
|
|
+ ///纸盒不为空,实体打印机默认设置纸盒序号0(主纸盒)
|
|
|
+ if (paperSources.Count != 0)
|
|
|
+ {
|
|
|
+ printDocument.DefaultPageSettings.PaperSource = paperSources[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (PrintSettingsInfo.Copies <= printQueueWithUnicode.printQueue.GetPrintCapabilities().MaxCopyCount && PrintSettingsInfo.Copies > 0)
|
|
|
+ {
|
|
|
+ printDocument.PrinterSettings.Copies = (short)PrintSettingsInfo.Copies;
|
|
|
+ }
|
|
|
+ else if(PrintSettingsInfo.Copies > printQueueWithUnicode.printQueue.GetPrintCapabilities().MaxCopyCount)
|
|
|
+ {
|
|
|
+ PrintSettingsInfo.Copies = (int)printQueueWithUnicode.printQueue.GetPrintCapabilities().MaxCopyCount;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PrintSettingsInfo.Copies = 1;
|
|
|
+ }
|
|
|
posterPrintPaperIndex = 0;
|
|
|
printDocument.PrintPage += PrintDocumentByCurrentSettings;
|
|
|
-
|
|
|
printDocument.Print();
|
|
|
}
|
|
|
}
|
|
@@ -347,7 +371,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
startPoint.X = (blankPageBitmap.Width - resizedWidth) / 2;
|
|
|
startPoint.Y = (blankPageBitmap.Height - resizedHeight) / 2;
|
|
|
printBitmap = CombineBitmap(blankPageBitmap, bitmap, startPoint);
|
|
|
- if (IsManualDuplex && PrintIndex % 2 == 1&&sizeInfo.EnumDuplexPrintMod == EnumDuplexPrintMod.StatusFlipShortEdge)
|
|
|
+ if (IsManualDuplex && PrintIndex % 2 == 1 && sizeInfo.EnumDuplexPrintMod == EnumDuplexPrintMod.StatusFlipShortEdge)
|
|
|
{
|
|
|
printBitmap.RotateFlip(RotateFlipType.Rotate180FlipNone);
|
|
|
}
|
|
@@ -362,7 +386,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
{
|
|
|
printBitmap.RotateFlip(RotateFlipType.Rotate180FlipNone);
|
|
|
}
|
|
|
- e.Graphics.DrawImage(printBitmap, e.MarginBounds);
|
|
|
+ e.Graphics.DrawImage(printBitmap, realBound);
|
|
|
}
|
|
|
else if (sizeInfo.EnumSizeType == EnumSizeType.StatusCustomized)
|
|
|
{
|
|
@@ -1070,7 +1094,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- leftPageIndex = PrintSettingsInfo.PageRangeList[maxPaperNumber * 4 - TargetPaperList[PrintIndex + 1 ] - 1];
|
|
|
+ leftPageIndex = PrintSettingsInfo.PageRangeList[maxPaperNumber * 4 - TargetPaperList[PrintIndex + 1] - 1];
|
|
|
leftPage = PDFViewer.Document.PageAtIndex(leftPageIndex);
|
|
|
}
|
|
|
catch
|
|
@@ -1272,11 +1296,11 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
///奇数页:
|
|
|
///右面为页面序号
|
|
|
///左面为[(总打印纸数*4)+1-打印页右侧页序号]
|
|
|
- if ((TargetPaperList[PrintIndex+1] + 1) % 2 == 0)
|
|
|
+ if ((TargetPaperList[PrintIndex + 1] + 1) % 2 == 0)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- leftPageIndex = PrintSettingsInfo.PageRangeList[maxPaperNumber * 4 - TargetPaperList[PrintIndex+1] - 1];
|
|
|
+ leftPageIndex = PrintSettingsInfo.PageRangeList[maxPaperNumber * 4 - TargetPaperList[PrintIndex + 1] - 1];
|
|
|
leftPage = PDFViewer.Document.PageAtIndex(leftPageIndex);
|
|
|
}
|
|
|
catch
|
|
@@ -1789,7 +1813,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
/// <param name="foreground"></param>
|
|
|
/// <param name="point"></param>
|
|
|
/// <returns></returns>
|
|
|
- public Bitmap CombineBitmap(Bitmap background, Bitmap foreground, System.Drawing.Point point)
|
|
|
+ public Bitmap CombineBitmap(Bitmap background, Bitmap foreground, System.Drawing.Point point)
|
|
|
{
|
|
|
if (background == null)
|
|
|
{
|
|
@@ -2729,7 +2753,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
{
|
|
|
TargetPaperList.Clear();
|
|
|
TargetPaperList.Add(0);
|
|
|
- for (int temp = 0; temp < PrintedPageCount; temp++)
|
|
|
+
|
|
|
+ for (int temp = 0; temp < PrintSettingsInfo.PageRangeList.Count;temp++)
|
|
|
{
|
|
|
TargetPaperList.Add(temp);
|
|
|
}
|
|
@@ -2786,10 +2811,10 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
|
|
|
if (PDFViewer != null && PrintSettingsInfo != null)
|
|
|
{
|
|
|
- documentSettingsInfo.DocumentWidth = 827;
|
|
|
- documentSettingsInfo.DocumentHeight = 1169;
|
|
|
- documentSettingsInfo.margins = new Margins(0,0,0,0);
|
|
|
- documentSettingsInfo.DocumentBounds = new Rectangle(0,0,827,1169);
|
|
|
+ documentSettingsInfo.DocumentWidth = PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Width;
|
|
|
+ documentSettingsInfo.DocumentHeight = PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Height;
|
|
|
+ documentSettingsInfo.margins = PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins;
|
|
|
+ documentSettingsInfo.DocumentBounds = PrintSettingsInfo.PrintDocument.DefaultPageSettings.Bounds;
|
|
|
SetPreviewExceptPoster();
|
|
|
CaculatePrintedPageCount();
|
|
|
SetPaperCollection();
|