HomePagePrinterDialogModel.cs 6.1 KB

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