123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Printing;
- using System.Drawing.Printing;
- using System.Windows;
- using ComPDFKit.PDFDocument;
- namespace ComPDFKit.Controls
- {
- public enum PrintOrientation
- {
- Portrait,
- Landscape,
- Auto
- }
- public enum DuplexStage
- {
- None,
- FrontSide,
- BackSide
- }
- public enum DuplexPrintMod
- {
- None,
- FlipLongEdge,
- FlipShortEdge
- }
- public enum PrintMod
- {
- Size,
- Poster,
- Multiple,
- Booklet
- }
- public enum DisplayPageNumber
- {
- Two,
- Four,
- Six,
- Nine,
- Sixteen,
- Customized
- }
- public enum PageOrder
- {
- Horizontal,
- HorizontalReverse,
- Vertical,
- VerticalReverse,
- }
- public enum SizeType
- {
- Adaptive,
- Actural,
- Customized
- }
- public enum BookletBinding
- {
- Left,
- Right,
- LeftTall,
- RightTall
- }
- public enum BookletSubset
- {
- BothSides,
- FrontSideOnly,
- BackSideOnly
- }
- public class PrinterModel
- {
- }
- public class PrintSettingsInfo
- {
- public CPDFDocument Document;
- public bool IsGrayscale { get; set; } = false;
- public bool IsReverseOrder { get; set; } = false;
- public bool IsDuplex { get; set; } = false;
- public bool NeedRerendering { get; set; } = true;
- public bool IsPaperSizeChanged { get; set; } = false;
- public bool NeedReversePage { get; set; } = false;
- public bool IsPrintAnnot { get; set; } = true;
- public bool IsPrintForm { get; set; } = true;
- public int Copies { get; set; } = 1;
- public string PrinterName { get; set; } = string.Empty;
- public DuplexPrintMod DuplexPrintMod { get; set; } = DuplexPrintMod.None;
- public PrintOrientation PrintOrientation { get; set; } = PrintOrientation.Portrait;
- public Rect PageBound { get; set; } = new Rect();
- public List<int> PageRangeList = new List<int>();
- public PrintDocument PrintDocument { get; set; } = new PrintDocument();
- public Margins Margins { get; set; } = new Margins() { Bottom = 0, Left = 0, Right = 0, Top = 0 };
- public PaperSize PaperSize { get; set; } = null;
- public PrintMode PrintMode { get; set; } = null;
- }
- public abstract class PrintMode { }
- public class SizeModeInfo : PrintMode
- {
- public SizeType SizeType { get; set; } = SizeType.Adaptive;
- public int Scale { get; set; } = 100;
- }
- public class PosterModeInfo : PrintMode
- {
- public bool HasCutmarks { get; set; } = false;
- public bool HasLabel { get; set; } = false;
- public double OverLap { get; set; } = 0;
- public int TileRatio { get; set; } = 100;
- public string Label { get; set; } = string.Empty;
- }
- public class MultipleModeInfo : PrintMode
- {
- public PageOrder PageOrder { get; set; } = PageOrder.Horizontal;
- public SheetPair Sheet { get; set; } = new SheetPair(2, 1);
- public bool IsAutoRotate { get; set; } = false;
- public bool IsPrintBorder { get; set; } = false;
- public class SheetPair : IEquatable<SheetPair>
- {
- public int HorizontalPageNumber { get; set; }
- public int VerticalPageNumber { get; set; }
- public int TotalPageNumber
- {
- get => HorizontalPageNumber * VerticalPageNumber;
- }
- public SheetPair(int horizontalPageNumber, int verticalPageNumber)
- {
- HorizontalPageNumber = horizontalPageNumber;
- VerticalPageNumber = verticalPageNumber;
- }
- public bool Equals(SheetPair other)
- {
- return HorizontalPageNumber == other.HorizontalPageNumber && VerticalPageNumber == other.VerticalPageNumber;
- }
- }
- }
- public class BookletModeInfo : PrintMode
- {
- public BookletBinding BookletBinding { get; set; } = BookletBinding.Left;
- public BookletSubset Subset { get; set; } = BookletSubset.BothSides;
- public int BeginPageIndex { get; set; }
- public int EndPageIndex { get; set; }
- public bool IsAutoRotate { get; set; } = false;
- }
- }
|