Пример #1
0
 /// <summary>
 /// Creates
 /// <c>TagTreePointer</c>
 /// instance. After creation
 /// <c>TagTreePointer</c>
 /// points at the root tag.
 /// <p>
 /// The
 /// <see cref="iText.Kernel.Pdf.Tagging.PdfNamespace"/>
 /// for the new tags, which don't explicitly define namespace by the means of
 /// <see cref="DefaultAccessibilityProperties.SetNamespace(iText.Kernel.Pdf.Tagging.PdfNamespace)"/>
 /// , is set to the value returned by
 /// <see cref="TagStructureContext.GetDocumentDefaultNamespace()"/>
 /// on
 /// <see cref="TagTreePointer"/>
 /// creation.
 /// See also
 /// <see cref="SetNamespaceForNewTags(iText.Kernel.Pdf.Tagging.PdfNamespace)"/>
 /// .
 /// </p>
 /// </summary>
 /// <param name="document">the document, at which tag structure this instance will point.</param>
 public TagTreePointer(PdfDocument document)
 {
     // '-1' value of this field means that next new kid will be the last element in the kids array
     tagStructureContext = document.GetTagStructureContext();
     SetCurrentStructElem(tagStructureContext.GetRootTag());
     SetNamespaceForNewTags(tagStructureContext.GetDocumentDefaultNamespace());
 }
Пример #2
0
        private void CreateNewRootTag()
        {
            IRoleMappingResolver mapping;
            PdfNamespace         docDefaultNs = context.GetDocumentDefaultNamespace();

            mapping = context.ResolveMappingToStandardOrDomainSpecificRole(StandardRoles.DOCUMENT, docDefaultNs);
            if (mapping == null || mapping.CurrentRoleIsStandard() && !StandardRoles.DOCUMENT.Equals(mapping.GetRole()
                                                                                                     ))
            {
                LogCreatedRootTagHasMappingIssue(docDefaultNs, mapping);
            }
            rootTagElement = document.GetStructTreeRoot().AddKid(new PdfStructElem(document, PdfName.Document));
            if (context.TargetTagStructureVersionIs2())
            {
                rootTagElement.SetNamespace(docDefaultNs);
                context.EnsureNamespaceRegistered(docDefaultNs);
            }
        }
Пример #3
0
 /// <summary>
 /// Creates
 /// <c>TagTreePointer</c>
 /// instance.
 /// </summary>
 /// <remarks>
 /// Creates
 /// <c>TagTreePointer</c>
 /// instance. After creation
 /// <c>TagTreePointer</c>
 /// points at the root tag.
 /// <para />
 /// The
 /// <see cref="iText.Kernel.Pdf.Tagging.PdfNamespace"/>
 /// for the new tags, which don't explicitly define namespace by the means of
 /// <see cref="DefaultAccessibilityProperties.SetNamespace(iText.Kernel.Pdf.Tagging.PdfNamespace)"/>
 /// , is set to the value returned by
 /// <see cref="TagStructureContext.GetDocumentDefaultNamespace()"/>
 /// on
 /// <see cref="TagTreePointer"/>
 /// creation.
 /// See also
 /// <see cref="SetNamespaceForNewTags(iText.Kernel.Pdf.Tagging.PdfNamespace)"/>.
 /// </remarks>
 /// <param name="document">the document, at which tag structure this instance will point.</param>
 public TagTreePointer(PdfDocument document)
 {
     tagStructureContext = document.GetTagStructureContext();
     SetCurrentStructElem(tagStructureContext.GetRootTag());
     SetNamespaceForNewTags(tagStructureContext.GetDocumentDefaultNamespace());
 }