Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!