HomePagePrinterDialogModel.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterDialogModel;
  12. namespace PDF_Office.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. public PrintSettingsInfo()
  89. {
  90. PrintDocument.DefaultPageSettings.Landscape = false;
  91. }
  92. }
  93. public class HomePagePrinterDialogModel
  94. {
  95. }
  96. public enum EnumSizeType
  97. {
  98. StatusAdaptive,
  99. StatusActural,
  100. StatusCustomized,
  101. }
  102. /// <summary>
  103. /// 双面打印阶段
  104. /// </summary>
  105. public enum EnumBothSidesStage
  106. {
  107. StatusNone,
  108. StatusFrontSide,
  109. StatusBackSide
  110. }
  111. public enum EnumPageRangeWithoutCurrentPage
  112. {
  113. StatusAllRange,
  114. StatusOddRange,
  115. StatusEvenRange,
  116. StatusCustomizedRange,
  117. }
  118. public enum EnumPageRangeWithCurrentPage
  119. {
  120. StatusAllRange,
  121. StatusCurrentPage,
  122. StatusOddRange,
  123. StatusEvenRange,
  124. StatusCustomizedRange,
  125. }
  126. public enum EnumPrintOrientation
  127. {
  128. StatusPortrait,
  129. StatusLandscape
  130. }
  131. public enum EnumPrintContent
  132. {
  133. StatusOnlyDocument,
  134. StatusDocumentAndMarkUps,
  135. StatusDocumentAndStamps,
  136. StatusDocumentAndForm
  137. }
  138. public enum EnumPrintMod
  139. {
  140. StatusSize,
  141. StatusPoster,
  142. StatusMultiple,
  143. StatusBooklet
  144. }
  145. public enum EnumPosterMod
  146. {
  147. StatusTile,
  148. StatusSplit
  149. }
  150. public enum EnumDisplayPageNumber
  151. {
  152. StatusTwo,
  153. StatusFour,
  154. StatusSix,
  155. StatusNine,
  156. StatusSixteen,
  157. StatusCustomized
  158. }
  159. public enum EnumPageOrder
  160. {
  161. StatusHorizontalOrder,
  162. StatusHorizontalReverseOrder,
  163. StatusVerticalOrder,
  164. StatusVerticalReverseOrder,
  165. }
  166. public enum EnumBookletSubset
  167. {
  168. StatusBothSides,
  169. StatusFrontSideOnly,
  170. StatusBackSideOnly
  171. }
  172. public enum EnumBookletBinding
  173. {
  174. StatusLeft,
  175. StatusRight
  176. }
  177. public enum EnumDuplexPrintMod
  178. {
  179. StatusNone,
  180. StatusFlipLongEdge,
  181. StatusFlipShortEdge
  182. }
  183. public class PrintModInfo
  184. {
  185. public EnumPrintMod EnumPrintMod = EnumPrintMod.StatusSize;
  186. /// <summary>
  187. /// 双面打印
  188. /// </summary>
  189. public EnumDuplexPrintMod EnumDuplexPrintMod = EnumDuplexPrintMod.StatusNone;
  190. }
  191. public class SizeInfo : PrintModInfo
  192. {
  193. public EnumSizeType EnumSizeType = EnumSizeType.StatusAdaptive;
  194. public int DisplayRatio = 100;
  195. }
  196. public class PosterInfo : PrintModInfo
  197. {
  198. public EnumPosterMod EnumPosterMod;
  199. public bool HasCutMarks { get; set; }
  200. public bool HasLabel { get; set; }
  201. public double OverLap { get; set; }
  202. public EnumDisplayPageNumber EnumDisplayPageNumber { get; set; }
  203. public int HorizontalSheetNumber = 2;
  204. public int VerticalSheetNumber = 2;
  205. public int TileRatio { get; set; }
  206. public string Label;
  207. }
  208. public class MultipleInfo : PrintModInfo
  209. {
  210. public EnumPageOrder EnumPageOrder = EnumPageOrder.StatusHorizontalOrder;
  211. public EnumDisplayPageNumber EnumDisplayPageNumber = EnumDisplayPageNumber.StatusTwo;
  212. public int HorizontalPageNumber = 2;
  213. public int VerticalPageNumber = 1;
  214. public bool IsAutoRotate = false;
  215. }
  216. public class BookletInfo : PrintModInfo
  217. {
  218. public EnumBookletSubset EnumBookletSubset = EnumBookletSubset.StatusBothSides;
  219. public EnumBookletBinding EnumBookletBinding = EnumBookletBinding.StatusLeft;
  220. public int BeginPaperIndex = 1;
  221. public int EndPaperIndex = 1;
  222. public bool IsAutoRotate = false;
  223. }
  224. }