You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Gilad Denneboom <gi...@gmail.com> on 2020/10/20 13:03:13 UTC

Trying to edit the Rich Contents of a PDAnnotationMarkup

Hi all,

I'm working on a project where I need to edit the contents of a "FreeText"
comment (an arrow with a text box attached to it). I was trying for a while
to do it by using the setContents method but that made no difference, when
I recalled that this kind of annotation has a Rich Contents value
(basically an XML string), so I tried to edit that one instead. The results
were mixed, so I'm asking for help...

First of all, PDAnnotationMarkup has no getter/setter for this property, so
maybe that should be added. It's just a string that is saved under
COSName.RC. It can be called something like getRichContents(String s) and
setRichContents(), I think.

Instead of parsing the XML string I just did a straight-forward search &
replace on the string, which updates the value correctly, but the
appearance of the comment remains the same (ie. it's still showing the old
value, even though it's nowhere to be found in the COS Dictionary), as can
be seen from the screenshot in the shared folder.
Is there a way to force an update of the comment's appearance on the page,
like can be done with fields?

A code sample, as well as the original and edited files, and the screenshot
mentioned above can be found here:
https://drive.google.com/drive/folders/1u1mBP5IePF_Kt6bT4ggvflmbq58UQvNY?usp=sharing

I'm using PDFBox 2.0.21 on Windows 7 in Eclipse 4.2.2.

Thanks in advance!
Gilad

Re: Trying to edit the Rich Contents of a PDAnnotationMarkup

Posted by Gilad Denneboom <gi...@gmail.com>.
Hi Maruan,

So you're saying there's no way to get it working currently? That's a real
shame... I hope it's on the To-Do List.
Thanks for letting me know anyway.

Gilad

On Tue, Oct 20, 2020 at 4:36 PM Maruan Sahyoun <sa...@fileaffairs.de>
wrote:

>
> Dear Gilad,
>
> at this point in time PDFBox doesn't support the appearance generation for
> rich text (neither for annotations nor for form fields).
>
> Sorry to be of no better help.
>
> With kind regards
> Maruan
>
>
> > Hi all,
> >
> > I'm working on a project where I need to edit the contents of a
> "FreeText"
> > comment (an arrow with a text box attached to it). I was trying for a
> while
> > to do it by using the setContents method but that made no difference,
> when
> > I recalled that this kind of annotation has a Rich Contents value
> > (basically an XML string), so I tried to edit that one instead. The
> results
> > were mixed, so I'm asking for help...
> >
> > First of all, PDAnnotationMarkup has no getter/setter for this property,
> so
> > maybe that should be added. It's just a string that is saved under
> > COSName.RC. It can be called something like getRichContents(String s) and
> > setRichContents(), I think.
> >
> > Instead of parsing the XML string I just did a straight-forward search &
> > replace on the string, which updates the value correctly, but the
> > appearance of the comment remains the same (ie. it's still showing the
> old
> > value, even though it's nowhere to be found in the COS Dictionary), as
> can
> > be seen from the screenshot in the shared folder.
> > Is there a way to force an update of the comment's appearance on the
> page,
> > like can be done with fields?
> >
> > A code sample, as well as the original and edited files, and the
> screenshot
> > mentioned above can be found here:
> >
> https://drive.google.com/drive/folders/1u1mBP5IePF_Kt6bT4ggvflmbq58UQvNY?usp=sharing
> >
> > I'm using PDFBox 2.0.21 on Windows 7 in Eclipse 4.2.2.
> >
> > Thanks in advance!
> > Gilad
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: Trying to edit the Rich Contents of a PDAnnotationMarkup

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
 
Dear Gilad,

at this point in time PDFBox doesn't support the appearance generation for rich text (neither for annotations nor for form fields).

Sorry to be of no better help.

With kind regards
Maruan


> Hi all,
> 
> I'm working on a project where I need to edit the contents of a "FreeText"
> comment (an arrow with a text box attached to it). I was trying for a while
> to do it by using the setContents method but that made no difference, when
> I recalled that this kind of annotation has a Rich Contents value
> (basically an XML string), so I tried to edit that one instead. The results
> were mixed, so I'm asking for help...
> 
> First of all, PDAnnotationMarkup has no getter/setter for this property, so
> maybe that should be added. It's just a string that is saved under
> COSName.RC. It can be called something like getRichContents(String s) and
> setRichContents(), I think.
> 
> Instead of parsing the XML string I just did a straight-forward search &
> replace on the string, which updates the value correctly, but the
> appearance of the comment remains the same (ie. it's still showing the old
> value, even though it's nowhere to be found in the COS Dictionary), as can
> be seen from the screenshot in the shared folder.
> Is there a way to force an update of the comment's appearance on the page,
> like can be done with fields?
> 
> A code sample, as well as the original and edited files, and the screenshot
> mentioned above can be found here:
> https://drive.google.com/drive/folders/1u1mBP5IePF_Kt6bT4ggvflmbq58UQvNY?usp=sharing
> 
> I'm using PDFBox 2.0.21 on Windows 7 in Eclipse 4.2.2.
> 
> Thanks in advance!
> Gilad



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