434 questions
0
votes
0
answers
133
views
DOMMatrix is not defined when using react pdf
Today when I using react-pdf(10.2.0) in project, shows error:
DOMMatrix is not defined
at file:///Users/dolphin/source/reddwarf/frontend/texhub-web-labs/node_modules/pdfjs-dist/build/webpack:/pdf....
0
votes
0
answers
84
views
PDF field misalignment between React-PDF editor and final signed PDF (fields shift down by one field height per placement)
I'm building a custom React-based PDF editor and signer using react-pdf and pdf-lib.
The editor (PdfEditor.tsx) lets users drag-and-drop fields (Signature, Email, Date, etc.) on a PDF canvas.
Later, ...
0
votes
0
answers
40
views
React-PDF <Image /> not rendering external images from API
I’m building a tenancy agreement generator using react-pdf
.
Local images stored in my Next.js public/ folder render fine inside , but external images (e.g. from an API or CDN) never show up in the ...
0
votes
0
answers
145
views
React PDF and React PDF Viewer packages version upgradation Issues
I have a React Typescript application. Node version: v16.12.0. Below are the versions of react
"react": "^19.1.1",
Here there are three packages related to pdf:
react-pdf-viewer (...
0
votes
1
answer
86
views
How to highlight the clean citation strings in the PDF document?
Basically, I'm creating an Next app in which the we get the array of strings which is messy we clean it and then we created them into multiple strings:
const cleanCitationText = (text: string): ...
0
votes
1
answer
205
views
Deploy Express server to Vercel with ESM dependency?
I have an Express server which uses a ESM dependency react-pdf. I also need the file to be .tsx as I'm using TypeScript JSX for rendering.
I have this working locally but I run into issues when trying ...
0
votes
4
answers
2k
views
TypeError: Eo is not a function when deleting in React-PDF
I'm trying to generate a PDF based on user input. The user can add, update, and delete items to a list. The list is a redux slice where the state is kept
Adding and updating are working but for some ...
0
votes
0
answers
265
views
React-Pdf with configured pdfjs.GlobalWorkerOptions.workerSrc cannot build
I downloaded/installed React-Pdf,
"react-pdf": "^9.2.1",
I need to show a Byte-Array PDF which is dynamically generated.
const response = await createPdf(payload);
// ...
0
votes
1
answer
154
views
Render a pdf in react that supports multiple languages and download it
I was using '@react-pdf/renderer' to create a pdf and download it but I could not find a way to support multiple languages with it. That is one pdf file could have strings in multiple languages but ...
0
votes
0
answers
58
views
How to read from .Net Core FileStream in Javascript/Axios?
Endpoint:
[HttpGet("GetFileStream/{id}")]
[Produces("application/octet-stream")]
public async Task<Stream> GetFile(int id)
{
Stream stream = await Services.FileStorage....
0
votes
1
answer
96
views
ResizeObserver always return the same contentRect
I'm trying to show a PDF in my page by using "react-pdf". I am now struggling with making it responsive. I am now using this custom hook to get the size of the contentRect:
import { ...
3
votes
0
answers
904
views
React PDF | TypeError: Cannot read properties of null (reading 'sendWithPromise')
Issue Description
I’m encountering an issue with react-pdf where the messageHandler (worker communication channel) is null when rapidly navigating between PDF files. I’ve tried several solutions and ...
0
votes
2
answers
590
views
How to add watermark to every pages in react-pdf
const Template1 = ({ data }) => {
const styles = StyleSheet.create({
page: {
position: "relative",
},
watermarkContainer: {
position: "absolute",
...
0
votes
0
answers
96
views
React-PDF: How can I make sure that content flows dynamically to new pages instead of text flow in single page?
I am using the react-pdf package to generate a multi-page PDF document in my React application. However, I am facing issues with dynamically setting margins, borders, and footer styling across ...
-1
votes
1
answer
236
views
How to preview an XFA-based PDF?
I am working on a React application and I need to display a preview of an XFA-based PDF file. However, I'm running into issues when trying to render the PDF in the browser. Below are the details of my ...
0
votes
1
answer
50
views
Malformed SVG path in React-PDF renderer
I am trying to render inside a PDF an SVG that displays LaTeX. The SVG has been generated using MathJax. The issue is that the rendered PDF has the Path elements from the SVG malformed. It changes the ...
0
votes
0
answers
93
views
React pdf viewer not showing the file in its original size and text is very small to read
I am trying to use react-pdf in my app and I have downloaded a code from github for integrating react-pdf in my project. This is working fine and showing the pdf but the size of the pdf is not the ...
0
votes
0
answers
97
views
dispatcher.useInsertionEffect error with react-pdf/renderer and Chakra UI
I want to download a Chakra UI component with @react-pdf/renderer
Copying some code from react-pdf's documentation, I have this:
import "./App.css";
import Header from "./components/...
0
votes
0
answers
93
views
React-pdf failing to load pdf from Url
I am using react-pdf to view pdf in my Next.js web app: https://www.npmjs.com/package/react-pdf
When I am trying to acces my pdfs that I have on cloud using url, I am getting error: Failed to fetch ...
2
votes
1
answer
347
views
PDF rendering issues with multilingual text across different languages in a PDF generation library like pdf-lib
I am generating PDFs in my project using libraries such as @react-pdf/renderer and pdf-lib, and I am encountering significant challenges with font compatibility for multilingual text. In my use case, ...
2
votes
2
answers
815
views
Why is ReactPDF.renderToBuffer not a function in @react-pdf/renderer?
I’m trying to generate a PDF using @react-pdf/renderer, and I want to directly render the PDF to a Buffer for further processing (e.g., saving it to a file or sending it as an HTTP response). However, ...
2
votes
1
answer
125
views
Re-rendering issue with PDFs in React
const [numPagesState, setNumPagesState] = useState(0);
const allCertificates = formik?.values?.certificate_file || [];
{allCertificates?.length > 0 &&
allCertificates?.map((el) => {
...
1
vote
0
answers
179
views
React-PDF Causes iPhone 13 and Below to Crash on PDF Display in Next.js App
I’m working on a Next.js project that involves displaying PDFs using the react-pdf library. The issue arises on iPhone 13 and older models, where the app crashes after displaying a PDF. The PDF ...
0
votes
1
answer
176
views
Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
at Object.inherits2 [as inherits] (@react-pdf_renderer.js?v=2aabb8bf:122:50)
at ../../node_modules/blob-stream/...
1
vote
0
answers
186
views
@react-pdf/renderer how to build for node when using renderToStream
I am trying to build (bundle) an app that uses @react-pdf/renderer with vite. Then that bundle will be used in different node express app (like a library).
I export some functions that can be used in ...
0
votes
1
answer
186
views
@react-pdf/renderer can't use fonts when building for node
I am trying to build an app that uses react-pdf/renderer. I will send a pdf response from node js express server. The fonts I use in react-pdf/renderer (.ttf) seems like are fetched via XMLHttpRequest ...
0
votes
2
answers
198
views
Metadata in PDFs from HTML
I need to carry some metadata – which could amount to just an ID – from the source HTML, through to the PDF using WeasyPrint, eventually ending up somehow addressable in the HTML rendered by pdf.js (...
0
votes
2
answers
620
views
How to pass props to react-pdf/renderer renderToStream function?
I am trying to render a pdf to sent it as an attachment with Resend.
This is my test PDF. Basically the one from the docs from react-pdf/renderer but with one testprop added.
import { Document, Page, ...
3
votes
3
answers
2k
views
Why do I get this error when I try to use react-pdf in my next js 14.2
I've been having a problem with react-pdf in my next js, i've been following multiple tutorial and it seems like still have an error.
I get this error
⨯ Instead change the require of react-pdf.js in ...
0
votes
0
answers
1k
views
Rendering Large PDFs in Chunks Using React-PDF (PDF.js)
I'm trying to render a large PDF file from my S3 storage in chunks using React-PDF (PDF.js). I'm fetching the first 64KB of the PDF with a byte range request, but the PDF fails to load, showing the ...
0
votes
0
answers
64
views
I can't insert a pdf into next js
import React, { useState } from 'react';
import ReactDOM from "react-dom";
import HTMLFlipBook from "react-pageflip";
import { pdfjs, Document, Page as ReactPdfPage } from "...
3
votes
1
answer
8k
views
Expected a JavaScript module script but the server responded with a MIME type of "application/octet-stream". when upgrade react pdf to 9.x
Today when I upgrade the react-pdf https://github.com/wojtekmaj/react-pdf version to 9.1.0, the pdf load failed and shows error:
Failed to load module script: Expected a JavaScript module script but ...
0
votes
1
answer
391
views
Opening a PDF in a Blob Instead of a PDF Preview Component
I'm currently using BlobProvider to open a PDF document in a new tab as a blob. Here’s the code snippet I’m using:
<BlobProvider document={<OrderDocument data={orderData} />}> {({ url, ......
0
votes
1
answer
200
views
PDF created with react-pdf opened in new tab gives "Check Internet Connection" error when click download
I m using react-pdf to create a PDF and open it in new tab via Link component.
WindowTargetAttributes.BLANK = _blank
const document = (
<Document>
<Page size="A4" style={...
2
votes
1
answer
571
views
react-pdf + react-pageflip render problem
I'm using react-pageflip package with react-pdf. However, the PDF file is not rendered in browser.
import React, { useState } from 'react';
import HTMLFlipBook from 'react-pageflip';
import { Document,...
-1
votes
1
answer
133
views
How to disable copying text from the pdf rendered by @react-pdf/renderer?
Package using for creating pdfs: @react-pdf/renderer
I've tried setting an invisible layer over the pdf, but it doesn't work. I've also wrapping the PDFViewer component in a div with userSelect: None ...
0
votes
2
answers
889
views
react-pdf font doesn't change
I'm trying to make a PDF that uses the courier font, but the file doesn't change to it
const styles = StyleSheet.create({
text: {
fontFamily: "Courier"
}
});
const MakePDF = ...
-1
votes
1
answer
205
views
Download PDF using react-pdf
I am using react-pdf for rendering Pdf file and it's working perfectly fine.
Below is the code for same:
<Document
inputRef={documentRef}
file={pdfUrl}
error=...
0
votes
1
answer
673
views
How to load base64 images into react-pdf?
I'm trying to get base64 images in a variety of formats (gif, png, jpg) to show in react-pdf.
{c.images.map((d) => {
const prefix = 'data:image/' + d.filename.split('.').pop() + ';base64,'
return &...
1
vote
0
answers
853
views
React Pdf don't show image
I use the React PDF Image library component and pass an image into it as shown in the documentation and tutorials on YouTube, but the image is not displayed, what could be the problem? To check the ...
0
votes
1
answer
566
views
Setting up a web worker using comlink
I have a worker file with the following code
import * as Comlink from "https://unpkg.com/comlink/dist/esm/comlink.mjs";
const renderPDFInWorker = async (props) => {
try {
const { ...
0
votes
1
answer
1k
views
Custom font not working in @react-pdf/pdf Vite Typescript
I am building a React Vite Application and using @react-pdf/pdf.
I want to add custom font files which are .ttf
I import my font files from where they are. The path is correct:
import PrometoBold from ...
0
votes
1
answer
463
views
How can I get the PDFPage number from the PDFField using pdf-lib
I am using pdf-lib in my React TypeScript app. How can I get all the text fields in a PDFDocument with the page number on which that form field is.
const getAcroFieldRefs = (pdfDoc) => {
if (!...
1
vote
0
answers
40
views
Access to fetch from origin 'firebasestoragelink' has been blocked by CORS policy: 'No Access-Control-Allow-Origin'
It seems that the issue only occurs in the production environment, as fetching the URL and passing it to React-PDF works fine in local and development environments. However, when React-PDF attempts to ...
1
vote
2
answers
2k
views
Issue with Creating a PDF Viewer Component in React using react-pdf
I'm encountering a problem with my code while attempting to create a PDFViewer component in React (using TypeScript) with the react-pdf library. Despite my efforts, it seems to be failing, and I'm ...
1
vote
0
answers
272
views
react pdf renderer, dynamic text (View) affecting the header(fixed) and footer(fixed) height
I want to render render a pdf which is a lab test which consists of Header(border, logo, hospital address,... etc) and in footer (some text) which has fixed height.
Ex layout:
Here, the header and ...
0
votes
1
answer
112
views
'react-pdf' adds html at after each page instead of just rendering the pages of the pdf file
I created next component:
import React from 'react';
import { Document, Page, pdfjs } from 'react-pdf';
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
pdfjs.GlobalWorkerOptions.workerSrc = `//...
0
votes
1
answer
338
views
Deployment issue in viewing PDF using react-pdf
I used react-pdf to display a single-page PDF in a ReactJS application. It worked well during the development stage, but after deployment, it stopped working. It says, "Failed to load the pdf&...
1
vote
1
answer
115
views
"IFDHandler is not defined" trying to import photos from Google Photos into a PDF generation app with NextJS
This is going to be a bit of a read but I would love to hear some thoughts.
I have a project in NextJs that has a few dependencies, but it's mostly a simple form that stores the data to state and then ...
1
vote
0
answers
295
views
Triggering Queries within a React-PDF Document
I am using React-PDF to create PDFs within my React application. My application is set up using RTK Query and works just as expected.
However, I am currently implementing my multipage PDF logic. ...