voilab / voilab-pdf-table

PdfKit wrapper that helps to draw informations in simple tables
MIT License
52 stars 26 forks source link

Bottom border merges with the next line contents. #27

Open DineshKumar-G opened 5 years ago

DineshKumar-G commented 5 years ago

Screenshot_2019-06-16_10-23-25

atipezda commented 5 years ago

Code ? @DineshKumar-G

karl-roberts commented 4 years ago

I have the same issue here. Here's my code that generates this:

  let Pdf = new PdfDocument({
      autoFirstPage: false,
      layout: 'portrait',
      size: 'A4',
      info: {
        Title: 'UID Freight Report'
      }
    })

    let Table = new PdfTable(Pdf, {
      topMargin: 0
    })

    Table
      .addPlugin(new (PdfColumn)({
        column: 'description'
      }))
      .addPlugin(new (PdfColumn)({
        column: 'reference'
      }))
      .setColumnsDefaults({
        headerBorder: 'B'
      })
      .addColumns([{
        id: 'reference',
        header: 'Reference',
        align: 'left',
        width: 100
      }, {
        id: 'description',
        header: 'Description',
        width: 200
      }, {
        id: 'locationName',
        header: 'Location',
        width: 50
      }])
      .onPageAdded((tb) => {
        tb.addHeader()
      })

    Pdf.addPage()

    let filter = request.input('filter', null)

    if (filter) {
      filter = JSON.parse(decodeURIComponent(filter))

      let results = await SearchService.SearchLogs(filter, null, [], null, null, null, null)

      Table.addBody(results.data)
    }

    response.type('application/pdf')
    response.implicitEnd = false
    Pdf.end()
    Pdf.pipe(response.response)

This is part of an AdonisJS controller action