pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Snider <ted.sni...@blackboard.com>
Subject Re: Cannot get annotations to appear in PDF
Date Wed, 23 May 2018 18:31:18 GMT
Fingers crossed.  PDF is in folder named "outfile.pdf".

https://drive.google.com/drive/folders/1EgEzzcHkAY3Z4M-1yrClZGTg59aOq28-?usp=sharing

Ted Snider
Senior Software Engineer
Product Development

M: 317.914.2535
Ted.snider@blackboard.com

Blackboard


´╗┐On 5/23/18, 1:35 PM, "Tilman Hausherr" <THausherr@t-online.de> wrote:

    Please upload the file somewhere, attachments don't get through.

    Be aware that the PDF specification about quadpoints is incorrect:
    https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F9855814%2Fpdf-spec-vs-acrobat-creation-quadpoints&data=02%7C01%7Cted.snider%40blackboard.com%7Caf1f4c3c6bf348944e6708d5c0d384ce%7Cbf0b29a25e5c4aaaba4dac988df15ea6%7C0%7C0%7C636626937065907465&sdata=BF8FjE10iGbmuQtZZJ86DTWNiI19sPYQgUuqSQSdMpk%3D&reserved=0

    (I haven't checked whether you're the "victim" of this)

    Tilman

    Am 23.05.2018 um 19:28 schrieb Ted Snider:
    > 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
    > Ted.snider@blackboard.com<mailto:Ted.snider@blackboard.com>
    >
    > 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.



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
    For additional commands, e-mail: users-help@pdfbox.apache.org



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: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

Mime
View raw message