Package org.pdfclown.objects

Examples of org.pdfclown.objects.PdfArray


      stream = ((PdfStream)contentStream).getBody();
      basePosition = 0;
    }
    else // Array of streams.
    {
      PdfArray streams = (PdfArray)contentStream;

      stream = ((PdfStream)((PdfReference)streams.get(streamIndex)).getDataObject()).getBody();
      basePosition -= stream.getLength();
    }

    return true;
  }
View Full Code Here


      context.getFile(),
      new PdfDictionary(
        new PdfName[]
        {PdfName.Fields},
        new PdfDirectObject[]
        {new PdfArray()}
        )
      );
  }
View Full Code Here

    String text
    )
  {
    super(
      context.getFile(),
      new PdfArray(
        new PdfDirectObject[]
        {
          new PdfTextString(value),
          new PdfTextString(text)
        }
View Full Code Here

    if(baseDataObject instanceof PdfTextString)
    {
      PdfDirectObject oldBaseDataObject = baseDataObject;

      setBaseObject(
        baseDataObject = new PdfArray(
          new PdfDirectObject[]
          {
            oldBaseDataObject
          }
          )
        );
      ((PdfArray)baseDataObject).add(new PdfTextString());

      if(items != null)
      {
        // Force list update!
        /*
          NOTE: This operation is necessary in order to substitute
          the previous base object with the new one within the list.
        */
        PdfArray itemsObject = items.getBaseDataObject();
        itemsObject.set(itemsObject.indexOf(oldBaseDataObject),baseDataObject);
      }
    }

    ((PdfTextString)((PdfArray)baseDataObject).get(1)).setValue(value);
  }
View Full Code Here

    )
  {
    /*
      NOTE: 'InkList' entry MUST be present.
    */
    PdfArray pathsObject = (PdfArray)getBaseDataObject().get(PdfName.InkList);
    List<List<Point2D>> paths = new ArrayList<List<Point2D>>();
    double pageHeight = getPage().getBox().getHeight();
    for(
      int pathIndex = 0,
        pathLength = pathsObject.size();
      pathIndex < pathLength;
      pathIndex++
      )
    {
      PdfArray pathObject = (PdfArray)pathsObject.get(pathIndex);
      List<Point2D> path = new ArrayList<Point2D>();
      for(
        int pointIndex = 0,
          pointLength = pathObject.size();
        pointIndex < pointLength;
        pointIndex += 2
        )
      {
        path.add(
          new Point2D.Double(
            ((PdfNumber<?>)pathObject.get(pointIndex)).getNumberValue(),
            pageHeight - ((PdfNumber<?>)pathObject.get(pointIndex+1)).getNumberValue()
            )
          );
      }
      paths.add(path);
    }
View Full Code Here

  */
  public void setPaths(
    List<List<Point2D>> value
    )
  {
    PdfArray pathsObject = new PdfArray();
    double pageHeight = getPage().getBox().getHeight();
    for(List<Point2D> path : value)
    {
      PdfArray pathObject = new PdfArray();
      for(Point2D point : path)
      {
        pathObject.add(new PdfReal(point.getX())); // x.
        pathObject.add(new PdfReal(pageHeight-point.getY())); // y.
      }
      pathsObject.add(pathObject);
    }

    getBaseDataObject().put(PdfName.InkList,pathsObject);
View Full Code Here

    )
  {
    /*
      NOTE: 'QuadPoints' entry MUST be present.
    */
    PdfArray quadPointsObject = (PdfArray)getBaseDataObject().get(PdfName.QuadPoints);
    List<Rectangle2D> boxes = new ArrayList<Rectangle2D>();
    double pageHeight = getPage().getBox().getHeight();
    for(
      int index = 0,
        length = quadPointsObject.size();
      index < length;
      index += 8
      )
    {
      double x = ((PdfNumber<?>)quadPointsObject.get(index+6)).getNumberValue();
      double y = pageHeight - ((PdfNumber<?>)quadPointsObject.get(index+7)).getNumberValue();
      double width = ((PdfNumber<?>)quadPointsObject.get(index+2)).getNumberValue() - ((PdfNumber<?>)quadPointsObject.get(index)).getNumberValue();
      double height = ((PdfNumber<?>)quadPointsObject.get(index+3)).getNumberValue() - ((PdfNumber<?>)quadPointsObject.get(index+1)).getNumberValue();
      boxes.add(
        new Rectangle2D.Double(x,y,width,height)
        );
    }

View Full Code Here

  */
  public void setBoxes(
    List<Rectangle2D> value
    )
  {
    PdfArray quadPointsObject = new PdfArray();
    double pageHeight = getPage().getBox().getHeight();
    for(Rectangle2D box : value)
    {
      quadPointsObject.add(new PdfReal(box.getX())); // x1.
      quadPointsObject.add(new PdfReal(pageHeight-(box.getY()+box.getHeight()))); // y1.
      quadPointsObject.add(new PdfReal(box.getX()+box.getWidth())); // x2.
      quadPointsObject.add(quadPointsObject.get(1)); // y2.
      quadPointsObject.add(quadPointsObject.get(2)); // x3.
      quadPointsObject.add(new PdfReal(pageHeight-box.getY())); // y3.
      quadPointsObject.add(quadPointsObject.get(0)); // x4.
      quadPointsObject.add(quadPointsObject.get(5)); // y4.
    }

    getBaseDataObject().put(PdfName.QuadPoints,quadPointsObject);
  }
View Full Code Here

    List<? extends PdfDirectObject> components
    )
  {
    super(
      null,//TODO:colorspace?
      new PdfArray(components)
      );
  }
View Full Code Here

    List<? extends PdfDirectObject> components
    )
  {
    super(
      null, //TODO:colorspace?
      new PdfArray(components)
      );
  }
View Full Code Here

TOP

Related Classes of org.pdfclown.objects.PdfArray

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.