diff --git a/itext/itext.kernel/itext/kernel/actions/events/LinkDocumentIdEvent.cs b/itext/itext.kernel/itext/kernel/actions/events/LinkDocumentIdEvent.cs index a72f0be8f4..c809215b0b 100644 --- a/itext/itext.kernel/itext/kernel/actions/events/LinkDocumentIdEvent.cs +++ b/itext/itext.kernel/itext/kernel/actions/events/LinkDocumentIdEvent.cs @@ -28,7 +28,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Kernel.Actions.Events { /// - /// An event allows to associated some + /// An event allows to associate some /// /// with /// . diff --git a/itext/itext.kernel/itext/kernel/utils/CompareTool.cs b/itext/itext.kernel/itext/kernel/utils/CompareTool.cs index 256a567b59..2449a523ef 100644 --- a/itext/itext.kernel/itext/kernel/utils/CompareTool.cs +++ b/itext/itext.kernel/itext/kernel/utils/CompareTool.cs @@ -116,6 +116,11 @@ public class CompareTool { private String compareExec; + /// + /// Create new + /// + /// instance. + /// public CompareTool() { } @@ -1691,6 +1696,20 @@ private PdfNumber FlattenNumTree(PdfDictionary dictionary, PdfNumber leftOver, L return null; } + /// Compare PDF objects. + /// out object corresponding to the output file, which is to be compared with cmp object + /// cmp object corresponding to the cmp-file, which is to be compared with out object + /// + /// current objects + /// + /// path + /// + /// + /// + /// + /// for the results of the comparison of the two documents + /// + /// true if objects are equal, false otherwise. protected internal virtual bool CompareObjects(PdfObject outObj, PdfObject cmpObj, ObjectPath currentPath, CompareTool.CompareResult compareResult) { PdfObject outDirectObj = null; @@ -2281,10 +2300,23 @@ public virtual void WriteReportToXml(Stream stream) { XmlUtils.WriteXmlDocToStream(xmlReport, stream); } + /// Checks whether maximum number of difference messages to be handled by this CompareResult is reached. + /// + /// true if limit of difference messages is reached, false otherwise. protected internal virtual bool IsMessageLimitReached() { return differences.Count >= messageLimit; } + /// + /// Adds an error message for the + /// . + /// + /// + /// + /// + /// for the two corresponding objects in the compared documents + /// + /// an error message protected internal virtual void AddError(ObjectPath path, String message) { if (differences.Count < messageLimit) { differences.Put(new ObjectPath(path), message); diff --git a/itext/itext.kernel/itext/kernel/utils/PageRange.cs b/itext/itext.kernel/itext/kernel/utils/PageRange.cs index a96ed690d0..acc82f1444 100644 --- a/itext/itext.kernel/itext/kernel/utils/PageRange.cs +++ b/itext/itext.kernel/itext/kernel/utils/PageRange.cs @@ -37,7 +37,7 @@ public class PageRange { private static readonly Regex SINGLE_PAGE_PATTERN = iText.Commons.Utils.StringUtil.RegexCompile("(\\d+)"); - private IList sequences = new List(); + private readonly IList sequences = new List(); /// /// Constructs an empty @@ -208,15 +208,30 @@ public override int GetHashCode() { /// Inner interface for range parts definition public interface IPageRangePart { //public List getAllPages(); + /// Gets the list of pages that have been added to the range part so far. + /// + /// number of pages of the document to get the pages, + /// to list only the pages eligible for this document + /// + /// the list containing page numbers added to the range part matching this document IList GetAllPagesInRange(int nbPages); + /// Checks if a given page is present in the range part built so far. + /// the page number to check + /// true if the page is present in this range, false otherwise bool IsPageInRange(int pageNumber); } - /// Class for range part containing a single page + /// Class for range part containing a single page. public class PageRangePartSingle : PageRange.IPageRangePart { private readonly int page; + /// + /// Creates new + /// + /// instance. + /// + /// a single page for a range part public PageRangePartSingle(int page) { this.page = page; } @@ -251,13 +266,20 @@ public override int GetHashCode() { /// /// Class for range part containing a range of pages represented by a start - /// and an end page + /// and an end page. /// public class PageRangePartSequence : PageRange.IPageRangePart { private readonly int start; private readonly int end; + /// + /// Creates new + /// + /// instance. + /// + /// the number of the first page in a range part + /// the number of the last page in a range part public PageRangePartSequence(int start, int end) { this.start = start; this.end = end; @@ -292,11 +314,17 @@ public override int GetHashCode() { /// /// Class for range part containing a range of pages for all pages after a - /// given start page + /// given start page. /// public class PageRangePartAfter : PageRange.IPageRangePart { private readonly int start; + /// + /// Creates new + /// + /// instance. + /// + /// the number of the first page in a range part public PageRangePartAfter(int start) { this.start = start; } @@ -391,6 +419,17 @@ public override int GetHashCode() { public class PageRangePartAnd : PageRange.IPageRangePart { private readonly IList conditions = new List(); + /// + /// Creates new + /// + /// instance. + /// + /// + /// + /// + /// conditions to combine several range parts, + /// e.g. to configure odd pages between page 19 and 25 + /// public PageRangePartAnd(params PageRange.IPageRangePart[] conditions) { this.conditions.AddAll(JavaUtil.ArraysAsList(conditions)); } diff --git a/itext/itext.kernel/itext/kernel/utils/PdfMerger.cs b/itext/itext.kernel/itext/kernel/utils/PdfMerger.cs index c7542d910c..e3f04beddb 100644 --- a/itext/itext.kernel/itext/kernel/utils/PdfMerger.cs +++ b/itext/itext.kernel/itext/kernel/utils/PdfMerger.cs @@ -25,6 +25,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Kernel.Pdf; namespace iText.Kernel.Utils { + /// Helper class to merge a number of existing documents into one. public class PdfMerger { private PdfDocument pdfDocument; diff --git a/itext/itext.kernel/itext/kernel/utils/PdfSplitter.cs b/itext/itext.kernel/itext/kernel/utils/PdfSplitter.cs index 6ef930a9e5..44a6f70074 100644 --- a/itext/itext.kernel/itext/kernel/utils/PdfSplitter.cs +++ b/itext/itext.kernel/itext/kernel/utils/PdfSplitter.cs @@ -29,6 +29,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Kernel.Pdf; namespace iText.Kernel.Utils { + /// Helper class to split the document based on some condition. public class PdfSplitter { private PdfDocument pdfDocument; @@ -192,6 +193,12 @@ public virtual PdfDocument ExtractPageRange(PageRange pageRange) { return ExtractPageRanges(JavaCollectionsUtil.SingletonList(pageRange))[0]; } + /// Gets the document to be split. + /// + /// + /// + /// to be split. + /// public virtual PdfDocument GetPdfDocument() { return pdfDocument; } @@ -224,7 +231,11 @@ private PdfDocument CreatePdfDocument(PageRange currentPageRange) { return newDocument; } + /// The event listener which is called when another document is ready. public interface IDocumentReadyListener { + /// Performs some action in case document is ready, e.g. closes the document. + /// the current document created as a result of the original document split + /// original document page range corresponding to the current document void DocumentReady(PdfDocument pdfDocument, PageRange pageRange); } diff --git a/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs b/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs index 82a0095107..c65335e8e6 100644 --- a/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs +++ b/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs @@ -59,7 +59,7 @@ public TaggedPdfReaderTool(PdfDocument document) { /// Checks if a character value should be escaped/unescaped. /// a character value - /// true if it's OK to escape or unescape this value + /// true if it's OK to escape or unescape this value. public static bool IsValidCharacterValue(int c) { return (c == 0x9 || c == 0xA || c == 0xD || c >= 0x20 && c <= 0xD7FF || c >= 0xE000 && c <= 0xFFFD || c >= 0x10000 && c <= 0x10FFFF); @@ -101,6 +101,8 @@ public virtual iText.Kernel.Utils.TaggedPdfReaderTool SetRootTag(String rootTagN return this; } + /// Inspect the children of the StructTreeRoot. + /// list of the direct kids of the StructTreeRoot protected internal virtual void InspectKids(IList kids) { if (kids == null) { return; @@ -110,6 +112,8 @@ protected internal virtual void InspectKids(IList kids) { } } + /// Inspect the child of the StructTreeRoot. + /// the direct kid of the StructTreeRoot protected internal virtual void InspectKid(IStructureNode kid) { try { if (kid is PdfStructElem) { @@ -146,6 +150,8 @@ protected internal virtual void InspectKid(IStructureNode kid) { } } + /// Inspects attributes dictionary of the StructTreeRoot child. + /// the direct kid of the StructTreeRoot protected internal virtual void InspectAttributes(PdfStructElem kid) { PdfObject attrObj = kid.GetAttributes(false); if (attrObj != null) { @@ -172,6 +178,12 @@ protected internal virtual void InspectAttributes(PdfStructElem kid) { } } + /// Parses tag of the Marked Content Reference (MCR) kid of the StructTreeRoot. + /// + /// the direct + /// + /// kid of the StructTreeRoot + /// protected internal virtual void ParseTag(PdfMcr kid) { int mcid = kid.GetMcid(); PdfDictionary pageDic = kid.GetPageObject(); @@ -205,6 +217,9 @@ protected internal virtual void ParseTag(PdfMcr kid) { } } + /// Fixes specified tag name to be valid XML tag. + /// tag name to fix + /// fixed tag name. protected internal static String FixTagName(String tag) { StringBuilder sb = new StringBuilder(); for (int k = 0; k < tag.Length; ++k) { diff --git a/itext/itext.kernel/itext/kernel/utils/ValidationContext.cs b/itext/itext.kernel/itext/kernel/utils/ValidationContext.cs index 5cc78cde50..20ae280cec 100644 --- a/itext/itext.kernel/itext/kernel/utils/ValidationContext.cs +++ b/itext/itext.kernel/itext/kernel/utils/ValidationContext.cs @@ -35,23 +35,72 @@ public class ValidationContext { private ICollection fonts = null; + /// + /// Creates new + /// + /// instance. + /// public ValidationContext() { } + /// + /// Sets + /// + /// for this + /// + /// instance. + /// + /// document to validate. + /// + /// this + /// + /// instance. + /// public virtual iText.Kernel.Utils.ValidationContext WithPdfDocument(PdfDocument pdfDocument) { this.PdfDocument = pdfDocument; return this; } + /// + /// Sets fonts for this + /// + /// instance. + /// + /// + /// collection of the + /// + /// fonts to validate. + /// + /// + /// this + /// + /// instance. + /// public virtual iText.Kernel.Utils.ValidationContext WithFonts(ICollection fonts) { this.fonts = fonts; return this; } + /// + /// Gets + /// + /// related to this + /// . + /// + /// + /// + /// + /// document to validate. + /// public virtual PdfDocument GetPdfDocument() { return PdfDocument; } + /// + /// Gets fonts related to this + /// . + /// + /// fonts to validate. public virtual ICollection GetFonts() { return fonts; } diff --git a/itext/itext.kernel/itext/kernel/utils/annotationsflattening/PdfAnnotationFlattenFactory.cs b/itext/itext.kernel/itext/kernel/utils/annotationsflattening/PdfAnnotationFlattenFactory.cs index f223a6a5dc..f7e6be913d 100644 --- a/itext/itext.kernel/itext/kernel/utils/annotationsflattening/PdfAnnotationFlattenFactory.cs +++ b/itext/itext.kernel/itext/kernel/utils/annotationsflattening/PdfAnnotationFlattenFactory.cs @@ -25,6 +25,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Kernel.Pdf; namespace iText.Kernel.Utils.Annotationsflattening { + /// Helper class to retrieve the annotation flatten worker for the specified annotation subtype. public class PdfAnnotationFlattenFactory { private static readonly Dictionary> map; diff --git a/itext/itext.kernel/itext/kernel/utils/objectpathitems/ObjectPath.cs b/itext/itext.kernel/itext/kernel/utils/objectpathitems/ObjectPath.cs index 6ce62140a2..3e8e943d20 100644 --- a/itext/itext.kernel/itext/kernel/utils/objectpathitems/ObjectPath.cs +++ b/itext/itext.kernel/itext/kernel/utils/objectpathitems/ObjectPath.cs @@ -85,6 +85,17 @@ public ObjectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseO indirects.Push(new IndirectPathItem(baseCmpObject, baseOutObject)); } + /// Creates CompareObjectPath with corresponding base objects in two documents. + /// base object in cmp document + /// base object in out document + /// + /// local path that denotes sequence of the path items from base object + /// to the comparing direct object + /// + /// + /// indirect path which denotes sequence of the indirect references that + /// were passed in comparing process to get to the current base objects + /// public ObjectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseOutObject, Stack path, Stack indirects) { this.baseCmpObject = baseCmpObject; diff --git a/itext/itext.kernel/itext/kernel/utils/objectpathitems/TrailerPath.cs b/itext/itext.kernel/itext/kernel/utils/objectpathitems/TrailerPath.cs index 69631606ac..33fbd620aa 100644 --- a/itext/itext.kernel/itext/kernel/utils/objectpathitems/TrailerPath.cs +++ b/itext/itext.kernel/itext/kernel/utils/objectpathitems/TrailerPath.cs @@ -28,6 +28,12 @@ You should have received a copy of the GNU Affero General Public License using iText.Kernel.Pdf; namespace iText.Kernel.Utils.Objectpathitems { + /// + /// Direct path item (see + /// + /// ), which describes transition to the + /// trailer entry which value is now a currently comparing direct object. + /// public sealed class TrailerPath : ObjectPath { private readonly PdfDocument outDocument; @@ -35,12 +41,31 @@ public sealed class TrailerPath : ObjectPath { private const String INITIAL_LINE = "Base cmp object: trailer. Base out object: trailer"; + /// + /// Creates new + /// + /// instance with corresponding base objects in two documents. + /// + /// base object in the cmp document + /// base object in the out document public TrailerPath(PdfDocument cmpDoc, PdfDocument outDoc) : base() { outDocument = outDoc; cmpDocument = cmpDoc; } + /// + /// Creates new + /// + /// instance from another + /// + /// object, passed as argument. + /// + /// + /// + /// + /// to create new instance from + /// public TrailerPath(iText.Kernel.Utils.Objectpathitems.TrailerPath trailerPath) : base() { outDocument = trailerPath.GetOutDocument(); @@ -48,6 +73,17 @@ public TrailerPath(iText.Kernel.Utils.Objectpathitems.TrailerPath trailerPath) path = trailerPath.GetLocalPath(); } + /// + /// Creates new + /// + /// instance with corresponding base objects in two documents. + /// + /// base object in the cmp document + /// base object in the out document + /// + /// local path that denotes sequence of the path items + /// from base object to the comparing direct object + /// public TrailerPath(PdfDocument cmpDoc, PdfDocument outDoc, Stack path) : base() { this.outDocument = outDoc; @@ -84,13 +120,13 @@ public PdfDocument GetCmpDocument() { } /// - /// Creates an xml node that describes this + /// Creates xml node that describes this /// /// instance. /// /// xml document, to which this xml node will be added. /// - /// an xml node describing this + /// xml node describing this /// /// instance. /// diff --git a/port-hash b/port-hash index b25e480b00..3ae0e234d6 100644 --- a/port-hash +++ b/port-hash @@ -1 +1 @@ -1d90097103a834791ee71ce587df3e65a064b5f5 +c6bb536ce09c82bd24aa9df78cbca0062e6278c8