Java Code Examples for com.lowagie.text.pdf.PdfArray#getPdfObject()
The following examples show how to use
com.lowagie.text.pdf.PdfArray#getPdfObject() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PdfContentStreamProcessor.java From gcs with Mozilla Public License 2.0 | 6 votes |
@Override public void invoke(PdfContentStreamProcessor processor, PdfLiteral operator, ArrayList operands) { PdfName dictionaryName = (PdfName) operands.get(0); PdfDictionary extGState = processor.resources.getAsDict(PdfName.EXTGSTATE); if (extGState == null) { throw new IllegalArgumentException("Resources do not contain ExtGState entry. Unable to process operator " + operator); } PdfDictionary gsDic = extGState.getAsDict(dictionaryName); if (gsDic == null) { throw new IllegalArgumentException(dictionaryName + " is an unknown graphics state dictionary"); } // 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 = new CMapAwareDocumentFont((PRIndirectReference) fontParameter.getPdfObject(0)); float size = fontParameter.getAsNumber(1).floatValue(); processor.gs().font = font; processor.gs().fontSize = size; } }
Example 2
Source File: PdfContentStreamProcessor.java From itext2 with GNU Lesser General Public License v3.0 | 6 votes |
public void invoke(PdfContentStreamProcessor processor, PdfLiteral operator, ArrayList operands) { PdfName dictionaryName = (PdfName) operands.get(0); PdfDictionary extGState = processor.resources.getAsDict(PdfName.EXTGSTATE); if (extGState == null) { throw new IllegalArgumentException( "Resources do not contain ExtGState entry. Unable to process operator " + operator); } PdfDictionary gsDic = extGState.getAsDict(dictionaryName); if (gsDic == null) { throw new IllegalArgumentException(dictionaryName + " is an unknown graphics state dictionary"); } // 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 = new CMapAwareDocumentFont( (PRIndirectReference) fontParameter.getPdfObject(0)); float size = fontParameter.getAsNumber(1).floatValue(); processor.gs().font = font; processor.gs().fontSize = size; } }