react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

PDF not render with blob data & chrome version issue

Open sohanpc opened this issue 1 year ago • 0 comments

Before you start - checklist

  • [x] I followed instructions in documentation written for my React-PDF version
  • [x] I have checked if this bug is not already reported
  • [x] I have checked if an issue is not listed in Known issues
  • [ ] If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

I am rendering a PDF file using blob data.

It works correctly in some browsers and on different Chrome versions, but on some Chrome browsers, it doesn't work.

Not working Chrome browser version :- Version 133.0.6943.126 (Official Build) (64-bit)

Working Chrome browser version :- Version 135.0.6943.126 (Official Build) (64-bit)

However, when I render the PDF using a direct public URL (instead of blob data), it works everywhere without any issues.

Error :- Image

Steps to reproduce

Example :-

import { pdfjs, Document, Page } from "react-pdf"; import "react-pdf/dist/esm/Page/AnnotationLayer.css"; import "react-pdf/dist/esm/Page/TextLayer.css";

const options = { cMapUrl: "/cmaps/", standardFontDataUrl: "/standard_fonts/", };

pdfjs.GlobalWorkerOptions.workerSrc = //cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.mjs;

const PdfRender = ({ fileDetails, file }) => {

console.log(file);

Output data :- Blob {size: 113683, type: 'text/html'}

render(

); }

Expected behavior

Expected behavior: The PDF should render using the URL, the public file path, and the blob data.

Actual behavior

Actual behavior: I receive blob data from the file API with the header Content-Type: text/html. The file renders correctly in React PDF and works across all browsers, except for some version-specific issues in Chrome.

Image

Additional information

No response

Environment

  • Browser (if applicable):
  • React-PDF version:
  • React version:
  • Bundler name and version (if applicable):

sohanpc avatar Apr 22 '25 12:04 sohanpc