# Merge Rest API - how to flatten PDF?

**URL:** <https://pdfjs.community/t/merge-rest-api-how-to-flatten-pdf/328>\
**Category:** Technical Support\
**Created:** [October 12, 2020, 9:09am UTC](https://pdfjs.community/t/merge-rest-api-how-to-flatten-pdf/328 "2020-10-12T09:09:32Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [October 14, 2020, 5:27pm UTC](https://pdfjs.community/t/merge-rest-api-how-to-flatten-pdf/328/4 "2020-10-14T17:27:34Z")

</div>

Hey there!

How are you setting ‘readonly’ on the annotations? I just tried setting them all to read only and merging them and it worked the way you are expecting. Here is my code:

```javascript
  const { annotManager, docViewer } = instance;

  const list = annotManager.getAnnotationsList();

  list.forEach(item => {
    item.ReadOnly = true
  })

  const xfdf = await annotManager.exportAnnotations();

  // ...rest of merge code

```

Thanks,  
Logan

---

_[View the full topic](https://pdfjs.community/t/merge-rest-api-how-to-flatten-pdf/328)._
