title: How to use annotation layer in PDF.js?
body: <p>Some of the PDF.js code mentions an &quot;annotation layer&quot;, for example AnnotationLayerBuilder here:</p>
  <p><a href="https://github.com/mozilla/pdf.js/blob/95e102c07bc257c2120fd7fd9141762b2c813a1c/web/annotation_layer_builder.js#L118" rel="noreferrer">https://github.com/mozilla/pdf.js/blob/95e102c07bc257c2120fd7fd9141762b2c813a1c/web/annotation_layer_builder.js#L118</a></p>
  <p>There is also <code>pdfDocument.annotationStorage</code> and <code>pdfjsLib.AnnotationLayer</code>, which - on all the documents I've tried - are empty, even in documents which do have text annotations.</p>
  <p>I couldn't find any examples or documentation on the annotation layer and how it is supposed to be used, but it sure sounds interesting :)</p>
  <ol>
  <li><p>What <em>is</em> the annotation layer?  Is this talking about standard PDF annotations, as described in <a href="https://pspdfkit.com/blog/2018/what-are-annotations/" rel="noreferrer">https://pspdfkit.com/blog/2018/what-are-annotations/</a> or <a href="https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf" rel="noreferrer">https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf</a> section 8.4 Annotations?  Or, is it something internal to PDF.js?</p>
  </li>
  <li><p>How do I list the existing annotations from javascript code in PDF.js, and how do I add one?  (just for display; not expecting to be able to save it in the pdf, of course)  Can anyone provide a working code example?</p>
  </li>
  </ol>
  <p>Thanks!</p>