The PDF.

Ted Snider
Senior Software Engineer
Product Development

M: 317.914.2535
[email protected]

Blackboard


On 5/23/18, 1:28 PM, "Ted Snider" <[email protected]> wrote:

    I am involved with a project trying to add annotations to an existing PDF.

    I am starting by trying to add a highlight.

    I create the object as follows:

    public class HighlightAnnotationBuilder extends AnnotationBuilder

    {

      public HighlightAnnotationBuilder( PDPage page, float[][] quads )

      {

        if ( quads != null && quads.length > 0 && quads[0].length > 0)

        {

          PDAnnotationTextMarkup highlight = new PDAnnotationTextMarkup( 
PDAnnotationTextMarkup.SUB_TYPE_HIGHLIGHT );

          PDRectangle box = new PDRectangle();

          box.setLowerLeftX( quads[0][4] );

          box.setLowerLeftY( quads[0][5] );

          box.setUpperRightX( quads[0][2] );

          box.setUpperRightY( quads[0][3] );

          highlight.setRectangle( box );

          highlight.setColor( YELLOW );

          highlight.setContents( " placeholder " );

          highlight.setConstantOpacity( ( float ) 0.8 );

          highlight.setQuadPoints( quads[0] );

          highlight.setPage( page );



          _annotations.add( highlight );

        }

      }

    }

    Add add the contents of _annotations to the pdf and save it.

    I can parse the object from the file after closing an reopening it.  The 
debug output looks like this:

    12:52:50.738 [main] DEBUG 
blackboard.annotationRenderer.pdf.parser.PDFReaderTest - Annotation: 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup

    12:52:50.742 [main] DEBUG 
blackboard.annotationRenderer.pdf.parser.PDFReaderTest - Rectangle: (72.000000, 
684.000000), (208.793701, 720.000000); Quads: [ 72.000000, 720.000000, 
208.793701, 720.000000, 72.000000, 684.000000, 208.793701, 684.000000, ]

    12:52:50.742 [main] DEBUG 
blackboard.annotationRenderer.pdf.parser.PDFReaderTest - Hidden? false. 
Invisible? false. No View? false. Toggle No View? false

    12:52:50.743 [main] DEBUG 
blackboard.annotationRenderer.pdf.parser.PDFReaderTest - Contents:  placeholder

    But it does not appear in the PDF when I open it in a viewer (Acrobat, 
etc.).

    I have attached the PDF and would appreciate any advice.

    Ted Snider
    Senior Software Engineer
    Product Development

    M: 317.914.2535
    [email protected]<mailto:[email protected]>

    Blackboard

    This email and any attachments may contain confidential and proprietary 
information of Blackboard that is for the sole use of the intended recipient. 
If you are not the intended recipient, disclosure, copying, re-distribution or 
other use of any of this information is strictly prohibited. Please immediately 
notify the sender and delete this transmission if you received this email in 
error.


This email and any attachments may contain confidential and proprietary 
information of Blackboard that is for the sole use of the intended recipient. 
If you are not the intended recipient, disclosure, copying, re-distribution or 
other use of any of this information is strictly prohibited. Please immediately 
notify the sender and delete this transmission if you received this email in 
error.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to