Q: We will soon be required to provide "cutout" support for our shaped annotations. For example, suppose we start with a rectangle annotation. We now need to provide the ability for a user to remove or "cut out" a section of that rectangle. Let's say we were to accomplish this by allowing the user to draw a second rectangle (the eraser). Once the second shape is defined, perhaps we could calculate a new shape? Visually, this could look like the following:
Above, we have a 6-sided polygon that was generated by starting with a rectangle and placing a "cutout" rectangle in the original rectangle's lower-right corner.
I'm guessing there is a polygon "difference" tool out there that will help me calculate the resulting polygon after the cutout, and I could define the resulting polygon as an annotation with PDFTron by supplying the list of vertices? That's the simple case.
The problem becomes more complex when the cutout rectangle is placed wholly within the first rectangle. Then, you would end up with a donut-like shape. Allow me to describe the shape. Consider a standard, coordinate plane with the origin in the lower left. Use the following points to create a shape, moving from one point to the next in order:
Note that points 6 and 11 and points 5 and 12 are the same. If you were to plot this, you should see a rectangle within a rectangle (like the donut shape mentioned above). Here's an image:
Is this even a polygon? Would PDFTron handle a polygon annotation (and draw it correctly) if I were to give it the list of 12 vertices above?
This task becomes even further complicated when you allow any polygon original shape (not just a rectangle) with any polygon cutout (again, not just a rectangle).
Can PDFTron (and basic, underlying PDF) support annotations of this nature? How would you recommend we get started on this task?