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

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

I played around a bit with line arrows... here are my observations for a double 
arrow line 100,600 to 500,600 with width 10, see attached file 
Line-Annotation-OpenArrow-w10-AP.pdf:
{code:java}
10 w
0 G
q
  S
  1 0 0 1 0 0 cm
  q
    0 g
    0 G
    1 w
    BT
      /Helv 9 Tf
      0 g
      269.863 597.394 Td
      (Circle->Square) Tj
    ET
  Q
  110 600 m
  259.8628 600 l
  S
  340.1372 600 m
  490 600 l
  S
Q
187.9419 554.9995 m
109.9999 600 l
187.9419 645.0005 l
S
412.0581 645.0005 m
490.0001 600 l
412.0581 554.9995 l
S
{code}
 - line is shortened by the width when there is an arrow
 - shorter lines => inverted arrow (won't bother with it for now)
 - font size 9, not 12
 - peak of the arrow is at shortened line endpoint
 - the gap between lines and text is the line width
 - length of arrow side about 10 x the line width
 - angle is about 30°, but a test with asin/acos gets weird results???
 - x = cos = 0.779419 => acos = 38.79°
 - y = sin = 0.450005 => asin = 26.74°
 - this would mean that the coordinate is not really on the circle... I tried 
this: 
[https://stackoverflow.com/questions/15994194/how-to-convert-x-y-coordinates-to-an-angle]
 - Math.toDegrees(Math.atan2(45.0005, 187.9419 - 109.9999)) result is 30°.
 - However there is a difference, especially in the y value of my calculations. 
My y delta is 50, Adobe has 45.

The result is now much closer to what Adobe does (especially for the file from 
PDFBOX-2019).

> 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 PDFBox
>            Reporter: Tilman Hausherr
>            Priority: Major
>              Labels: Annotations
>         Attachments: AnnotationSample.Standard.pdf, 
> CTAN-example-Annotations-rot270.pdf, CTAN-example-Annotations.pdf, 
> Line-Annotation-OpenArrow-w10-AP.pdf, PDFBOX-2019-Annotations.pdf, 
> PDFBOX-2898-Annotations.pdf, PDFBOX-3353-highlight-noAP-001796-p1.pdf, 
> PDFBOX-3353-highlight-noAP.pdf, PDFJS-7115-indirect-rect.pdf, 
> ShowAnnotation-4.java, ShowAnnotation-5.java, ShowAnnotation-6.java, 
> SquareAnnotations.pdf, annots.pdf, gs-bugzilla-693664-AnnotationTest.pdf, 
> line_dimension_appearance_stream-noAP.pdf, 
> line_dimension_appearance_stream.pdf, pdf_commenting_new.pdf, 
> showAnnotation.java, 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
(v7.6.3#76005)

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

Reply via email to