Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching Annotation Comments added in the pdf. (Arabic, Urdu and Persian language comments) #1697

Open
2 tasks done
daniyalrathore14 opened this issue Nov 7, 2024 · 0 comments

Comments

@daniyalrathore14
Copy link

What were you trying to do?

Basicaly we are using a pdf sdk to add comment on the pdf which works fine.
but to extract the note from the PDF we are using pdf-lib.
its working fine in case of english.
but with arbaic or udru
it returns the encoded value which we are not able to decode properly.
the PDF SDK is storing the annotation comment in Arabic as they are but when we try to extract that with pdf-lib it give this value

need help on this @Hopding

How did you attempt to do it?

const annotRef = annotations.get(j);
const annot = pdfDoc.context.lookup(annotRef);
const comment = getAnnotationComment(annot);

const getAnnotationComment = (annot: any) => {
let comment = 'No comment found';
annot.dict.forEach((value: any, key: any) => {
if (key && key.encodedName === '/Contents') {
console.log(value.value, " value.value ");
comment = value.value || 'No comment found';
}
});
return comment;
};

What actually happened?

LOG:

þÿA1'F3

          ,H E:1\(Ì ÌH1~ ©' 'Ì© ED© ÁÒ

                                       '~FÌ \(¾1~H1 *'1Ì.

                                                          +B'A*Ì '+1 H 13H. 'H1 /D©4 EF'81 ©Ò DÌÒ ,'F' ,'*' ÁÒÔ ~Ì13 ©Ì\n\n\n\n\n\n\n\n\n\n 

What did you expect to happen?

it should be in arbaic format not this

How can we reproduce the issue?

add the arabic annotaiton in pdf and then test

Version

1.1.1

What environment are you running pdf-lib in?

React Native

Checklist

  • My report includes a Short, Self Contained, Correct (Compilable) Example.
  • I have attached all PDFs, images, and other files needed to run my SSCCE.

Additional Notes

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant