pdflib-syntax-text

Draw text on pdf-lib PDF pages with bottom-left coordinate handling and font measurement.

1|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/OpenAEC-Foundation/pdf-lib-Claude-Skill-Package --skill pdflib-syntax-text
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pdflib-syntax-text
Source: https://github.com/OpenAEC-Foundation/pdf-lib-Claude-Skill-Package/tree/main/skills/source/pdflib-syntax/pdflib-syntax-text
Command: npx skills add https://github.com/OpenAEC-Foundation/pdf-lib-Claude-Skill-Package --skill pdflib-syntax-text

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill ensures correct text placement in PDFs created with pdf-lib by emphasizing the bottom-left origin and providing text measurement utilities.

Core Features & Use Cases

  • Draw text on PDF pages with full option support (x, y, font, size, color, opacity, rotate, xSkew, ySkew, lineHeight, maxWidth, wordBreaks).
  • Measure and layout text accurately using widthOfTextAtSize, heightAtSize, and sizeAtHeight, enabling precise centering, right-alignment, and wrapping.
  • Reusable patterns and defaults via page-level methods (setFont, setFontSize, setFontColor, setLineHeight) for consistent styling.

Quick Start

Embed a font, create a page, and use page.drawText with proper x and y coordinates based on the page height to place text correctly.

Frequently Asked Questions about pdflib-syntax-text

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I position text correctly on a PDF page using pdf-lib?

To position text correctly in pdf-lib, calculate the y coordinate based on the page height, since the PDF coordinate system originates from the bottom-left. This Skill provides patterns for manual text placement using drawText with accurate x and y values.

Can I measure text width and height in pdf-lib for alignment?

You can measure text in pdf-lib using utilities like widthOfTextAtSize, heightAtSize, and sizeAtHeight. These functions enable precise centering, right-alignment, and wrapping calculations by returning exact text dimensions at a given font size.

Does pdf-lib support multiline text wrapping and custom line height?

pdf-lib supports multiline text wrapping and custom line height through drawText options like lineHeight, maxWidth, and wordBreaks. This allows you to render multiline blocks of text that automatically wrap within a defined width constraint.

Why does my text appear upside down or in the wrong position in pdf-lib?

Text appears upside down or misplaced in pdf-lib when the bottom-left coordinate origin is not accounted for. You must adjust the y coordinate relative to the page height to ensure correct manual text placement on the PDF page.

Do I need to embed a font before drawing text on a PDF page?

You need to embed a custom font before drawing text on a PDF page in pdf-lib. This Skill enforces using embedded fonts to ensure accurate text measurement and rendering across different platforms and environments.

What's the best way to set consistent font styling across multiple PDF pages?

The best way to maintain consistent font styling across multiple PDF pages is using page-default methods like setFont, setFontSize, setFontColor, and setLineHeight. These reusable patterns provide default styling for all subsequent drawText operations.