Why is my underline annotation upside-down?

Q:

I’m importing an underline annotation from an XFDF document. The underline annotation looks like this:

Text

When I view it in Acrobat, it’s an “overline” instead of an “underline”. Why?

A:

The ordering of the QuadPoints in the XFDF file is incorrect (as described in the KB article https://groups.google.com/d/msg/pdfnet-sdk/GEBpMmHlqFo/xr06-tg94pEJ).

The quadpoints are listed as:

coords=“49.089200,647.037756,143.201421,647.037756,49.089200,654.279928,143.201421,654.279928”

These are in the following order:

3--------4

1--------2

I was able to get the correct ordering by imitating the order in which Acrobat creates QuadPoints:

coords=“49.089200,654.279928,143.201421,654.279928,49.089200,647.037756,143.201421,647.037756”

That changed them to the following order:

1--------2

3--------4

Unless you want to edit the XFDF yourself, you would need to customize the code that created these annotations to use the second order.

With the correct ordering, the annotation shows up as an underline.