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

190
Vistas
How can I draw or insert a shape into a PDF in React?

I'm working on a project that lets the user sign a pdf using React. Right now I'm displaying the pdf on an Iframe component and would like to let the user place a rectangle on the pdf that shows where would he want the sign to be displayed.

Is there any way for me to let the user "draw" that rectangle in the displayed pdf?

Right now my component looks like this:

import { PDFDocument } from "pdf-lib";
// import useffect
import { useState, useEffect } from "react";
const PDFRenderer = (props) => {
const { data } = props;
const [docurl, pdfBytes] = data;
const [sizes, setSizes] = useState(null);
useEffect(() => {
  async function getSizes() {
  const pdfDoc = await PDFDocument.load(pdfBytes);
  const pages = pdfDoc.getPages();
  const page = pages[0];
  const { width, height } = page.getSize();
  setSizes([width, height]);
}
  getSizes();
}, [pdfBytes]);
return (
  <div className="renderer">
    {sizes && (
      <iframe
        src={docurl + "#zoom=100"}
        width={sizes[0] * 1.5}
        height={sizes[1]}
      />
    )}
  </div>
);
};
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Its not a problem ask them to add the comments in their PDF, then send a copy of the printed pdf. Since the Iframe and its contents belong to the client, only they can tell you if the PDF was displayed in the IFrame or downloaded into an external application.

Thus you have no means other than politely request they upload a reproduction for you to copy the relative page location. If you want better control, perhaps you need an application/pdf such as Adobe produce.

enter image description here

about 4 years ago · Juan Pablo Isaza Denunciar
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