pdflib-syntax-images

Embed and draw PNG and JPG images in pdf-lib with aspect-ratio preservation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Embedding and drawing images in pdf-lib PDFs is error-prone when handling formats, coordinate systems, and aspect ratios. This Skill clarifies how to embed PNG and JPG images, preserve transparency when applicable, and render images precisely on pages.

Core Features & Use Cases

  • Embed PNG and JPG images using embedPng and embedJpg.
  • Draw images on pages with correct bottom-left coordinate system and aspect-ratio preservation using drawImage.
  • Embed and render pages from other PDFs as images for complex layouts and previews.

Quick Start

Embed a PNG or JPG with embedPng/embedJpg and draw it on a page with drawImage.

Frequently Asked Questions about pdflib-syntax-images

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

FAQPage Schema
How do I embed and draw PNG or JPG images in pdf-lib?

To embed and draw images in pdf-lib, load files using embedPng or embedJpg, then render them on a page with drawImage, ensuring correct bottom-left coordinate system placement and aspect-ratio preservation.

How do I preserve aspect ratio when scaling images in pdf-lib?

To preserve aspect ratio when scaling images in pdf-lib, apply the correct width and height values in the drawImage options, matching the original dimensions to prevent distortion during image embedding.

Can I embed pages from another PDF as images using pdf-lib?

Yes, you can embed pages from another PDF as images using pdf-lib by calling drawPage for embedded pages, enabling complex layouts and previews within your document workflow.

Why does my drawn image appear in the wrong position on the PDF page?

Your drawn image appears in the wrong position because pdf-lib uses a bottom-left coordinate system, requiring precise x and y values in drawImage options to place images accurately on the page.

Does pdf-lib support transparency when embedding PNG files?

Yes, pdf-lib supports PNG transparency when embedding files via embedPng, allowing you to preserve transparent backgrounds and render images precisely on pages without unwanted opaque fills.