Package org.pdfclown.objects

Examples of org.pdfclown.objects.PdfArray


  protected void loadEncodingDifferences(
    PdfDictionary encodingDictionary,
    Map<ByteArray,Integer> codes
    )
  {
    PdfArray differenceObjects = (PdfArray)encodingDictionary.resolve(PdfName.Differences);
    if(differenceObjects == null)
      return;
 
    /*
      NOTE: Each code is the first index in a sequence of character codes to be changed.
View Full Code Here


    // Glyph widths.
    if(glyphWidths == null)
    {
      glyphWidths = new Hashtable<Integer,Integer>();
      PdfArray glyphWidthObjects = (PdfArray)getBaseDataObject().resolve(PdfName.Widths);
      if(glyphWidthObjects != null)
      {
        ByteArray charCode = new ByteArray(
          new byte[]
          {(byte)(int)((PdfInteger)getBaseDataObject().get(PdfName.FirstChar)).getRawValue()}
View Full Code Here

      Point2D end
      )
    {
      super(
        page.getFile(),
        new PdfArray()
        );

      this.page = page;

      PdfArray baseDataObject = getBaseDataObject();
      double pageHeight = page.getBox().getHeight();
      baseDataObject.add(new PdfReal(start.getX()));
      baseDataObject.add(new PdfReal(pageHeight - start.getY()));
      baseDataObject.add(new PdfReal(end.getX()));
      baseDataObject.add(new PdfReal(pageHeight - end.getY()));
    }
View Full Code Here

      Point2D end
      )
    {
      super(
        page.getFile(),
        new PdfArray()
        );

      this.page = page;

      PdfArray baseDataObject = getBaseDataObject();
      double pageHeight = page.getBox().getHeight();
      baseDataObject.add(new PdfReal(start.getX()));
      baseDataObject.add(new PdfReal(pageHeight - start.getY()));
      baseDataObject.add(new PdfReal(knee.getX()));
      baseDataObject.add(new PdfReal(pageHeight - knee.getY()));
      baseDataObject.add(new PdfReal(end.getX()));
      baseDataObject.add(new PdfReal(pageHeight - end.getY()));
    }
View Full Code Here

  {
    /*
      NOTE: Form-space-to-user-space matrix is identity [1 0 0 1 0 0] by default,
      but may be adjusted by setting the Matrix entry in the form dictionary [PDF:1.6:4.9].
    */
    PdfArray matrix = (PdfArray)File.resolve(
      getBaseDataObject().getHeader().get(PdfName.Matrix)
      );
    if(matrix == null)
      return new double[]
        {
          1, // a.
          0, // b.
          0, // c.
          1, // d.
          0, // e.
          0 // f.
        };
    else
      return new double[]
        {
          ((PdfNumber<?>)matrix.get(0)).getNumberValue(), // a.
          ((PdfNumber<?>)matrix.get(1)).getNumberValue(), // b.
          ((PdfNumber<?>)matrix.get(2)).getNumberValue(), // c.
          ((PdfNumber<?>)matrix.get(3)).getNumberValue(), // d.
          ((PdfNumber<?>)matrix.get(4)).getNumberValue(), // e.
          ((PdfNumber<?>)matrix.get(5)).getNumberValue() // f.
        };
  }
View Full Code Here

  */
  @Override
  public Dimension2D getSize(
    )
  {
    PdfArray box = (PdfArray)File.resolve(
      getBaseDataObject().getHeader().get(PdfName.BBox)
      );
    return new Dimension(
      ((PdfNumber<?>)box.get(2)).getNumberValue(),
      ((PdfNumber<?>)box.get(3)).getNumberValue()
      );
  }
View Full Code Here

    {throw new NotImplementedException();}

    public Point2D getEnd(
      )
    {
      PdfArray coordinates = getBaseDataObject();
      if(coordinates.size() < 6)
        return new Point2D.Double(
          ((PdfNumber<?>)coordinates.get(2)).getNumberValue(),
          page.getBox().getHeight() - ((PdfNumber<?>)coordinates.get(3)).getNumberValue()
          );
      else
        return new Point2D.Double(
          ((PdfNumber<?>)coordinates.get(4)).getNumberValue(),
          page.getBox().getHeight() - ((PdfNumber<?>)coordinates.get(5)).getNumberValue()
          );
    }
View Full Code Here

    Dimension2D value
    )
  {
    PdfDirectObject box = getBaseDataObject().getHeader().get(PdfName.BBox);

    PdfArray boxObject = (PdfArray)File.resolve(box);
    ((PdfNumber<?>)boxObject.get(2)).setValue(value.getWidth());
    ((PdfNumber<?>)boxObject.get(3)).setValue(value.getHeight());

    File.update(box);
  }
View Full Code Here

  // <IContentContext>
  @Override
  public Rectangle2D getBox(
    )
  {
    PdfArray box = (PdfArray)File.resolve(
      getBaseDataObject().getHeader().get(PdfName.BBox) // NOTE: Required [PDF:1.6:4.9.1].
      );
    return new Rectangle2D.Double(
      ((PdfNumber<?>)box.get(0)).getNumberValue(),
      ((PdfNumber<?>)box.get(1)).getNumberValue(),
      ((PdfNumber<?>)box.get(2)).getNumberValue(),
      ((PdfNumber<?>)box.get(3)).getNumberValue()
      );
  }
View Full Code Here

    }

    public Point2D getKnee(
      )
    {
      PdfArray coordinates = getBaseDataObject();
      if(coordinates.size() < 6)
        return null;

      return new Point2D.Double(
        ((PdfNumber<?>)coordinates.get(2)).getNumberValue(),
        page.getBox().getHeight() - ((PdfNumber<?>)coordinates.get(3)).getNumberValue()
        );
    }
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.