shubham arora
shubham arora

Reputation: 183

How to create a flexible table in PDF file using PDFkit nodejs

// I am using something like this to create a cell but i have no idea how to create flexible table with dynamically data

var doc = new pdfDocument();
doc.lineCap('square')
.moveTo(250, 20)
.circle(275, 30, 15)
.stroke()

Upvotes: 2

Views: 6303

Answers (1)

user8487780
user8487780

Reputation:

You Have used this code to create table using PDFKit

x1=doc.x;
x6=310;
doc.rect(doc.x, doc.y, 450, 65)
   .moveTo(300, doc.y).lineTo(300, doc.y+65)
   .moveDown(0.2)
   .text('Member Name',{indent:5, align:'left',width:140, height:doc.currentLineHeight()})
   .rect(x1,doc.y,450,0.5)
   .moveUp()
   .text(member_name,x6,doc.y)
   .moveDown(0.2)
   .text('Member ID',x1,doc.y,{indent:5, align:'left',width:140, height:doc.currentLineHeight()})
   .rect(x1,doc.y,450,0.5)
   .moveUp()
   .text(member_id,x6,doc.y)
   .moveDown(0.2)
   .text('Member DOB',x1,doc.y,{indent:5, align:'left'})
   .rect(x1,doc.y,450,0.5)
   .moveUp()
   .text(member_dob,x6,doc.y)
   .moveDown(0.2)
   .text('Baby Due Date',x1,doc.y,{indent:5, align:'left'})
   .moveUp()
   .text(baby_due_date,x6,doc.y)
   .stroke()
   .moveDown(1.5);

Upvotes: 1

Related Questions