|
@@ -198,6 +198,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
|
|
|
public bool FinishedFrontSideFlag = false;
|
|
|
public int printCurrentPageIndex;
|
|
|
+ public string PageListString = null;
|
|
|
public bool isCurrentPage;
|
|
|
|
|
|
/// <summary>
|
|
@@ -393,25 +394,25 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
/// </summary>
|
|
|
public void SetPaper()
|
|
|
{
|
|
|
- PrintSettingsInfo.PrintDocument.PrinterSettings.PrinterName = PrinterName;
|
|
|
- pageSetupDialog.Document = PrintSettingsInfo.PrintDocument;
|
|
|
- pageSetupDialog.Document.DefaultPageSettings.Margins = new Margins((int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Left * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Right * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Top * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Bottom * 2.54));
|
|
|
+ PrintSettingsInfo.PrintDocument.PrinterSettings.PrinterName = PrinterName;
|
|
|
+ pageSetupDialog.Document = PrintSettingsInfo.PrintDocument;
|
|
|
+ pageSetupDialog.Document.DefaultPageSettings.Margins = new Margins((int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Left * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Right * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Top * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Bottom * 2.54));
|
|
|
|
|
|
- if (pageSetupDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
- {
|
|
|
- PrintSettingsInfo.IsPaperSizeChanged= true;
|
|
|
- PrintSettingsInfo.PrintDocument.DefaultPageSettings = pageSetupDialog.PageSettings;
|
|
|
+ if (pageSetupDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
+ {
|
|
|
+ PrintSettingsInfo.IsPaperSizeChanged = true;
|
|
|
+ PrintSettingsInfo.PrintDocument.DefaultPageSettings = pageSetupDialog.PageSettings;
|
|
|
|
|
|
- if (!PrintSettingsInfo.PrintDocument.DefaultPageSettings.Landscape)
|
|
|
- {
|
|
|
- PrintOrientationIndex = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- PrintOrientationIndex = 1;
|
|
|
- }
|
|
|
- this.printEvent.GetEvent<SendPrintSettingsInfoEvent>().Publish(new PrintSettingsInfoWithUnicode { printSettingsInfo = this.PrintSettingsInfo, Unicode = this.Unicode });
|
|
|
- PrintSettingsInfo.IsPaperSizeChanged= false;
|
|
|
+ if (!PrintSettingsInfo.PrintDocument.DefaultPageSettings.Landscape)
|
|
|
+ {
|
|
|
+ PrintOrientationIndex = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PrintOrientationIndex = 1;
|
|
|
+ }
|
|
|
+ this.printEvent.GetEvent<SendPrintSettingsInfoEvent>().Publish(new PrintSettingsInfoWithUnicode { printSettingsInfo = this.PrintSettingsInfo, Unicode = this.Unicode });
|
|
|
+ PrintSettingsInfo.IsPaperSizeChanged = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -693,7 +694,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
if (printModInfoWithUnicode.printModInfo.EnumPrintMod == currentHomePagePrinterMod)
|
|
|
{
|
|
|
PrintSettingsInfo.PrintModInfo = printModInfoWithUnicode.printModInfo;
|
|
|
- this.printEvent.GetEvent<SendPrintSettingsInfoEvent>().Publish(new PrintSettingsInfoWithUnicode { printSettingsInfo = this.PrintSettingsInfo, Unicode = this.Unicode });
|
|
|
+ this.printEvent.GetEvent<SendPrintSettingsInfoEvent>().Publish(new PrintSettingsInfoWithUnicode { printSettingsInfo = this.PrintSettingsInfo, Unicode = this.Unicode });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -718,7 +719,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
param.Add(ParameterNames.PDFViewer, PDFViewer);
|
|
|
param.Add(ParameterNames.PrintSettingsInfo, PrintSettingsInfo);
|
|
|
param.Add("Unicode", Unicode);
|
|
|
- printRegion.RequestNavigate(HomePagePrinterDocumentRegionName, HomePagePrinterDocumentName, param);
|
|
|
+ printRegion.RequestNavigate(HomePagePrinterDocumentRegionName, HomePagePrinterDocumentName, param);
|
|
|
PageSetupDialog pageSetupDialog = new PageSetupDialog();
|
|
|
PrintSettingsInfo.PrintDocument.PrinterSettings.PrinterName = PrinterName;
|
|
|
pageSetupDialog.Document = PrintSettingsInfo.PrintDocument;
|
|
@@ -884,6 +885,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
|
|
|
public void OnDialogOpened(IDialogParameters parameters)
|
|
|
{
|
|
|
+
|
|
|
parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
|
|
|
if (PDFViewer != null && PDFViewer.Document != null)
|
|
|
{
|
|
@@ -899,7 +901,29 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
{
|
|
|
isCurrentPage = false;
|
|
|
}
|
|
|
+
|
|
|
+ //if (parameters.TryGetValue<List<int>>(ParameterNames.PageList, out PageList))
|
|
|
+ //{
|
|
|
+ // PageListString = CommonHelper.GetPageParmFromList(PageList);
|
|
|
+ // if (!string.IsNullOrEmpty(PageListString))
|
|
|
+ // {
|
|
|
+ // PrintSettingsInfo.PageRangeList = PageList;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ List<int> PageList = new List<int>();
|
|
|
+
|
|
|
+ PageRangeSelectIndex = 4;
|
|
|
+ PageList.Clear();
|
|
|
+ PageList.Add(1);
|
|
|
+ PageList.Add(2);
|
|
|
+ PageListString = CommonHelper.GetPageParmFromList(PageList);
|
|
|
+ if (!string.IsNullOrEmpty(PageListString))
|
|
|
+ {
|
|
|
+ PrintSettingsInfo.PageRangeList = PageList;
|
|
|
+ }
|
|
|
+
|
|
|
System.Windows.Size pageSize = PDFViewer.Document.GetPageSize(0);
|
|
|
+
|
|
|
if ((pageSize.Height / pageSize.Width > 1.0 && (double)PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Height / PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Width < 1.0)
|
|
|
|| (pageSize.Height / pageSize.Width < 1.0 && (double)PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Height / PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Width > 1.0))
|
|
|
{
|