[ 
https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16145761#comment-16145761
 ] 

Tilman Hausherr commented on PDFBOX-3353:
-----------------------------------------

Thanks for sharing... However I can't use that code directly because you you're 
using a different strategy than I did, you're drawing the arrow at the native 
angle, i.e. you're not using my "lazy" strategy (rotate first to avoid any 
thinking about the line angle). But your thoughts are still useful.

I think I understand what you do:
- shorten the line by 1 unit for the arrow tip
- have each arrow side line 30° from the main line.

Your argument about the arrow tip is of course correct. And my rendering of 
PDFBOX-2019 is obviously not good.

To get a sharp angle we need to draw the path in a single step, i.e. move, 
line, line, instead of move, line, move, line. My code would change to
{code}
if (PDAnnotationLine.LE_OPEN_ARROW.equals(line.getStartPointEndingStyle()))
{
    cs.moveTo(6, 3);
    cs.lineTo(0, 0);
    cs.lineTo(6, -3);
    cs.stroke();
}
if (PDAnnotationLine.LE_OPEN_ARROW.equals(line.getEndPointEndingStyle()))
{
    cs.moveTo(lineLength - 6, 3);
    cs.lineTo(lineLength, 0);
    cs.lineTo(lineLength - 6, -3);
    cs.stroke();
}
{code}
Re the rendering of PDFBOX-2019, I suspect the width plays a role too in the 
shortening. I haven't had much time recently... What one could do is to create 
various horizontal line annotations and see what Adobe does.

> Create appearance streams for annotations
> -----------------------------------------
>
>                 Key: PDFBOX-3353
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3353
>             Project: PDFBox
>          Issue Type: Task
>          Components: PDModel, Rendering
>    Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0
>            Reporter: Tilman Hausherr
>              Labels: Annotations
>         Attachments: line_dimension_appearance_stream-noAP.pdf, 
> line_dimension_appearance_stream.pdf, 
> PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, 
> ShowAnnotation-4.java, showAnnotation.java, SquareAnnotations.pdf, 
> text_markup_ap_test.pdf
>
>
> Create appearance streams for annotations when missing.
> I'll start by replacing current code for Ink and Link annotations.
> Good example PDFs:
> http://www.pdfill.com/example/pdf_commenting_new.pdf
> https://github.com/mozilla/pdf.js/issues/6810



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to