Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSDictionary.keySet()



    if (cbImg != null) {
      // ---- the referenced objects must be present in the PDF file
      COSDictionary dicImgs = COSUtils.getAsDictionary(cbImg, cDoc);
      Set<COSName> keyList = dicImgs.keySet();
      for (Object key : keyList) {

        COSBase item = dictionary.getItem((COSName) key);
        COSDictionary xObjImg = COSUtils.getAsDictionary(item, cDoc);
        if (xObjImg == null) {
View Full Code Here


    }

    if (cbFont != null) {
      // ---- the referenced object must be present in the PDF file
      COSDictionary dicFonts = COSUtils.getAsDictionary(cbFont, cDoc);
      Set<COSName> keyList = dicFonts.keySet();
      for (Object key : keyList) {

        COSBase item = dictionary.getItem((COSName) key);
        COSDictionary xObjFont = COSUtils.getAsDictionary(item, cDoc);
        if (xObjFont == null) {
View Full Code Here

    boolean res = true;
    if (dictionary != null) {
      COSDictionary shadings = (COSDictionary) dictionary
          .getDictionaryObject(PATTERN_KEY_SHADING);
      if (shadings != null) {
        for (COSName key : shadings.keySet()) {
          COSDictionary aShading = (COSDictionary) shadings.getDictionaryObject(key);
          ShadingPattern sp = new ShadingPattern(handler, aShading);
          List<ValidationError> lErrors = sp.validate();
          if (lErrors != null && !lErrors.isEmpty()) {
            result.addAll(lErrors);
View Full Code Here

                fontsDictionary = new COSDictionary();
                resources.setItem(COSName.FONT, fontsDictionary);
            }
            else
            {
                for (COSName fontName : fontsDictionary.keySet())
                {
                    COSBase font = fontsDictionary.getDictionaryObject(fontName);
                    // data-000174.pdf contains a font that is a COSArray, looks to be an error in the
                    // PDF, we will just ignore entries that are not dictionaries.
                    if (font instanceof COSDictionary)
View Full Code Here

                resources.setItem(COSName.XOBJECT, xobjectsDictionary);
            }
            else
            {
                xobjects = new HashMap<String, PDXObject>();
                for (COSName objName : xobjectsDictionary.keySet())
                {
                    PDXObject xobject = null;
                    try
                    {
                        xobject = PDXObject.createXObject(xobjectsDictionary.getDictionaryObject(objName));
View Full Code Here

        {
            COSDictionary csDictionary = (COSDictionary) resources.getDictionaryObject(COSName.COLORSPACE);
            if (csDictionary != null)
            {
                colorspaces = new HashMap<String, PDColorSpace>();
                for (COSName csName : csDictionary.keySet())
                {
                    COSBase cs = csDictionary.getDictionaryObject(csName);
                    PDColorSpace colorspace = null;
                    try
                    {
View Full Code Here

        {
            COSDictionary states = (COSDictionary) resources.getDictionaryObject(COSName.EXT_G_STATE);
            if (states != null)
            {
                graphicsStates = new HashMap<String, PDExtendedGraphicsState>();
                for (COSName name : states.keySet())
                {
                    COSDictionary dictionary = (COSDictionary) states.getDictionaryObject(name);
                    graphicsStates.put(name.getName(), new PDExtendedGraphicsState(dictionary));
                }
            }
View Full Code Here

        {
            COSDictionary patternsDictionary = (COSDictionary) resources.getDictionaryObject(COSName.PATTERN);
            if (patternsDictionary != null)
            {
                patterns = new HashMap<String, PDPatternResources>();
                for (COSName name : patternsDictionary.keySet())
                {
                    COSDictionary dictionary = (COSDictionary) patternsDictionary.getDictionaryObject(name);
                    patterns.put(name.getName(), PDPatternResources.create(dictionary));
                }
            }
View Full Code Here

        {
            COSDictionary shadingsDictionary = (COSDictionary) resources.getDictionaryObject(COSName.SHADING);
            if (shadingsDictionary != null)
            {
                shadings = new HashMap<String, PDShadingResources>();
                for (COSName name : shadingsDictionary.keySet())
                {
                    COSDictionary dictionary = (COSDictionary) shadingsDictionary.getDictionaryObject(name);
                    shadings.put(name.getName(), PDShadingResources.create(dictionary));
                }
            }
View Full Code Here

            }
        }

        // the dictionaries preserve the order keys were added, as such we shall
        // add them in the proper order, not the reverse order
        Set<COSName> backwardsKeys = backwardsDictionary.keySet();
        for(int i = backwardsKeys.size()-1; i >=0; i--)
            dict.setItem((COSName)backwardsKeys.toArray()[i], backwardsDictionary.getItem((COSName)backwardsKeys.toArray()[i]));
       
        // consume the last two '<' chars
        readByteBackwards();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.