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

293
Vistas
PDFkit (Node): How to create paragraph indents?

I'm trying to create paragraph indents in PDFkit. The PDFkit docs state that the indent attribute is "to indent each paragraph of text". While trying this, only the first line has an indent.

const doc = new PDFDocument({ size: "A4" });
doc.pipe(fs.createWriteStream('output2.pdf'));
doc.addPage()
doc.text('fdgfdgfg fggfdgfdg fgfdg fdg dfgdfgdfg dfgfdg fgfgfdg fdgdfgdfg', { indent: 30 })
doc.end();

The code delivers an indent only in the first line of the paragraph. How can I indent the whole paragraph?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

I moved from PDFKit to pdfmake (which is based on PDFKit), which handles indents for my case way better than PDFkit itself. For my use case it's also better since I use JSON output from my markdown lexer which can easily transformed to the input for pdfmake.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You need to doc.text and doc.moveDown if you want consecutive paragraphs.

const doc = new PDFDocument({ size: "A4" });
doc.pipe(fs.createWriteStream('output2.pdf'));
doc.addPage()
doc.text('This is the start of paragraph 1', { indent: 30 });
doc.moveDown();
doc.text('This is the start of paragraph 2', { indent: 30 });
doc.moveDown();
doc.text('This is the start of paragraph 3', { indent: 30 });
doc.end();


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