pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Cannot get annotations to appear in PDF
Date Thu, 24 May 2018 17:44:59 GMT
Good to hear that. Please delete your SO question.

Tilman

Am 24.05.2018 um 19:35 schrieb Ted Snider:
> Yes, it appears I have been the victim of some strange caching issues.  My IDE has been
operating on something other than the files on disk.  I don't know what or how, but after
changing the output directory, suddenly I have an annotation right where I expected it.
>
> Ted Snider
> Senior Software Engineer
> Product Development
>
> M: 317.914.2535
> Ted.snider@blackboard.com
>
> Blackboard
>
>
> ´╗┐On 5/23/18, 4:37 PM, "Tilman Hausherr" <THausherr@t-online.de> wrote:
>
>      I also looked into the file with NOTEPAD++, it has /Linearized at the
>      beginning. PDFBox doesn't produce linearized files.
>
>      Tilman
>
>      Am 23.05.2018 um 21:27 schrieb Ted Snider:
>      > Tilman,
>      >
>      > When you say the pdf doesn't contain any annotation, what do you mean?
>      >
>      > How do you arrive at that conclusion?
>      >
>      > My own parsing of the file comes up with exactly one annotation:  org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup
with the following quad points: [ 72.000000, 720.000000, 208.793701, 720.000000, 72.000000,
684.000000, 208.793701, 684.000000 ].
>      >
>      > Ted Snider
>      > Senior Software Engineer
>      > Product Development
>      >
>      > M: 317.914.2535
>      > Ted.snider@blackboard.com
>      >
>      > Blackboard
>      >
>      >
>      > On 5/23/18, 2:34 PM, "Tilman Hausherr" <THausherr@t-online.de> wrote:
>      >
>      >      The file doesn't contain any annotation. Did you assign the annotations
>      >      array to the page? Or is the PDF the "before" PDF?
>      >
>      >      Tilman
>      >
>      >      Am 23.05.2018 um 20:31 schrieb Ted Snider:
>      >      > Fingers crossed.  PDF is in folder named "outfile.pdf".
>      >      >
>      >      > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fdrive%2Ffolders%2F1EgEzzcHkAY3Z4M-1yrClZGTg59aOq28-%3Fusp%3Dsharing&data=02%7C01%7Cted.snider%40blackboard.com%7C551d52aa5b0b4b587d8b08d5c0dbdcb0%7Cbf0b29a25e5c4aaaba4dac988df15ea6%7C0%7C0%7C636626972890725515&sdata=6QR33xyn29%2BlMFqeGi2n4uG9nD5tGljPq%2FC5vBTkzvs%3D&reserved=0
>      >      >
>      >      > 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
>      >      >
>      >
>      >
>      >      ---------------------------------------------------------------------
>      >      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
>      >
>
>
>      ---------------------------------------------------------------------
>      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
>


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


Mime
View raw message