The issue was:
- I needed data:application/pdf;base64, in front of the string
- I did not have a component inside of my component. See https://github.com/wojtekmaj/react-pdf/issues/203
GitHub
github.com › wojtekmaj › react-pdf › issues › 42
How to load a file using Base64? · Issue #42 · wojtekmaj/react-pdf
July 31, 2017 - The docs says that this lib supports base64 format, can some one show me an example.
Author alphiii
Convert base64 to pdf in reactJS - Code with Mosh Forum
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… More on forum.codewithmosh.com
reactjs - Loading PDF from Base64 data using react-pdf-js - Stack Overflow
Currently I'm trying to load a PDF using base64 data with this React component react-pdf-js. I am currently recieving a PDFDocument: stream must have data error when trying to load the PDF in the More on stackoverflow.com
Allow Rendering of Images as base64 strings
Great package! I am trying to use this to render some graphs that I have converted into base64 png images. Is it possible to get this to work with your Image component? Or is there an easy fix to g... More on github.com
React-pdf show image from base64 data string - Stack Overflow
where can I show a image with base64 on my react pdf ? export const fileBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAYkAAAE+ More on stackoverflow.com
npm
npmjs.com › package › react-pdf
react-pdf - npm
February 25, 2026 - Import by adding import { Document } from 'react-pdf'. Use by adding <Document file="..." />. file can be a URL, base64 content, Uint8Array, and more.
» npm install react-pdf
Published Feb 25, 2026
Version 10.4.1
GitHub
github.com › react-pdf-viewer › examples › blob › main › preview-a-pdf-file-from-base-64 › LoadFromBase64Example.tsx
examples/preview-a-pdf-file-from-base-64/LoadFromBase64Example.tsx at main · react-pdf-viewer/examples
import '@react-pdf-viewer/core/lib/styles/index.css'; · const LoadFromBase64Example: React.FC<{}> = () => { const base64 = 'data:application/pdf;base64,JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwogIC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAvTWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0KPj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAgL1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9udA
Author react-pdf-viewer
Telerik
telerik.com › components › pdf processing › base64 strings
React PDF Processing Base64 Strings - KendoReact
Get the Base64 strings that are generated from the React PDF Processing components by KendoReact.
Syncfusion
help.syncfusion.com › document-processing › pdf › pdf-viewer › react › how-to › get-base64
Get Base64 from loaded PDF in React PDF Viewer | Syncfusion
import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import { PdfViewerComponent, Toolbar, Magnification, Navigation, Annotation, TextSelection, TextSearch, FormFields, FormDesigner, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer'; class App extends React.Component { constructor(props) { super(props); this.viewerRef = React.createRef(); } // Function to get Base64 of the loaded document base64ofloadedDocument = () => { this.viewerRef.current.saveAsBlob().then((blobData) => { const reader = new FileReader(); reader.onload = () => { const base6
Top answer 1 of 2
4
You can use embed and it's fairly succinct.
return <embed src={`data:application/pdf;base64,${base64ContentString}`} type="application/pdf" width="100%"></embed>
2 of 2
2
I've been looking on how to do this as well, and found a way thanks to this entry: Creating a Blob from a base64 string in JavaScript the way to set the pdf file is something like this:
const byteCharacters = atob(response);
const byteNumbers = new Array(byteCharacters.length);
for (let i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
this.state.pdf = new Blob([byteArray], {type: 'application/pdf'});
The document looks like this:
<Document file={this.state.pdf} > ...
Not sure if I am using state correctly here, I was using state hooks in my code.But using the blob should work.
GitHub
github.com › diegomura › react-pdf › issues › 216
Allow Rendering of Images as base64 strings · Issue #216 · diegomura/react-pdf
April 18, 2018 - Notifications · You must be signed in to change notification settings · Fork 1.3k · Star 16.4k · New issueCopy link · New issueCopy link · Closed · Closed · Allow Rendering of Images as base64 strings#216 ·
Author TimonSotiropoulos
GitHub
github.com › diegomura › react-pdf › issues › 734
Base64 support · Issue #734 · diegomura/react-pdf
October 9, 2019 - Is your feature request related to a problem? Please describe. Almost all of PDF documents I'm required to create use charts which I can convert to base64 string but cannot use as Image's s...
Author abtx
GitHub
github.com › diegomura › react-pdf › issues › 1250
Support SVG Base64 Images · Issue #1250 · diegomura/react-pdf
April 22, 2021 - This is easier than trying to convert an svg element to a react-pdf Svg component, because the browser has built in methods for encoding dataURI's (see code example bellow). export function encodeSvgString(svg: string) { const decoded = unescape(encodeURIComponent(svg)); const b64String = btoa(decoded); const imgSource = `data:image/svg+xml;base64,${b64String}`; return imgSource; }
Author OliverLeighC
Reddit
reddit.com › r/reactnative › how to display base64 encoded pdf in react native
r/reactnative on Reddit: How to display base64 encoded pdf in react native
July 18, 2022 -
In my app, I need to display a PDF that I have in base64. I don't mind if I can redirect to google chrome to display it in a browser, but I can't find anything online :( help
GitHub
github.com › mikecousins › react-pdf-js › issues › 66
Is there a way to load a PDF from base64 data? · Issue #66 · mikecousins/react-pdf-js
April 3, 2018 - Loading a PDF from react-pdf worked this way, could anyone help me out with this? I'm getting a PDFDocument: stream must have data error whenever I try to load my PDF's · <PDF file={`data:application/pdf;base64,${this.state.base64}`} onDocumentComplete={this.onDocumentComplete} onPageComplete={this.onPageComplete} page={this.state.page} /> 👍1 ·
CodeSandbox
codesandbox.io › s › base64-pdf-viewer-8ccd6
base64-pdf-viewer - CodeSandbox
April 21, 2020 - base64-pdf-viewer by ghawthorne66 using @types/react-pdf, react, react-dom, react-pdf, react-scripts
GitHub
github.com › PriyanshuGupta28 › react-base64-to-pdf
GitHub - PriyanshuGupta28/react-base64-to-pdf
import React, { useEffect, useState } from "react"; import { PDFInfo, PDFPreview, PDFDownloadButton } from 'react-base64-to-pdf'; const App = () => { const base64Pdf = 'JVBERi0xLjUKJYCBgoMKMSA.....'; // Your Base64-encoded PDF string return ( <div> <h1>PDF Viewer Example</h1> {/* Show PDF Preview */} <PDFPreview base64={base64Pdf} style={{width: 100vw, height : 100vh}} className="yourClassNameGoesHere"/> {/* Show PDF Information */} <PDFInfo base64={base64Pdf} /> {/* Download PDF Button */} <PDFDownloadButton base64={base64Pdf} downloadFileName="your-file.pdf" style={{ backgroundColor: 'blue', color: 'white', padding: '10px 20px', borderRadius: '5px', textDecoration: 'none' }} /> </div> ); }; export default App;
Author PriyanshuGupta28
Stack Overflow
stackoverflow.com › questions › 71036244 › how-to-convert-base64-string-to-pdf-in-react-js
How To Convert base64 String to PDF in React.js [duplicate]
August 2, 2022 - Stack Overflow | The World’s Largest Online Community for Developers

