Skip to main content

All Questions

Tagged with
0 votes
2 answers
157 views

how to use pdfjs worker in react and typescript?

I'm trying to use pdfjs in a react+ts project. import React from "react"; import * as pdfjs from "pdfjs-dist" export default function EditPdf() { React.useEffect(()=>{ ...
Null Salad's user avatar
0 votes
0 answers
35 views

how to get the newest access token everytime when using pdf.js to fetch pdf

I am using pdf.js to render some pdf in browser, this is how I defined the option parameters: export const pdfJsOptions: Options = { cMapUrl: `/pdfjs-dist/${pdfjs.version}/cmaps/`, httpHeaders: {...
Dolphin's user avatar
  • 37.5k
1 vote
1 answer
392 views

Error related to pdf.worker.min says 'import', and 'export' cannot be used outside of module code

I am getting this error when pushing a build to Vercel: Failed to compile. static/media/pdf.worker.min.50acc843.mjs from Terser x 'import', and 'export' cannot be used outside of module code ,-[...
ytpm's user avatar
  • 5,110
1 vote
1 answer
2k views

PDFjs-dist - TypeError: Promise.withResolvers is not a function - Webpack Node JS

I've got the following "service" which is trying to extract the text from a PDF file but when it runs I am getting the same error every time no matter whether I point it at the main build (...
Ryan Durrant's user avatar
0 votes
0 answers
25 views

discrepancy when do async calls for page render with two inputs

I am using pdfjs and pdf-lib for rendering pdf fetching from ajax call. this is where I get bytes from pdfDoc, set numNumPages and setModifiedPdfBytes. useEffect(() => { if (pdfBytes == ...
asdf_enel_hak's user avatar
0 votes
1 answer
1k views

Style for textlayer in pdfjs

I'm working around with pdfjs library and facing this problem when rendering the textlayer. The text in the textlayer isn't the same with the content in the canvas. How can I solve this? I saw there ...
Hoangdz's user avatar
  • 186
0 votes
1 answer
213 views

How To Extract content from pfd file using javascript

Hello i am trying different ways to extract content from a pdf file but nothing works for me , like pdf.js when i try using pdf.js it also show error and i dont know why . I am trying this approach ...
MohsinRahman's user avatar
0 votes
1 answer
728 views

Is it possible to get current viewed page from PDF.js in web app for zooming and rotation?

In my REACT project, I must : Import a pdf file from an url // OK Show PDF in browser // OK And there is how I do : function handlePages(page, pdfScale) { //This gives us the page's dimensions ...
Ahmed Kallali's user avatar
1 vote
1 answer
1k views

PDF.js not showing rendered canvas image

I have a React component that shows PDFs. When I use this component, I just need to pass the PDF URL. <Previewer pdfUrl={pdfUrl}></Previewer> The component handles the preview details. ...
Dolphin's user avatar
  • 37.5k
0 votes
1 answer
334 views

why pdfjs not show the pdf chinese characters when rendered pdf to cavas image

I am using this code to render the fisrt page of pdf to a image using pdfjs "pdfjs-dist": "^3.9.179": const initPdf = async (pdfUrl: string) => { setPdfUrl(pdfUrl); ...
Dolphin's user avatar
  • 37.5k
2 votes
1 answer
1k views

react-pdf gives TypeError: Cannot read properties of null (reading 'sendWithPromise') when cmapUrl option is set

I implemented pdf previewer with 'pdf-react'. It displays pdf file with no problem when font is english font, but problem occurs when I use other than English font. (it loads the page with no text ...
amu03's user avatar
  • 351
0 votes
1 answer
2k views

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 ...
MarcosCunhaLima's user avatar
1 vote
0 answers
245 views

After installing pdfjs-dist getting SyntaxError on npm start - Missing class properties transform

Recently, I have installed pdfjs-dist in my React project. After importing it, I'm getting below error while running. ./node_modules/pdfjs-dist/build/pdf.js SyntaxError: /Users/XXXXXXXXXXX/Documents/...
Miralkumar Sojitra's user avatar
0 votes
1 answer
687 views

Highlight a zone on the PdfJS Canvas

I have a React JS project (similar to this sample on Sandbox) in which I'm using PDF JS to display the PDF document. I am trying to add a transparent highlight to areas or zones on the document but ...
Praveen Kumar's user avatar
0 votes
1 answer
1k views

How to scale PDF to canvas width and height in Javascript?

I have a list of PDF documents that I'm trying to render a preview of similar to how the Google Docs UI looks like. {documents.map((doc) => { return ( ...
neil_ruaro's user avatar

15 30 50 per page
1
2 3 4 5