Takuhii
Takuhii

Reputation: 925

Center Text URLs in PDFKit

I am trying to build a PDF using PDFKit and am struggling with some alignment issues

I have

and I would like it to look like this

        Option 1        |        Option 2        |        Option 3        

I have got his far with my PDFKit code

doc
  .fillColor('#0A3055')
  .text('Option 1', {
      link: 'https://www.example.co.uk/option1',
      continued: true,
  })
  .fillColor('#8a8a8a')
  .text(' | ', {
      continued: true
  })
  .fillColor('#0A3055')
  .text('Option 2', {
      link: 'https://www.example.co.uk/option2',
      continued: true
  })
  .fillColor('#8a8a8a')
  .text(' | ', {
      continued: true
  })
  .fillColor('#0A3055')
  .text('Option 3', {
      link: 'https://www.example.co.uk/option3',
      continued: false
  })
  .moveDown()

However it is left aligned on the page, like this

Option 1 | Option 2 | Option 3

and I can't seem to figure out how to centre the whole thing or add the padding I require without adding spaces to the dividers.

I have tried Stack Overflow, Google and PDFKit docs, but nothing gives me a real solution

Any ideas?

Upvotes: 0

Views: 47

Answers (0)

Related Questions