Skip to content

rasteiner/pdf-lib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fork of https://github.com/Hopding/pdf-lib

Includes updates to the build process.

Features

  • PDFDocument.drawText() returns the number of lines that are drawn after word wrapping. Use it for text flow:
    let startY = 250;
    
    const text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
    const textWidth = 100;
    const lineHeight = 20;
    startY -= lineHeight * pdfDoc.drawText(text, {
      x: 50,
      y: startY,
      size: 16,
      width: textWidth,
      lineHeight,
    });
    
    const text2 = 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.';
    startY -= lineHeight * pdfDoc.drawText(text2, {
      x: 50,
      y: startY,
      size: 12,
      width: textWidth,
      lineHeight,
    });

Compile

bun install 
bun run build 
bun run build:types

About

Create and modify PDF documents in any JavaScript environment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%