iTextSharp.text.pdf.parser.PdfContentStreamProcessor.GetFont C# (CSharp) Method

GetFont() private method

private GetFont ( PRIndirectReference ind ) : CMapAwareDocumentFont
ind PRIndirectReference
return CMapAwareDocumentFont
        private CMapAwareDocumentFont GetFont(PRIndirectReference ind)
        {
            CMapAwareDocumentFont font;
            cachedFonts.TryGetValue(ind.Number, out font);
            if (font == null) {
                font = new CMapAwareDocumentFont(ind);
                cachedFonts[ind.Number] = font;
            }
            return font;
        }

Same methods

PdfContentStreamProcessor::GetFont ( PdfDictionary fontResource ) : CMapAwareDocumentFont

Usage Example

            public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List <PdfObject> operands)
            {
                PdfName       dictionaryName = (PdfName)operands[0];
                PdfDictionary extGState      = processor.resources.GetAsDict(PdfName.EXTGSTATE);

                if (extGState == null)
                {
                    throw new ArgumentException(MessageLocalization.GetComposedMessage("resources.do.not.contain.extgstate.entry.unable.to.process.oper.1", oper));
                }
                PdfDictionary gsDic = extGState.GetAsDict(dictionaryName);

                if (gsDic == null)
                {
                    throw new ArgumentException(MessageLocalization.GetComposedMessage("1.is.an.unknown.graphics.state.dictionary", dictionaryName));
                }

                // at this point, all we care about is the FONT entry in the GS dictionary
                PdfArray fontParameter = gsDic.GetAsArray(PdfName.FONT);

                if (fontParameter != null)
                {
                    CMapAwareDocumentFont font = processor.GetFont((PRIndirectReference)fontParameter[0]);
                    float size = fontParameter.GetAsNumber(1).FloatValue;

                    processor.Gs().font     = font;
                    processor.Gs().fontSize = size;
                }
            }
All Usage Examples Of iTextSharp.text.pdf.parser.PdfContentStreamProcessor::GetFont