Ejemplo n.º 1
0
 public bool ContainsKey(
     PdfName key
     )
 {
     return(BaseDataObject.ContainsKey(key) ||
            (PdfName.A.Equals(key) && parent.BaseDataObject.ContainsKey(key)));
 }
Ejemplo n.º 2
0
        private void SetEntry <T, TPdf>(
            PdfName key,
            T value
            ) where TPdf : PdfAtomicObject <T>, new()
        {
            if (!BaseDataObject.ContainsKey(key))
            {
                BaseDataObject[key] = new TPdf();
            }

            ((TPdf)File.Resolve(BaseDataObject[key])).Value = value;
        }
Ejemplo n.º 3
0
 private void SetEntry <T, TPdf>(
     PdfName key,
     object value
     ) where TPdf : PdfAtomicObject <T>, new()
 {
     if (value == null)
     {
         BaseDataObject.Remove(key);
     }
     else
     {
         if (!BaseDataObject.ContainsKey(key))
         {
             BaseDataObject[key] = new TPdf();
         }
         ((TPdf)BaseDataObject.Resolve(key)).Value = value;
     }
 }
Ejemplo n.º 4
0
        /**
         * <summary>Loads font information from existing PDF font structure.</summary>
         */
        protected void Load(
            )
        {
            if (BaseDataObject.ContainsKey(PdfName.ToUnicode)) // To-Unicode explicit mapping.
            {
                PdfStream  toUnicodeStream = (PdfStream)BaseDataObject.Resolve(PdfName.ToUnicode);
                CMapParser parser          = new CMapParser(toUnicodeStream.Body);
                codes    = new BiDictionary <ByteArray, int>(parser.Parse());
                symbolic = false;
            }

            OnLoad();

            // Maximum character code length.
            foreach (ByteArray charCode in codes.Keys)
            {
                if (charCode.Data.Length > charCodeMaxLength)
                {
                    charCodeMaxLength = charCode.Data.Length;
                }
            }
            // Missing character substitute.
            if (defaultCode == UndefinedDefaultCode)
            {
                ICollection <int> codePoints = CodePoints;
                if (codePoints.Contains((int)'?'))
                {
                    DefaultCode = '?';
                }
                else if (codePoints.Contains((int)' '))
                {
                    DefaultCode = ' ';
                }
                else
                // PK 2017-03-08 - allow for encoding to fail, which should just result in a "?" or rectangle appearing instead of the correct character
                {
                    DefaultCode = codePoints.FirstOrDefault();
                }
            }
        }
Ejemplo n.º 5
0
        /**
         * <summary>Loads font information from existing PDF font structure.</summary>
         */
        protected void Load(
            )
        {
            if (BaseDataObject.ContainsKey(PdfName.ToUnicode)) // To-Unicode explicit mapping.
            {
                PdfStream  toUnicodeStream = (PdfStream)BaseDataObject.Resolve(PdfName.ToUnicode);
                CMapParser parser          = new CMapParser(toUnicodeStream.Body);
                codes    = new BiDictionary <ByteArray, int>(parser.Parse());
                symbolic = false;
            }

            OnLoad();

            // Maximum character code length.
            foreach (ByteArray charCode in codes.Keys)
            {
                if (charCode.Data.Length > charCodeMaxLength)
                {
                    charCodeMaxLength = charCode.Data.Length;
                }
            }
            // Missing character substitute.
            if (defaultCode == UndefinedDefaultCode)
            {
                ICollection <int> codePoints = CodePoints;
                if (codePoints.Contains((int)'?'))
                {
                    DefaultCode = '?';
                }
                else if (codePoints.Contains((int)' '))
                {
                    DefaultCode = ' ';
                }
                else
                {
                    DefaultCode = codePoints.First();
                }
            }
        }
Ejemplo n.º 6
0
        /**
         * <summary>Loads font information from existing PDF font structure.</summary>
         */
        protected void Load(
            )
        {
            if (BaseDataObject.ContainsKey(PdfName.ToUnicode)) // To-Unicode explicit mapping.
            {
                PdfStream  toUnicodeStream = (PdfStream)BaseDataObject.Resolve(PdfName.ToUnicode);
                CMapParser parser          = new CMapParser(toUnicodeStream.Body);
                codes    = new BiDictionary <ByteArray, int>(parser.Parse());
                symbolic = false;
            }

            OnLoad();

            // Maximum character code length.
            foreach (ByteArray charCode in codes.Keys)
            {
                if (charCode.Data.Length > charCodeMaxLength)
                {
                    charCodeMaxLength = charCode.Data.Length;
                }
            }
        }
Ejemplo n.º 7
0
 public bool ContainsKey(PdfName key)
 {
     return(BaseDataObject.ContainsKey(key));
 }