예제 #1
0
        /// <summary>
        /// Adds a single
        /// <see cref="iText.Kernel.Pdf.Filespec.PdfFileSpec"/>
        /// object, which specifies XML file conforming to PLS.
        /// For more info see
        /// <see cref="GetPronunciationLexiconsList()"/>
        /// .
        /// <p>This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.</p>
        /// </summary>
        /// <param name="pronunciationLexiconFileSpec">
        /// a
        /// <see cref="iText.Kernel.Pdf.Filespec.PdfFileSpec"/>
        /// object, which specifies XML file conforming to PLS.
        /// </param>
        public virtual void AddPronunciationLexicon(PdfFileSpec pronunciationLexiconFileSpec)
        {
            PdfArray pronunciationLexicons = GetPdfObject().GetAsArray(PdfName.PronunciationLexicon);

            if (pronunciationLexicons == null)
            {
                pronunciationLexicons = new PdfArray();
                VersionConforming.ValidatePdfVersionForDictEntry(GetDocument(), PdfVersion.PDF_2_0, PdfName.PronunciationLexicon
                                                                 , PdfName.StructTreeRoot);
                GetPdfObject().Put(PdfName.PronunciationLexicon, pronunciationLexicons);
            }
            pronunciationLexicons.Add(pronunciationLexiconFileSpec.GetPdfObject());
            SetModified();
        }
예제 #2
0
        /// <summary>An array of namespaces used within the document.</summary>
        /// <remarks>
        /// An array of namespaces used within the document. This value, however, is not automatically updated while
        /// the document is processed. It identifies only the namespaces that were in the document at the moment of it's
        /// opening.
        /// </remarks>
        /// <returns>
        ///
        /// <see cref="iText.Kernel.Pdf.PdfArray"/>
        /// of namespaces used within the document.
        /// </returns>
        public virtual PdfArray GetNamespacesObject()
        {
            PdfArray namespacesArray = GetPdfObject().GetAsArray(PdfName.Namespaces);

            if (namespacesArray == null)
            {
                namespacesArray = new PdfArray();
                VersionConforming.ValidatePdfVersionForDictEntry(GetDocument(), PdfVersion.PDF_2_0, PdfName.Namespaces, PdfName
                                                                 .StructTreeRoot);
                GetPdfObject().Put(PdfName.Namespaces, namespacesArray);
                SetModified();
            }
            return(namespacesArray);
        }
예제 #3
0
 /// <summary>A namespace this element belongs to (see ISO 32000-2 14.7.4, "Namespaces").</summary>
 /// <remarks>
 /// A namespace this element belongs to (see ISO 32000-2 14.7.4, "Namespaces").
 /// <p>This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.</p>
 /// </remarks>
 /// <param name="namespace">
 /// a
 /// <see cref="PdfNamespace"/>
 /// this element belongs to, or null if element is desired to be considered
 /// in the default standard structure namespace.
 /// </param>
 public virtual void SetNamespace(PdfNamespace @namespace)
 {
     VersionConforming.ValidatePdfVersionForDictEntry(GetDocument(), PdfVersion.PDF_2_0, PdfName.NS, PdfName.StructElem
                                                      );
     if (@namespace != null)
     {
         Put(PdfName.NS, @namespace.GetPdfObject());
     }
     else
     {
         GetPdfObject().Remove(PdfName.NS);
         SetModified();
     }
 }
예제 #4
0
        /// <summary>
        /// A
        /// <see cref="iText.Kernel.Pdf.PdfName.Ref"/>
        /// identifies the structure element to which the item of content, contained
        /// within this structure element, refers (e.g. footnotes, endnotes, sidebars, etc.).
        /// <p>This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.</p>
        /// </summary>
        /// <param name="ref">
        /// a
        /// <see cref="PdfStructElem"/>
        /// to which the item of content, contained within this structure element, refers.
        /// </param>
        public virtual void AddRef(iText.Kernel.Pdf.Tagging.PdfStructElem @ref)
        {
            if ([email protected]().IsIndirect())
            {
                throw new PdfException(PdfException.RefArrayItemsInStructureElementDictionaryShallBeIndirectObjects);
            }
            VersionConforming.ValidatePdfVersionForDictEntry(GetDocument(), PdfVersion.PDF_2_0, PdfName.Ref, PdfName.StructElem
                                                             );
            PdfArray refsArray = GetPdfObject().GetAsArray(PdfName.Ref);

            if (refsArray == null)
            {
                refsArray = new PdfArray();
                Put(PdfName.Ref, refsArray);
            }
            refsArray.Add(@ref.GetPdfObject());
            SetModified();
        }
예제 #5
0
 /// <summary>
 /// Attribute for a structure element that indicates the phonetic alphabet used by a
 /// <see cref="iText.Kernel.Pdf.PdfName.Phoneme"/>
 /// attribute.
 /// Applies to the structure element and its children, except where overridden by a child structure element.
 /// <p>This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.</p>
 /// </summary>
 /// <param name="phoneticAlphabet">
 /// the
 /// <see cref="iText.Kernel.Pdf.PdfName"/>
 /// which defines phonetic alphabet used by a
 /// <see cref="iText.Kernel.Pdf.PdfName.Phoneme"/>
 /// attribute. Possible values are:
 /// <ul>
 /// <li>
 /// <see cref="iText.Kernel.Pdf.PdfName.ipa"/>
 /// for the International Phonetic Alphabet by the International Phonetic Association;</li>
 /// <li>
 /// <see cref="iText.Kernel.Pdf.PdfName.x_sampa"/>
 /// for Extended Speech Assessment Methods Phonetic Alphabet (X-SAMPA);</li>
 /// <li>
 /// <see cref="iText.Kernel.Pdf.PdfName.zh_Latn_pinyin"/>
 /// for Pinyin Latin romanization (Mandarin);</li>
 /// <li>
 /// <see cref="iText.Kernel.Pdf.PdfName.zh_Latn_wadegile"/>
 /// for Wade-Giles romanization (Mandarin).</li>
 /// </ul>
 /// Other values may be used.
 /// </param>
 public virtual void SetPhoneticAlphabet(PdfName phoneticAlphabet)
 {
     VersionConforming.ValidatePdfVersionForDictEntry(GetDocument(), PdfVersion.PDF_2_0, PdfName.PhoneticAlphabet
                                                      , PdfName.StructElem);
     Put(PdfName.PhoneticAlphabet, phoneticAlphabet);
 }
예제 #6
0
 /// <summary>Attribute for a structure element that may be used as pronunciation hint.</summary>
 /// <remarks>
 /// Attribute for a structure element that may be used as pronunciation hint. It is an exact replacement for content
 /// enclosed by the structure element and its children.
 /// <p>This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.</p>
 /// </remarks>
 /// <param name="elementPhoneme">
 /// a
 /// <see cref="iText.Kernel.Pdf.PdfString"/>
 /// which defines an exact replacement for content enclosed by the structure
 /// element and its children. This value is to be interpreted based on the PhoneticAlphabet attribute in effect.
 /// </param>
 public virtual void SetPhoneme(PdfString elementPhoneme)
 {
     VersionConforming.ValidatePdfVersionForDictEntry(GetDocument(), PdfVersion.PDF_2_0, PdfName.Phoneme, PdfName
                                                      .StructElem);
     Put(PdfName.Phoneme, elementPhoneme);
 }