Ejemplo n.º 1
0
            public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List <iTextSharp.text.pdf.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;
                }
            }
Ejemplo n.º 2
0
            public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List <iTextSharp.text.pdf.PdfObject> operands)
            {
                PdfName fontResourceName = (PdfName)operands[0];
                float   size             = ((PdfNumber)operands[1]).FloatValue;

                PdfDictionary         fontsDictionary = processor.resources.GetAsDict(PdfName.FONT);
                CMapAwareDocumentFont font;

                iTextSharp.text.pdf.PdfObject fontObject = fontsDictionary.Get(fontResourceName);
                if (fontObject is PdfDictionary)
                {
                    font = processor.GetFont((PdfDictionary)fontObject);
                }
                else
                {
                    font = processor.GetFont((PRIndirectReference)fontObject);
                }

                processor.Gs().font     = font;
                processor.Gs().fontSize = size;
            }