Examples of PdfTextString


Examples of org.pdfclown.objects.PdfTextString

        objectsDataObject.add(
          item.getBaseObject()
          );
      else if(item instanceof Field)
        objectsDataObject.add(
          new PdfTextString(((Field)item).getFullName())
          );
      else
        throw new IllegalArgumentException(
          "Invalid 'Hide' action target type (" + item.getClass().getName() + ").\n"
            + "It MUST be either an annotation or a form field."
View Full Code Here

Examples of org.pdfclown.objects.PdfTextString

      {
        PdfDirectObject annotationRefObject;
        if(value instanceof Integer)
        {annotationRefObject = new PdfInteger((Integer)value);}
        else if(value instanceof String)
        {annotationRefObject = new PdfTextString((String)value);}
        else
          throw new IllegalArgumentException("Wrong argument type: it MUST be either an annotation index Integer or an annotation name String.");

        getBaseDataObject().put(PdfName.A, annotationRefObject);
      }
View Full Code Here

Examples of org.pdfclown.objects.PdfTextString

    Document context,
    String script
    )
  {
    super(context, PdfName.JavaScript);
    getBaseDataObject().put(PdfName.JS,new PdfTextString(script));
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfTextString

          return new PdfReference(
            (Reference)token,
            file
            );
        case Literal:
          return new PdfTextString(
            Encoding.encode((String)token)
            );
        case DictionaryBegin:
          PdfDictionary dictionary = new PdfDictionary();
          while(true)
          {
            // Key.
            moveNext(); if(tokenType == TokenTypeEnum.DictionaryEnd) break;
            PdfName key = (PdfName)parsePdfObject();
            // Value.
            moveNext();
            PdfDirectObject value = (PdfDirectObject)parsePdfObject();
            // Add the current entry to the dictionary!
            dictionary.put(key,value);
          }

          int oldOffset = (int)stream.getPosition();
          moveNext();
          // Is this dictionary the header of a stream object [PDF:1.6:3.2.7]?
          if((tokenType == TokenTypeEnum.Keyword)
            && token.equals(Keyword.BeginStream)) // Stream.
          {
            // Keep track of current position!
            long position = stream.getPosition();

            // Get the stream length!
            /*
              NOTE: Indirect reference resolution is an outbound call (stream pointer hazard!),
              so we need to recover our current position after it returns.
            */
            int length = ((PdfInteger)File.resolve(dictionary.get(PdfName.Length))).getRawValue();

            // Move to the stream data beginning!
            stream.seek(position); skipEOL();

            // Copy the stream data to the instance!
            byte[] data = new byte[length];
            try
            {stream.read(data);}
            catch(EOFException e)
            {throw new FileFormatException("Unexpected EOF (malformed stream object).",e,stream.getPosition());}

            moveNext(); // Postcondition (last token should be 'endstream' keyword).

            Object streamType = dictionary.get(PdfName.Type);
            if(PdfName.ObjStm.equals(streamType)) // Object stream [PDF:1.6:3.4.6].
              return new ObjectStream(
                dictionary,
                new Buffer(data),
                file
                );
            else if(PdfName.XRef.equals(streamType)) // Cross-reference stream [PDF:1.6:3.4.7].
              return new XRefStream(
                dictionary,
                new Buffer(data),
                file
                );
            else // Generic stream.
              return new PdfStream(
                dictionary,
                new Buffer(data)
                );
          }
          else // Stand-alone dictionary.
          {
            stream.seek(oldOffset); // Restores postcondition (last token should be the dictionary end).

            return dictionary;
          }
        case ArrayBegin:
          PdfArray array = new PdfArray();
          while(true)
          {
            // Value.
            moveNext(); if(tokenType == TokenTypeEnum.ArrayEnd) break;
            // Add the current item to the array!
            array.add((PdfDirectObject)parsePdfObject());
          }
          return array;
        case Real:
          return new PdfReal((Float)token);
        case Boolean:
          return PdfBoolean.get((Boolean)token);
        case Date:
          return new PdfDate((Date)token);
        case Hex:
          return new PdfTextString(
            (String)token,
            PdfString.SerializationModeEnum.Hex
            );
        case Null:
          return null;
View Full Code Here

Examples of org.pdfclown.objects.PdfTextString

  {
    this(widget.getBaseObject());

    PdfDictionary baseDataObject = getBaseDataObject();
    baseDataObject.put(PdfName.FT, fieldType);
    baseDataObject.put(PdfName.T, new PdfTextString(name));
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfTextString

    @see #getName()
  */
  public void setName(
    String value
    )
  {getBaseDataObject().put(PdfName.T, new PdfTextString(value));}
View Full Code Here

Examples of org.pdfclown.objects.PdfTextString

        valueFieldReference = null;
        while(fieldObjectsIterator != null && fieldObjectsIterator.hasNext())
        {
          PdfReference fieldReference = (PdfReference)fieldObjectsIterator.next();
          PdfDictionary fieldDictionary = (PdfDictionary)fieldReference.getDataObject();
          PdfTextString fieldName = (PdfTextString)fieldDictionary.get(PdfName.T);
          if(fieldName != null && fieldName.getValue().equals(partialName))
          {
            valueFieldReference = fieldReference;
            PdfArray kidFieldObjects = (PdfArray)fieldDictionary.resolve(PdfName.Kids);
            fieldObjectsIterator = (kidFieldObjects == null ? null : kidFieldObjects.iterator());
            break;
View Full Code Here

Examples of org.pdfclown.objects.PdfTextString

  @Override
  public void setValue(
    Object value
    )
  {getBaseDataObject().put(PdfName.V,new PdfTextString((String)value));}
View Full Code Here

Examples of org.pdfclown.objects.PdfTextString

  */
  @PDF(VersionEnum.PDF14)
  public String getName(
    )
  {
    PdfTextString nameObject = (PdfTextString)getBaseDataObject().get(PdfName.NM);
    return nameObject == null ? null : nameObject.getValue();
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfTextString

    or (in case of non-textual annotations) used as alternate description.</p>
  */
  public String getText(
    )
  {
    PdfTextString textObject = (PdfTextString)getBaseDataObject().get(PdfName.Contents);
    return textObject == null ? null : textObject.getValue();
  }
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.