Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfNumber


      if (dict == null || !dict.checkType(PdfName.ANNOT))
        return;
      PdfDictionary ap = dict.getAsDict(PdfName.AP);
      if (ap == null)
        return;
      PdfNumber structParent = dict.getAsNumber(PdfName.STRUCTPARENT);
      if (structParent == null)
        return;
      PdfStream stream = ap.getAsStream(PdfName.N);
      if (stream == null)
        return;
      PdfIndirectReference xobjr = ap.getAsIndirectObject(PdfName.N);
      if (xobjr == null)
        return;
      // remove the annotation from the page
      for (int i = 0; i < annots.size(); i++) {
        PdfIndirectReference annotref = annots.getAsIndirectObject(i);
        if (item.getObjRef().getNumber() == annotref.getNumber()) {
          annots.remove(i);
          break;
        }
      }
      // replace the existing attributes by a PrintField attribute
      PdfDictionary attribute = new PdfDictionary();
      attribute.put(PdfName.O, PdfName.PRINTFIELD);
      PdfString description = dict.getAsString(PdfName.TU);
      if (description == null)
        description = dict.getAsString(PdfName.T);
      if (PdfName.BTN.equals(dict.get(PdfName.FT))) {
        PdfNumber fflags = dict.getAsNumber(PdfName.FF);
        if (fflags != null) {
          int ff = fflags.intValue();
                if ((ff & PdfFormField.FF_PUSHBUTTON) != 0)
                    attribute.put(PdfName.ROLE, PdfName.PB);
                // I don't think the condition below will ever be true
                if ((ff & PdfFormField.FF_RADIO) != 0)
                    attribute.put(PdfName.ROLE, PdfName.rb);
                else
                    attribute.put(PdfName.ROLE, PdfName.CB);
        }
      }
      else {
        attribute.put(PdfName.ROLE, PdfName.TV);
      }
      attribute.put(PdfName.DESC, description);
      // Updating the values of the StructElem dictionary
      PdfString t = structElem.getAsString(PdfName.T);
      if (t == null || t.toString().trim().length() == 0)
        structElem.put(PdfName.T, dict.getAsString(PdfName.T));
      structElem.put(PdfName.A, attribute);
      structElem.put(PdfName.S, PdfName.P);
      structElem.put(PdfName.PG, pageref);
      // Defining a new MCID
      int mcid = items.processMCID(structParents, item.getRef());
    LOGGER.info("Using MCID " + mcid);
      structElem.put(PdfName.K, new PdfNumber(mcid));
      // removing the annotation from the parent tree
      items.removeFromParentTree(structParent);
      // Adding the XObject to the page
      PdfName xobj = new PdfName("XObj" + structParent.intValue());
      LOGGER.info("Creating XObject with name " + xobj);
View Full Code Here


   * HOffset, when HAlign is Far, offsets the position towards the Near
   * direction.
   * @param  hOffset  an offset
   */
  public void setHOffset(float hOffset) {
    put(PdfName.HOFFSET, new PdfNumber(hOffset));
  }
View Full Code Here

   * VOffset, when VAlign is Far, offsets the position towards the Near
   * direction.
   * @param  vOffset  an offset
   */
  public void setVOffset(float vOffset) {
    put(PdfName.VOFFSET, new PdfNumber(vOffset));
  }
View Full Code Here

  /**
   * Sets the number of times the animation is played.
   * @param  playCount  the play count
   */
  public void setPlayCount(int playCount) {
    put(PdfName.PLAYCOUNT, new PdfNumber(playCount));
  }
View Full Code Here

   * A value greater than one shortens the time it takes to play
   * the animation, or effectively speeds up the animation.
   * @param  speed  a speed value
   */
  public void setSpeed(int speed) {
    put(PdfName.SPEED, new PdfNumber(speed));
  }
View Full Code Here

   * A value greater than one shortens the time it takes to play
   * the animation, or effectively speeds up the animation.
   * @param  speed  a speed value
   */
  public void setSpeed(float speed) {
    put(PdfName.SPEED, new PdfNumber(speed));
  }
View Full Code Here

    if (structTreeRoot == null)
      return;
        Integer numbers[] = new Integer[parentTree.size()];
        numbers = parentTree.keySet().toArray(numbers);
        Arrays.sort(numbers);
        structTreeRoot.put(PdfName.PARENTTREENEXTKEY, new PdfNumber(numbers[numbers.length - 1] + 1));
    structTreeRoot.put(PdfName.PARENTTREE, PdfNumberTree.writeTree(parentTree, writer));
  }
View Full Code Here

   * @param  max    the maximum
   * @param  min    the minimum
   */
  private PdfDictionary createDimensionDictionary(float d, float max, float min) {
    PdfDictionary dict = new PdfDictionary();
    dict.put(PdfName.DEFAULT, new PdfNumber(d));
    dict.put(PdfName.MAX_CAMEL_CASE, new PdfNumber(max));
    dict.put(PdfName.MIN_CAMEL_CASE, new PdfNumber(min));
    return dict;
  }
View Full Code Here

  /**
   * Sets the EPSG code.
   * @param epsg
   */
  public void setEPSG(int epsg) {
    super.put(PdfName.EPSG, new PdfNumber(epsg));
  }
View Full Code Here

   * Sets the time value of the cue point in milliseconds to match against
   * the cue point within Flash content and for display purposes.
   * @param  time  the time value of the cue point
   */
  public void setTime(int time) {
    put(PdfName.TIME, new PdfNumber(time));
  }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.PdfNumber

Copyright © 2018 www.massapicom. 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.