getFileData method for extracting data of few pages

Product:
PDFTron
Product Version:

Please give a brief summary of your issue:
(Think of this as an email subject)
Initially, we have functionality for extracting data from a few pages using extractPages method.
Currently, we are flattening the annotations on downloaded documents using getFileData method but it returns all of the pages of the document, is there any way, So we can pass an array of pages to the getFileData method for uploading only required pages with flattened annotation.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
Need to implement flattened annotations functionality on the exported documents using getFileData or other method but required similar functionality as extractPages

Please provide a link to a minimal sample where the issue is reproducible:
Capture

Hello himanshu.gautam,

Welcome to the PDFTron Community Forum!

We do not support specifying pages in getFileData, however the XFDF you pass into extractPages can accept flattened annotations. Please refer to this guide: PDFTron

Alternatively you can flatten the annotations on the document, then extract the pages.

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron

Thanks for the response @tgordon ,
Actually, our main use case is that users can edit annotation in the macbook default viewer.
We used read-only and locked flag for locking the annotation as per requirement but these flags were not working for the
MacBook default viewer.

Requirement: User should not be able to modify or edit annotation on MacBook default viewer,
Tried solutions :

  1. Used read-only and locked flag, working fine with adobe reader and some other viewer
    but doesn’t work fine for the MacBook default viewer.
  2. Flatten the annotation with getFileData method but not working according to our use-case as we need to
    update data only for the required array of pages.
  3. Flattening annotation on the document and then extracting the pages, not working as per requirement as we need to
    flatten annotations only for the document uploaded to the blob.

Is there any other way we can flatten annotation while uploading to the blob like we do with getFileData method.
but we need to extract data of only required pages, or any other flag or something So, we can restrict MacBook default viewer from editing the annotations.

Hello himanshu.gautam,

Unfortunately we cannot control how Mac’s default viewer “Preview” handles read-only and locked flags.
You could combine extractPages with getFileData to only flatten specific pages:

Let me know if these work for you

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron