question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LineWrapper swallows line of text

See original GitHub issue

In certain situations the LineWrapper.wrap method called by the text mixin swallows entire lines. I have not fully understood what happens, but it seems a single additional emitLine solves the issue. I think buffer is overwritten with word before its previous contents have been emitted, since the actual emitLine call happens afterwards.

See: https://github.com/jtillmann/pdfkit/commit/80868c23b946bc98775ee38c49eb741e68129ec8

I have a hard time reproducing this and since the one case I just solved it for is confidential I can’t share an example yet.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

3reactions
igauravsehrawatcommented, Oct 25, 2017

@pbogdan03 Yes, you gotta use v0.8.0.

3reactions
AndreasZeisercommented, Sep 1, 2017

I ran into this issue today and can confirm that the fix https://github.com/jtillmann/pdfkit/commit/80868c23b946bc98775ee38c49eb741e68129ec8 works.

Here is an example which shows the issue:

const text = 'hello line\nbreak';
const width = doc.widthOfString('hello line');
doc.text(text, { width: width - 1 });

Output of the code is:

line
break

Expected output:

hello
line
break
Read more comments on GitHub >

github_iconTop Results From Across the Web

General decorator to wrap try except in python? - Stack Overflow
I understand it's a bad policy to swallow exceptions, but I'd rather prefer they to be printed and analysed later, than to actually...
Read more >
Wrapping Text With Regular Expressions - TextMate
I have been asked “how to wrap text” a handful of times in the last ... So this part will match a consecutive...
Read more >
Using character escapes in markup and CSS - W3C
Character escapes are a way of writing a character in markup using only ASCII code points. They are useful if you are unable...
Read more >
Call him the foil guy: Man swallows pill and wrapper, saved in ...
The lucky patient, Mohammad Ibrahim who runs a medical store in Shivaji Nagar, had accidently swallowed a paracetamol tablet along with its foil ......
Read more >
A Descriptive Review of Laryngeal Vestibule Closure - NCBI
LVC is the first line of defense for preventing material from penetrating the airway during swallowing and is distinct from true and false ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found