allenai / pdf-component-library

44 stars 4 forks source link

pass the renderAnnotations as a prop. Include the required styling #108

Closed smitar closed 1 year ago

smitar commented 2 years ago

https://github.com/allenai/scholar/issues/31029

Added the User guide instruction for PageWrapper. This is mostly a copy of the react-pdf user guide. Allow renderAnnotationLayer prop to be set. Also including the stylesheet to allow annotations in PDFs as per this doc.

TODO: References show on the page. Sadly the internal link refs are not working. One guess is we might be missing the ref to the page.

Set renderAnnotationLayer and added logging to onGetAnnotationsSuccess callback

      <Page
        width={getWidth()}
        error={error}
        loading={loading}
        noData={noData}
        pageIndex={pageIndex}
        scale={scale}
        onClick={onClick}
        rotate={rotation}
        renderAnnotationLayer={true}
        onGetAnnotationsSuccess={
          (annotations) => console.log({annotations})
        }
        {...extraProps}>
            {children}
      </Page>
image