Questions tagged [react-pdf]

React renderer for creating PDF files on the browser and server

409 questions
0
votes
0 answers

Creating Pdf files in in next JS

Can anyone tell me how do we use @react-pdf/renderer to generate a PDF file in NextJS? Seeing over the documentation online I am finding it hard to implement the functionality in my NextJS app.
0
votes
0 answers

jest error when included react-pdf renderer

getting moduleNameMapper error when doing yarn test, tried all the stuff by putting the same in package.json but no success. Below is the error: at createNoMappedModuleFoundError (node_modules/jest-resolve/build/index.js:501:17) at Object.…
0
votes
2 answers

Merge created PDF with existing local PDF in ReactJS

I create a PDF in ReactJS using react-pdf/renderer and download it using file-saver. Here is my code that creates the PDF and downloads it: const LazyDownloadPDFButton = (number, date, totalHours, formattedHours) => (
0
votes
2 answers

How to fetch pdf file and display it using react-pdf library

I'm trying to fetch pdf file from my backend and display it on the page. I'm using react-pdf library https://www.npmjs.com/package/react-pdf . But I'm getting an error Invalid parameter in file, need either Uint8Array, string or a parameter…
Yerlan Yeszhanov
  • 2,149
  • 12
  • 37
  • 67
0
votes
1 answer

Why is my session storage variable 'header' Null

I am trying to create a pdf using react-pdf. In App.js I store my 'header' info in Session Storage. My current Invoice component: import React from 'react'; import { Page, Document, Image, StyleSheet } from '@react-pdf/renderer'; import InvoiceTitle…
Randy
  • 1,137
  • 16
  • 49
0
votes
1 answer

Is it possible to get SVG to work well with react-top-print?

Idea is to print pdf documents that I am dislaying in pdfviewer component that I have created. I am getting Uint8Array from the server and that is rendered inside component. All works, so good so far. Problem starts with implementing printing…
Mladen Milosavljevic
  • 1,720
  • 1
  • 12
  • 23
0
votes
1 answer

react-pdf/renderer IE takes very long time to generate blob to download pdf

async function saveBlob() { const doc = ; const asPdf = pdf([]); await asPdf.updateContainer(doc); const blob = await asPdf.toBlob(); saveAs(blob, 'instructions.pdf'); } return ( …
Sachin Jagtap
  • 527
  • 6
  • 16
0
votes
0 answers

How to get pdf as a file in react?

I want to get it as a format as we upload a file. The pdf file stored on the client site. I don't want to use the upload method also not get the file from the backend. lastModified: 1619065221844 lastModifiedDate: Thu Apr 22 2021 10:20:21 GMT+0600…
Sajib
  • 21
  • 3
0
votes
0 answers

How to solve: PDF installed instead of opening with react-pdf?

Hi, I'd like to display multiple pages of my PDF. I've followed the code sample on react-pdf. However, when I run the site on localhost, the PDF is installed rather than opened. Please help 1. Error: 2. Folder structure: 3. What I've…
Ken Pham
  • 285
  • 6
  • 17
0
votes
1 answer

react pdf multi lines puts all lines in one line

I am trying to use array below: const test =…
mpora
  • 1,411
  • 5
  • 24
  • 65
0
votes
2 answers

react-pdf won't render basic pdf

Trying to render a pdf using react-pdf and I swear I've done every configuration of their docs and nothings working. I keep getting ReferenceError: $RefreshReg$ is not defined Proof of concept component. Yes, the options aren't be used in this…
cphilpot
  • 1,155
  • 3
  • 17
  • 39
0
votes
1 answer

Is there any options to add custom css in react-pdf-table?

I have used @david.kucsai/react-pdf-table. here is the css code how i implemented. export const TableCellBodyStyle = { padding: 5, textAlign: "left", wordWrap: `break-word`, fontSize: 8, }; its works but i donot have full control on table.
Anuj Shakya
  • 73
  • 1
  • 9
0
votes
1 answer

Create a page tracker in react-pdf

I am creating a pdf viewer using react-pdf, I want to implement a page tracker in the pdf viewer, so that user can navigate to any page typed in the input box. And the page number should also update when the user reaches any page with that specific…
Mauj Mishra
  • 133
  • 1
  • 12
0
votes
2 answers

How to make a page counter in pdf in react.js?

I working with react-pdf to display pdf using a link. I have completed the pdf viewer. What I want to do now is to make a pdf page counter. So that user know what page he is in. What I have tried is to give window a scroll event which will increment…
Mauj Mishra
  • 133
  • 1
  • 12
0
votes
0 answers

i am trying to implement react-pdf in my web app

I am building a react web app project and i want it to be able to display pdfs from a link or local storage so I am using the library react-pdf (https://www.npmjs.com/package/react-pdf) here is my code import React, { useState } from…