RedactParam.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using ComPDFKit.Import;
  2. using ComPDFKit.PDFAnnotation;
  3. using System.Collections.Generic;
  4. using System.Windows;
  5. using System.Windows.Media;
  6. namespace ComPDFKit.Tool
  7. {
  8. public class RedactParam:AnnotParam
  9. {
  10. public RedactParam ()
  11. {
  12. CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_REDACT;
  13. }
  14. public byte[] LineColor { get; set; }
  15. public byte[] BgColor { get; set; }
  16. public byte[] FontColor { get; set; }
  17. public string FontName { get; set; } = string.Empty;
  18. public string OverlayText { get; set; } = string.Empty;
  19. public double FontSize { get; set; }
  20. public C_TEXT_ALIGNMENT Alignment { get; set; }
  21. public List<CRect> QuardRects { get; set; }
  22. public override bool CopyTo(AnnotParam transfer)
  23. {
  24. RedactParam redactTransfer = transfer as RedactParam;
  25. if (redactTransfer == null)
  26. {
  27. return false;
  28. }
  29. if (!base.CopyTo(redactTransfer))
  30. {
  31. return false;
  32. }
  33. if(LineColor!=null)
  34. {
  35. redactTransfer.LineColor= (byte[])LineColor.Clone();
  36. }
  37. if(BgColor!=null)
  38. {
  39. redactTransfer.BgColor= (byte[])BgColor.Clone();
  40. }
  41. if(FontColor!=null)
  42. {
  43. redactTransfer.FontColor= (byte[])FontColor.Clone();
  44. }
  45. redactTransfer.FontName = FontName;
  46. redactTransfer.FontSize = FontSize;
  47. redactTransfer.Alignment = Alignment;
  48. redactTransfer.OverlayText = OverlayText;
  49. if (QuardRects != null)
  50. {
  51. List<CRect> rectList = new List<CRect>();
  52. foreach (CRect saveRect in QuardRects)
  53. {
  54. rectList.Add(saveRect);
  55. }
  56. redactTransfer.QuardRects = rectList;
  57. }
  58. return true;
  59. }
  60. }
  61. }