HomePagePrinterDialogModel.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing.Printing;
  4. using System.Linq;
  5. using System.Numerics;
  6. using System.Printing;
  7. using System.Runtime.Remoting.Channels;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using static PDF_Master.Model.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterDialogModel;
  12. namespace PDF_Master.Model.Dialog.HomePageToolsDialogs.HomePagePrinter
  13. {
  14. public class PrintSettingsInfo
  15. {
  16. /// <summary>
  17. /// 灰度
  18. /// </summary>
  19. public bool IsGrayscale { get; set; }
  20. /// <summary>
  21. /// 纸张尺寸
  22. /// </summary>
  23. public PageMediaSize PageMediaSize;
  24. /// <summary>
  25. /// 页码范围
  26. /// </summary>
  27. public int EnumPageRange = 0;
  28. /// <summary>
  29. /// 逆页序
  30. /// </summary>
  31. public bool IsIndexReverse { get; set; }
  32. /// <summary>
  33. /// 双面打印
  34. /// </summary>
  35. public bool IsDuplex = false;
  36. /// <summary>
  37. /// 是否打印页面边框
  38. /// </summary>
  39. public bool IsPrintPageBorde = false;
  40. /// <summary>
  41. /// 打印方向
  42. /// </summary>
  43. public EnumPrintOrientation EnumPrintOrientation = EnumPrintOrientation.StatusPortrait;
  44. /// <summary>
  45. /// 带Annot
  46. /// </summary>
  47. public bool IsPrintWithAnnot = true;
  48. /// <summary>
  49. /// 带Form
  50. /// </summary>
  51. public bool IsPrintWithForm = true;
  52. /// <summary>
  53. /// Copies
  54. /// </summary>
  55. public int Copies { get; set; }
  56. /// <summary>
  57. /// 打印机名称
  58. /// </summary>
  59. public string PrinterName { get; set; }
  60. /// <summary>
  61. /// 自定义打印页码范围
  62. /// </summary>
  63. public List<int> PageRangeList = new List<int>();
  64. /// <summary>
  65. /// 打印Mod
  66. /// </summary>
  67. public PrintModInfo PrintModInfo = new SizeInfo();
  68. /// <summary>
  69. /// Document对象,用于打印
  70. /// </summary>
  71. public PrintDocument PrintDocument = new PrintDocument();
  72. /// <summary>
  73. /// 是否双面打印
  74. /// </summary>
  75. public bool IsBothSides = false;
  76. /// <summary>
  77. /// 边距
  78. /// </summary>
  79. public List<int> Margin = new List<int>();
  80. /// <summary>
  81. /// 需要重新渲染?
  82. /// </summary>
  83. public bool needRerendering = true;
  84. /// <summary>
  85. /// 解决一直获取纸张信息引发卡顿的问题
  86. /// </summary>
  87. public bool IsPaperSizeChanged = false;
  88. /// <summary>
  89. /// 在每次重新计算页码范围时,都需要根据needreversepage判定是否要翻转页码
  90. /// </summary>
  91. public bool needReversePage = false;
  92. public PrintSettingsInfo()
  93. {
  94. PrintDocument.DefaultPageSettings.Landscape = false;
  95. }
  96. }
  97. public class HomePagePrinterDialogModel
  98. {
  99. }
  100. public enum EnumSizeType
  101. {
  102. StatusAdaptive,
  103. StatusActural,
  104. StatusCustomized,
  105. }
  106. /// <summary>
  107. /// 双面打印阶段
  108. /// </summary>
  109. public enum EnumBothSidesStage
  110. {
  111. StatusNone,
  112. StatusFrontSide,
  113. StatusBackSide
  114. }
  115. public enum EnumPageRangeWithoutCurrentPage
  116. {
  117. StatusAllRange,
  118. StatusOddRange,
  119. StatusEvenRange,
  120. StatusCustomizedRange,
  121. }
  122. public enum EnumPageRangeWithCurrentPage
  123. {
  124. StatusAllRange,
  125. StatusCurrentPage,
  126. StatusOddRange,
  127. StatusEvenRange,
  128. StatusCustomizedRange,
  129. }
  130. public enum EnumPrintOrientation
  131. {
  132. StatusPortrait,
  133. StatusLandscape
  134. }
  135. public enum EnumPrintContent
  136. {
  137. StatusOnlyDocument,
  138. StatusDocumentAndMarkUps,
  139. StatusDocumentAndStamps,
  140. StatusDocumentAndForm
  141. }
  142. public enum EnumPrintMod
  143. {
  144. StatusSize,
  145. StatusPoster,
  146. StatusMultiple,
  147. StatusBooklet
  148. }
  149. public enum EnumPosterMod
  150. {
  151. StatusTile,
  152. StatusSplit
  153. }
  154. public enum EnumDisplayPageNumber
  155. {
  156. StatusTwo,
  157. StatusFour,
  158. StatusSix,
  159. StatusNine,
  160. StatusSixteen,
  161. StatusCustomized
  162. }
  163. public enum EnumPageOrder
  164. {
  165. StatusHorizontalOrder,
  166. StatusHorizontalReverseOrder,
  167. StatusVerticalOrder,
  168. StatusVerticalReverseOrder,
  169. }
  170. public enum EnumBookletSubset
  171. {
  172. StatusBothSides,
  173. StatusFrontSideOnly,
  174. StatusBackSideOnly
  175. }
  176. public enum EnumBookletBinding
  177. {
  178. StatusLeft,
  179. StatusRight
  180. }
  181. public enum EnumDuplexPrintMod
  182. {
  183. StatusNone,
  184. StatusFlipLongEdge,
  185. StatusFlipShortEdge
  186. }
  187. public class PrintModInfo
  188. {
  189. public EnumPrintMod EnumPrintMod = EnumPrintMod.StatusSize;
  190. /// <summary>
  191. /// 双面打印
  192. /// </summary>
  193. public EnumDuplexPrintMod EnumDuplexPrintMod = EnumDuplexPrintMod.StatusNone;
  194. }
  195. public class SizeInfo : PrintModInfo
  196. {
  197. public EnumSizeType EnumSizeType = EnumSizeType.StatusAdaptive;
  198. public int DisplayRatio = 100;
  199. }
  200. public class PosterInfo : PrintModInfo
  201. {
  202. public EnumPosterMod EnumPosterMod;
  203. public bool HasCutMarks { get; set; }
  204. public bool HasLabel { get; set; }
  205. public double OverLap { get; set; }
  206. public EnumDisplayPageNumber EnumDisplayPageNumber { get; set; }
  207. public int HorizontalSheetNumber = 2;
  208. public int VerticalSheetNumber = 2;
  209. public int TileRatio { get; set; }
  210. public string Label;
  211. }
  212. public class MultipleInfo : PrintModInfo
  213. {
  214. public EnumPageOrder EnumPageOrder = EnumPageOrder.StatusHorizontalOrder;
  215. public EnumDisplayPageNumber EnumDisplayPageNumber = EnumDisplayPageNumber.StatusTwo;
  216. public int HorizontalPageNumber = 2;
  217. public int VerticalPageNumber = 1;
  218. public bool IsAutoRotate = false;
  219. }
  220. public class BookletInfo : PrintModInfo
  221. {
  222. public EnumBookletSubset EnumBookletSubset = EnumBookletSubset.StatusBothSides;
  223. public EnumBookletBinding EnumBookletBinding = EnumBookletBinding.StatusLeft;
  224. public int BeginPaperIndex = 1;
  225. public int EndPaperIndex = 1;
  226. public bool IsAutoRotate = false;
  227. }
  228. }