Questions tagged [react-pdf]

React renderer for creating PDF files on the browser and server

409 questions
0
votes
1 answer

ReactPDF renderToFile not rendering arabic text

I'm trying to render PDF to file but the arabic text in the PDF displays as some encoded text like *BFJ) 'DE9DHE'*, 1'4/ 'D9H6J, *0C1) EF, etc.. -- API -- import { renderToFile } from '@react-pdf/renderer'; import TicketDownloadPDF from…
buga
  • 367
  • 2
  • 15
0
votes
1 answer

convert HIghcharts chart image to png/jpg buffer to display in react-pdf

I have a react project displaying a Highcharts chart. I want to export the chart into a PDF. const svg = scatterChartRef.current.chart.getSVG() const imageBuffer = Buffer.from(svg) const MyDocument = () => (
Julien
  • 212
  • 1
  • 18
  • 53
0
votes
0 answers

Cannot load PDF in React-PDF

I am new to React and I am trying to load a PDF from my src/assets folder, following the example from here I have the following code: import React from 'react'; import { Document, Page } from 'react-pdf'; import samplePDF from…
Ivory
  • 61
  • 1
  • 9
0
votes
0 answers

Why is my PDF not displaying in my react app when deployed on Netlify?

I made a simple react app using react-pdf npm package. Everything is working fine when I run it locally(on localhost:3000) but when I try to deploy it, the PDF is not being displayed and the message saying "Failed to load file" is shown on the…
98k374
  • 1
  • 1
0
votes
1 answer

Is there a way to use react-pdf and pdf.js in the same react-project?

I am using pdf.js (version 3.6.172) in a project and are trying to use react-pdf (version 6.2.2). The problem is setting workerSrc as each package tries to use their own version and refuses to use a wrong version. To load pdf.js I use: import * as…
MarcosCunhaLima
  • 191
  • 2
  • 11
0
votes
0 answers

How can I get to know that pdf is password protected or not in react native

I am using react-native document-picker for pick pdf in react native How can I get to know that the pdf I choose which is password protected or not without opening pdf file, if pdf is password protected then open a input pop or show input field…
0
votes
0 answers

Incorrect Y value when calculating coordinates for PDF annotation using react-pdf and pdf-lib

I'm using react-pdf to render a PDF document in my react app. I've added a function to get the coordinates of the user's click. But when I calculate the Y value based on the clientY and containerRect, and pass these calculated coordinates to pdf-lib…
onlit
  • 728
  • 5
  • 19
0
votes
0 answers

Creating a large PDF with react-pdf

I am trying to create a tool to print installation templates for house numbers. A user inputs into a form the Text, selects the font, the size and then hits "Create" which creates a PDF a plotter can print. The issue I am currently facing is that…
0
votes
1 answer

How to draw millimeter precise lines and boxes with React-pdf

I tried the following code: import React from 'react'; import { Page, Document, StyleSheet, Svg, Line, Path, Rect, Text, } from '@react-pdf/renderer'; // Create styles const styles = StyleSheet.create({ page: { padding: 20, …
vaxul
  • 403
  • 1
  • 4
  • 14
0
votes
1 answer

Unexpected character '' (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file

I'm very new to react, gatsby, webpack and all that. Here's my webpack.config.js file: const path = require('path'); module.exports = { module: { test: /\.(png|svg|jpg|gif|pdf)$/, use: [ { loader: 'file-loader', …
NobinPegasus
  • 545
  • 2
  • 16
0
votes
0 answers

Facing issue to download a proper aligned pdf using the package "React-pdf/render"

I created a HTML doc using the react-pdf/render package and followed the steps mentioned in the documentation. However, when trying to download my component, I am facing an issue with downloading the correct PDF in a properly aligned way. This may…
user20663233
  • 11
  • 1
  • 2
0
votes
0 answers

load external link with react-pdf CORS policy

I am using react-pdf to show pdf file in my app. I have so many pdf url on a download server and they are completely public. here is a link of my pdfs: https://virafiles.ir/books/103/103.pdf. I can load it in