Java Code Examples for org.apache.pdfbox.cos.COSArray#setFloatArray()

The following examples show how to use org.apache.pdfbox.cos.COSArray#setFloatArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PDAnnotationMarkup.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * Sets the paths that make this annotation.
 *
 * @param inkList An array of arrays, each representing a stroked path. Each array shall be a
 * series of alternating horizontal and vertical coordinates. If the parameter is null the entry
 * will be removed.
 */
public void setInkList(float[][] inkList)
{
    if (inkList == null)
    {
        getCOSObject().removeItem(COSName.INKLIST);
        return;
    }
    COSArray array = new COSArray();
    for (float[] path : inkList)
    {
        COSArray innerArray = new COSArray();
        innerArray.setFloatArray(path);
        array.add(innerArray);
    }
    getCOSObject().setItem(COSName.INKLIST, array);
}
 
Example 2
Source File: PDLineDashPattern.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public COSBase getCOSObject()
{
    COSArray cos = new COSArray();
    COSArray patternArray = new COSArray();
    patternArray.setFloatArray(array);
    cos.add(patternArray);
    cos.add(COSInteger.get(phase));
    return cos;
}
 
Example 3
Source File: PDColor.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Returns the color component values as a COS array
 * @return the color component values as a COS array
 */
public COSArray toCOSArray()
{
    COSArray array = new COSArray();
    array.setFloatArray(components);
    if (patternName != null)
    {
        array.add(patternName);
    }
    return array;
}
 
Example 4
Source File: FDFAnnotationLine.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will set start and end coordinates of the line (or leader line if LL entry is set).
 *
 * @param line array of 4 floats [x1, y1, x2, y2] line start and end points in default user space.
 */
public void setLine(float[] line)
{
    COSArray newLine = new COSArray();
    newLine.setFloatArray(line);
    annot.setItem(COSName.L, newLine);
}
 
Example 5
Source File: FDFAnnotationPolygon.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will set the coordinates of the vertices.
 *
 * @param vertices array of floats [x1, y1, x2, y2, ...] vertex coordinates in default user space.
 */
public void setVertices(float[] vertices)
{
    COSArray newVertices = new COSArray();
    newVertices.setFloatArray(vertices);
    annot.setItem(COSName.VERTICES, newVertices);
}
 
Example 6
Source File: FDFAnnotationPolyline.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will set the coordinates of the vertices.
 *
 * @param vertices array of floats [x1, y1, x2, y2, ...] vertex coordinates in default user space.
 */
public void setVertices(float[] vertices)
{
    COSArray newVertices = new COSArray();
    newVertices.setFloatArray(vertices);
    annot.setItem(COSName.VERTICES, newVertices);
}
 
Example 7
Source File: FDFAnnotationInk.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Set the paths making up the freehand "scribble".
 * 
 * The ink annotation is made up of one ore more disjoint paths. Each array entry is an array representing a stroked
 * path, being a series of alternating horizontal and vertical coordinates in default user space.
 * 
 * @param inklist the List of arrays representing the paths.
 */
public final void setInkList(List<float[]> inklist)
{
    COSArray newInklist = new COSArray();
    for (float[] array : inklist)
    {
        COSArray newArray = new COSArray();
        newArray.setFloatArray(array);
        newInklist.add(newArray);
    }
    annot.setItem(COSName.INKLIST, newInklist);
}
 
Example 8
Source File: PDFunction.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * @param input The array of input values for the function.
 * 
 * @return The of outputs the function returns based on those inputs.
 * @throws IOException if something went wrong.
 * 
 * @deprecated Replaced by {@link #eval(float[] input)}
 */
@Deprecated
public COSArray eval(COSArray input) throws IOException
{
    float[] outputValues = eval(input.toFloatArray());
    COSArray array = new COSArray();
    array.setFloatArray(outputValues);
    return array;
}
 
Example 9
Source File: PDAnnotationLine.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will set start and end coordinates of the line (or leader line if LL entry is set).
 *
 * @param l array of 4 floats [x1, y1, x2, y2] line start and end points in default user space.
 */
public void setLine(float[] l)
{
    COSArray newL = new COSArray();
    newL.setFloatArray(l);
    getCOSObject().setItem(COSName.L, newL);
}
 
Example 10
Source File: PDAnnotationLink.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will set the set of quadpoints which encompass the areas of this annotation which will activate.
 *
 * @param quadPoints an array representing the set of area covered.
 */
public void setQuadPoints(float[] quadPoints)
{
    COSArray newQuadPoints = new COSArray();
    newQuadPoints.setFloatArray(quadPoints);
    getCOSObject().setItem(COSName.QUADPOINTS, newQuadPoints);
}
 
Example 11
Source File: PDAnnotationTextMarkup.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will set the set of quadpoints which encompass the areas of this annotation.
 *
 * @param quadPoints an array representing the set of area covered
 */
public void setQuadPoints(float[] quadPoints)
{
    COSArray newQuadPoints = new COSArray();
    newQuadPoints.setFloatArray(quadPoints);
    getCOSObject().setItem(COSName.QUADPOINTS, newQuadPoints);
}
 
Example 12
Source File: PDRectlinearMeasureDictionary.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will set the origin of the coordinate system.
 * 
 * @param coordSystemOrigin the origin
 */
public void setCoordSystemOrigin(float[] coordSystemOrigin)
{
    COSArray array = new COSArray();
    array.setFloatArray(coordSystemOrigin);
    this.getCOSObject().setItem("O", array);
}
 
Example 13
Source File: FDFAnnotationFreeText.java    From gcs with Mozilla Public License 2.0 3 votes vote down vote up
/**
 * This will set the coordinates of the callout line.
 *
 * @param callout An array of four or six numbers specifying a callout line attached to the free
 * text annotation. Six numbers [ x1 y1 x2 y2 x3 y3 ] represent the starting, knee point, and
 * ending coordinates of the line in default user space, Four numbers [ x1 y1 x2 y2 ] represent
 * the starting and ending coordinates of the line.
 */
public void setCallout(float[] callout)
{
    COSArray newCallout = new COSArray();
    newCallout.setFloatArray(callout);
    annot.setItem(COSName.CL, newCallout);
}
 
Example 14
Source File: PDAnnotationMarkup.java    From gcs with Mozilla Public License 2.0 3 votes vote down vote up
/**
 * This will set the coordinates of the callout line. (PDF 1.6 and higher) Only relevant if the
 * intent is FreeTextCallout.
 *
 * @param callout An array of four or six numbers specifying a callout line attached to the free
 * text annotation. Six numbers [ x1 y1 x2 y2 x3 y3 ] represent the starting, knee point, and
 * ending coordinates of the line in default user space, four numbers [ x1 y1 x2 y2 ] represent
 * the starting and ending coordinates of the line.
 */
public final void setCallout(float[] callout)
{
    COSArray newCallout = new COSArray();
    newCallout.setFloatArray(callout);
    getCOSObject().setItem(COSName.CL, newCallout);
}
 
Example 15
Source File: PDAnnotationMarkup.java    From gcs with Mozilla Public License 2.0 3 votes vote down vote up
/**
 * This will set the numbers that shall represent the alternating horizontal and vertical
 * coordinates.
 *
 * @param points an array with the numbers that shall represent the alternating horizontal and
 * vertical coordinates.
 */
public void setVertices(float[] points)
{
    COSArray ar = new COSArray();
    ar.setFloatArray(points);
    getCOSObject().setItem(COSName.VERTICES, ar);
}