foliojs/pdfkit

Is it normal for strings to be rendered slightly differently three times than once?

luckymore opened this issue · 0 comments

Bug Report

The left side is rendered using continued and the right side is rendered once using text, but the results are inconsistent.

Description of the problem

image

Code sample

// create a document and pipe to a blob
var doc = new PDFDocument();
var stream = doc.pipe(blobStream());

// draw some text
var a = 'Click here to visit OpenAI website:'
var b = 'The advent of Large Language Models (LLMs)'
var c = 'end with a link'

doc.fontSize(12)

// left
doc
.text(a, 20, 20, { width: 200, continued: true })
.text(b)
.text(c)

// right
doc.text(a + b + c, 300, 20, { width: 200, continued: true })

// end and display the document in the iframe to the right
doc.end();
stream.on('finish', function() {
  iframe.src = stream.toBlobURL('application/pdf');
});

Your environment

https://pdfkit.org/demo/browser.html

  • pdfkit version:
  • Node version:
  • Browser version (if applicable):
  • Operating System: