Skip to content

Conversation

imjosh
Copy link

@imjosh imjosh commented Jan 22, 2025

Before/After
image

var doc = new jsPDF();
const textOptions = {
  maxWidth: 50,
  lineHeightFactor: 1.5
};

const paragraphs = [
  '1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tempor leo tellus, ut luctus mi aliquet a. Aenean id mauris volutpat, ullamcorper libero a, bibendum leo. Praesent ut enim sapien. Ut et felis interdum, molestie eros quis, facilisis odio.',
  '2. Cras risus ex, dapibus eu interdum in, placerat eu neque. Quisque venenatis tellus ac aliquam eleifend.',
  '3. Nunc ex urna, laoreet a gravida molestie, bibendum ac tellus. Nulla finibus sed lectus porta elementum. Suspendisse potenti. Sed quis purus at nunc sollicitudin posuere.',
];

let y = 15;
paragraphs.forEach(paragraph => {
  const height = doc.getTextDimensions(paragraph, textOptions).h;
  doc.text(paragraph, 15, y, textOptions);
  y += height + 5;
});

@imjosh imjosh marked this pull request as ready for review January 22, 2025 23:35
@imjosh
Copy link
Author

imjosh commented Jan 22, 2025

Related to #1933

@github-actions github-actions bot added the Stale label Apr 23, 2025
@github-actions github-actions bot closed this Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant