예제 #1
0
        private static FontFlags GetFlags(PdfDictionary dictionary, bool isLenientParsing)
        {
            var flags = dictionary.GetIntOrDefault(CosName.FLAGS, -1);

            if (flags == -1)
            {
                if (isLenientParsing)
                {
                    flags = 0;
                }
                else
                {
                    throw new InvalidOperationException("Font flags were not set correctly for the font descriptor: " + dictionary);
                }
            }

            return((FontFlags)flags);
        }
예제 #2
0
파일: Pages.cs 프로젝트: AnilAwadh/Pdf
        internal Pages(ILog log, Catalog catalog, IPdfObjectParser pdfObjectParser, IPageFactory pageFactory,
                       IRandomAccessRead reader, bool isLenientParsing)
        {
            if (catalog == null)
            {
                throw new ArgumentNullException(nameof(catalog));
            }

            rootPageDictionary = catalog.PagesDictionary;

            Count = rootPageDictionary.GetIntOrDefault(CosName.COUNT);

            this.log              = log;
            this.catalog          = catalog;
            this.pdfObjectParser  = pdfObjectParser;
            this.pageFactory      = pageFactory;
            this.reader           = reader;
            this.isLenientParsing = isLenientParsing;
        }
 public static int GetIntOrDefault(this PdfDictionary dictionary, CosName firstKey, CosName secondKey)
 {
     return(dictionary.GetIntOrDefault(firstKey, secondKey, -1));
 }
 public static int GetIntOrDefault(this PdfDictionary dictionary, CosName key, int defaultValue)
 {
     return(dictionary.GetIntOrDefault(key, null, defaultValue));
 }
 public static int GetIntOrDefault(this PdfDictionary dictionary, string key, int defaultValue)
 {
     return(dictionary.GetIntOrDefault(CosName.Create(key), defaultValue));
 }
 public static int GetIntOrDefault(this PdfDictionary dictionary, CosName key)
 {
     return(dictionary.GetIntOrDefault(key, -1));
 }