Files
PDFPatcher/App/Processor/InfoDocProcessor/ShiftPageProcessor.cs
T
2022-01-06 09:08:16 +08:00

27 lines
573 B
C#

using System;
using System.Collections.Generic;
using System.Text;
using PDFPatcher.Common;
namespace PDFPatcher.Processor
{
sealed class ShiftPageProcessor : IInfoDocProcessor
{
public int Offset { get; set; }
#region IInfoDocProcessor 成员
public bool Process(System.Xml.XmlElement item) {
var a = item.GetAttributeNode(Constants.DestinationAttributes.Page);
if (a != null && a.Value.TryParse(out int pageNum)/* && pageNum > 0*/) {
pageNum += Offset;
a.Value = pageNum.ToText();
return true;
}
return false;
}
#endregion
}
}