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

174
Vistas
Unable to highlight/select textField after filling it with a value using pdf-lib

I want to dynamically update fields inside some pdf files and use them. For the sake of user experience, I want the fields to be able to be highlighted so it's easier to copy/paste so I don't have to input the values later manually... but I have been unsuccessful in finding a solution.

Here's my code that fills out the textFields using pdf-lib:

const pdf = await PDFLib.PDFDocument.load(filedata);
const form = pdf.getForm();

var textField = form.getTextField(TEXTFIELD_NAME);

textField.setMaxLength(20);

textField.setText("Some value");

textField.enableReadOnly();
const pdfToBytes = await pdf.save();

And then I create a file using "pdfToBytes", but when opening the PDF using any PDF viewer, I'm unable to highlight/select the value inside the textField.

I have tried textField.disableReadonly, but I actually want the field to be read only, and it doesn't really work in all PDF viewers when doing so anyways.

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