Reputation: 14594
I created an ink annotation in the form of the letter Z, as shown above, however, the corners of the Z are rounded. Why does this happen? How can I avoid this additional beautification so that the corners stay sharp and the points are connected via a straight line?
PDF code:
%PDF-1.6
%μῦ
1 0 obj
<</Type/Catalog/Pages 2 0 R>>
endobj
2 0 obj
<</Type/Pages/Kids[3 0 R]/Count 1>>
endobj
3 0 obj
<</Type/Page/Parent 2 0 R/Resources<<>>/MediaBox[0 0 500 800]/Annots[4 0 R]>>
endobj
4 0 obj
<</Type/Annot/Subtype/Ink/Contents(<enter description here>)/InkList[[150 300 250 300 150 200 250 200]]/Rect[200 250 300 150]/P 3 0 R/F 4/C[1 0 0]>>
endobj
xref
0 5
0000000000 65536 f
0000000017 00000 n
0000000063 00000 n
0000000115 00000 n
0000000209 00000 n
trailer
<</Size 5/Root 1 0 R>>
startxref
374
%%EOF
Upvotes: 4
Views: 799
Reputation: 5834
The solution is to create also the annotation appearance (the /AP entry in the annotation dictionary). If the annotation appearance, which draws the straight lines, is present in the PDF file then it will be used when displaying the file and you will get the same result in any viewer. If the appearance is not present then the viewer will construct the appearance based on annotation definition and in your case this viewer built appearance is implementation dependent.
Upvotes: 2
Reputation: 90295
I'm not sure what's going on here, and have no time to investigate right now.
But here are some immediate observations as additional data points:
Update:
Ok, I had a quick look into the official ISO spec for PDF-1.7. It says this about the /Subtype /Ink
annotations' /InkList
:
An array of n arrays, each representing a stroked path. Each array shall be a series of alternating horizontal and vertical coordinates in default user space, specifying points along the path. When drawn, the points shall be connected by straight lines or curves in an implementation-dependent way.
(from Chapter 12.5.6.13 Ink Annotations, my emphasis)
So, it is completely 'legal' that one implementation shows straight lines, and the other one shows curves. :-(
Sigh...
Update 2:
So if you want to force the Z-shape to appear as straight lines for all implementations, you need to draw 3 different straight lines, each one represented by a different array, and put these 3 arrays into container array...
Change this part of your code:
/InkList
[
[150 300 250 300 150 200 250 200]
]
to this:
/InkList
[
[150 300 250 300]
[250 300 150 200]
[150 200 250 200]
]
and your Z-Shape will show sharp corners.
Upvotes: 5