Convert base64 to pdf in reactJS

Hello,
I am struggling with converting base64 to pdf. I tried the Rect-pdf package still not working. In the documentation, they have mentioned like

  • Import by adding import { Document } from 'react-pdf'.
  • Use by adding <Document file="..." />. file can be a URL, base64 content, Uint8Array, and more.

<Document file={data:application/pdf;base64,${pdf}} onLoadSuccess={onDocumentLoadSuccess}>



Page {pageNumber} of {numPages}


And I tried in this way but still not working. I am at the end of the deadline for my work. Your help will be appreciated .

I have the same problem. Did you get a solution?
Could you share?

It works for me though. Maybe u needed to add these for extra rendering:

import 'react-pdf/dist/Page/AnnotationLayer.css';
import 'react-pdf/dist/Page/TextLayer.css';

Ref: https://github.com/wojtekmaj/react-pdf/blob/main/packages/react-pdf/README.md#support-for-annotations