You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by ph...@free.fr on 2015/04/03 17:19:53 UTC
Problem with line annotation
Hello,
I can't make line annotations work. Here's my code.
private void createAnnotation(PDPage pdPage) throws IOException {
PDAnnotationLine line = new PDAnnotationLine();
float[] floatArray = { 30f, 700f, 204f, 700f };
line.setLine(floatArray);
PDGamma colourRed = new PDGamma();
colourRed.setR(1);
line.setColour(colourRed);
BoundingBox box = new BoundingBox(0f, 750f, 0f, 750f);
PDRectangle rect = new PDRectangle(box);
line.setRectangle(rect);
line.setPage(pdPage);
}
In the generated PDF with a text editor, there isn't any /Type Annot command.
Many thanks.
Philippe
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: Problem with line annotation
Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,
There's no connection between the page and the annotation object. Please
look at the AddAnnotations example, that one does this:
List<PDAnnotation> annotations = page.getAnnotations();
annotations.add(...)
There may be more... in your next post, please mention the version.
Tilman
Am 03.04.2015 um 17:19 schrieb phiroc@free.fr:
> Hello,
>
> I can't make line annotations work. Here's my code.
>
>
> private void createAnnotation(PDPage pdPage) throws IOException {
>
> PDAnnotationLine line = new PDAnnotationLine();
> float[] floatArray = { 30f, 700f, 204f, 700f };
> line.setLine(floatArray);
>
> PDGamma colourRed = new PDGamma();
> colourRed.setR(1);
>
> line.setColour(colourRed);
> BoundingBox box = new BoundingBox(0f, 750f, 0f, 750f);
> PDRectangle rect = new PDRectangle(box);
> line.setRectangle(rect);
> line.setPage(pdPage);
>
> }
>
>
> In the generated PDF with a text editor, there isn't any /Type Annot command.
>
> Many thanks.
>
> Philippe
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org