[javascript bug v11.0.1] empty richContents overrides contents when creating annotation

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

User avatar
Mathew
User
Posts: 926
Joined: Thu Jun 19, 2014 7:30 pm

[javascript bug v11.0.1] empty richContents overrides contents when creating annotation

Post by Mathew »

When a new FreeText annotation is created with doc.addAnnot(), if an empty richContents property is included it will override whatever is in contents (ie there will be no text in the annotation). This can happen if properties from another annotation are copied with annotation.getProps()

To reproduce:

Code: Select all

{
  const newProps = {
    type: "FreeText",
    contents: "This should have some text in it",
    page: 0,
    rect: [0,0,400,50],
    richContents: [], // annotation.getProps() will return empty array if there is no richContents
  }
  
  this.addAnnot(newProps);
}
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 13211
Joined: Wed Jan 03, 2018 6:52 pm

Re: [javascript bug v11.0.1] empty richContents overrides contents when creating annotation

Post by Daniel - PDF-XChange »

Hello, Mathew

Thank you for the report - I have passed this along to the dev team for review.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
[email protected]