Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

457
Vistas
PDF Generation in React feels impossible

This topic seems to be largely elusive in terms of finding solutions. I'm working on a project in which a test is taken and the desired goal is a PDF is generated and is both downloadable and emailed to the test taker. Please note: I understand React a decent amount, but I would consider myself still probably a junior developer. I don't know the ins and outs of troubleshooting a lot of things.

react-pdf seems to be the top solution, but I cannot for the life of me get it to behave in the way it's said to. Primarily, whenever I use <PDFDownloadLink>,

<PDFDownloadLink document={<Document><Page><Text>Test</Text></Page></Document>}>
          {({ blob, url, loading, error }) =>loading ? "Loading document..." : "Download Pdf"}
</PDFDownloadLink>

I get

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

I am able to get <PDFViewer> to work, but that's not a needed functionality.

ReactPDF.render(<Document>, 'filename.pdf') is also supposed to create a download and it's literally from their website that that's the correct implementation, but I get:

Uncaught Error: render is a Node specific API. You're either using this method in a browser, or your bundler is not loading react-pdf from the appropriate web build.

Which I understand, but don't know enough to know what to do instead, and their website (as far as I can tell) doesn't really document HOW to use that, beyond just that it's what to use. I just straight up do not know enough.

HERE'S THE OTHER PROBLEM:

Every time I install react-pdf, I have to add the --legacy-peer-deps flag or I get the "Could not resolve dependency" error. On top of that, even if I use that flag, if I have to install any other package after that, I get a "Could not resolve dependency" error FOR react-pdf. I have to uninstall it, install the other package, and then re-install react-pdf with the same legacy flag. I don't know what the right solution is here but having to deal with that error repeatedly is getting very old.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda