pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <til...@apache.org>
Subject Re: Support for Add Text Callout
Date Mon, 15 Apr 2019 17:54:21 GMT
Hi,

The type should be PDAnnotationMarkup. Yes the class structure is weird in 2.0, it will be
better in 3.0. Here's code from the trunk that would help you:

    /**
     * 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 final void setCallout(float[] callout)
    {
        COSArray newCallout = new COSArray();
        newCallout.setFloatArray(callout);
        getCOSObject().setItem(COSName.CL, newCallout);
    }

    /**
     * This will get the coordinates of the callout line.
     *
     * @return 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 float[] getCallout()
    {
        COSBase base = getCOSObject().getDictionaryObject(COSName.CL);
        if (base instanceof COSArray)
        {
            return ((COSArray) base).toFloatArray();
        }
        return null;
    }

The rectangle box is just the ordinary rectangle IIRC.


Tilman

On 2019/04/15 17:30:07, Kaushlendra Singh <singh.kaushlendra016@gmail.com> wrote: 
> Hi,
> I am trying to implement Add Text Callout annotation tool provided by
> Acrobat Reader. It seems to me that it is combination to two annotation
> types and PDFBox return "FreeText" as its subtype. But I am not getting any
> clue like how can I get the coordinates of that rectangle box along with
> arrow and line attached to it separately as there is no class available for
> "FreeText" annotation type. Can anyone help me or guide me in solving this
> problem?
> 
> Please find the attachment.
> 
> -- 
> Thanks & Regards
> Kaushlendra Singh
> Email: singh.kaushlendra016@gmail.com
> Phone: +91 8377094564
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message