Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda