1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using ComPDFKit.PDFPage.Edit;
- using ComPDFKit.PDFPage;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Media;
- using ComPDFKitViewer.AnnotEvent;
- namespace PDFSettings
- {
- public class DefaultEditProperty
- {
- public bool IsItalic { get; set; }
- public bool ClipImage { get; set; }
- public bool HorizontalMirror { get; set; }
- public bool VerticalMirror { get; set; }
- public List<string> SystemFontNameList { get; }
- public int Transparency { get; set; }
- public bool IsBold { get; set; }
- public string ReplaceImagePath { get; set; }
- public string FontName { get; set; }
- public TextAlignType TextAlign { get; set; }
- public Color FontColor { get; set; }
- public bool AutoBlock { get; set; }
- public double FontSize { get; set; }
- public CPDFEditType EditType { get; set; }
- public int Rotate { get; set; } = 0;
- public string SaveKey;
- public DefaultEditProperty()
- {
- EditType = CPDFEditType.None;
- }
- }
- public class DefaultEditProperties : List<DefaultEditProperty>
- {
- public DefaultEditProperty GetEditProperty(CPDFEditType editType)
- {
- return this.AsEnumerable().Where(x => x.EditType == editType).FirstOrDefault();
- }
- public DefaultEditProperty GetEditProperty(CPDFEditType editType, string saveKey)
- {
- return this.AsEnumerable().Where(x => x.EditType == editType && x.SaveKey == saveKey).FirstOrDefault();
- }
- public void SetEditProperty(DefaultEditProperty editType)
- {
- DefaultEditProperty[] deleteArray = new DefaultEditProperty[0];
- if (editType.SaveKey != null && editType.SaveKey != string.Empty)
- {
- deleteArray = this.AsEnumerable().Where(x => x.EditType == editType.EditType && x.SaveKey == editType.SaveKey).ToArray();
- }
- else
- {
- deleteArray = this.AsEnumerable().Where(x => x.EditType == editType.EditType).ToArray();
- }
- foreach (DefaultEditProperty deleteProperty in deleteArray)
- {
- this.Remove(deleteProperty);
- }
- this.Add(editType);
- }
- }
- }
|