{"schemaVersion":"1.0","record":{"label":"Prawn","description":"Ruby library for programmatic PDF drawing, text layout and image placement.","aliases":[],"kind":"software","website":"https://prawnpdf.org/","overview":"Prawn is a Ruby library for generating PDF documents through code. It provides text rendering, vector drawing, image placement, navigation outlines and repeated page content. It is a document-generation building block rather than a complete reporting application or an HTML-to-PDF renderer.","license":"Matz's Ruby-style terms OR GPL-2.0 OR GPL-3.0","lifecycle":"active","example":false,"features":[{"name":"Code-driven PDF creation","status":"supported","detail":"Ruby APIs create text, vector graphics and repeated page content.","useCase":"Generate PDFs from application code","platforms":["Ruby","JRuby"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://prawnpdf.org/docs/prawn/2.5.0/","locator":"Capabilities, non-HTML scope, supported runtimes and release policy","retrievedAt":"2026-10-07T13:35:17Z","kind":"vendor"}]},{"name":"Rich HTML conversion","status":"unsupported","detail":"Limited inline text styling is not a general HTML/CSS renderer.","useCase":"Generate PDFs from application code","platforms":["Ruby","JRuby"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://prawnpdf.org/docs/prawn/2.5.0/","locator":"Capabilities, non-HTML scope, supported runtimes and release policy","retrievedAt":"2026-10-07T13:35:17Z","kind":"vendor"}]},{"name":"Text-box overflow handling","status":"limited","detail":"Truncation is the default; callers can inspect unprinted text or choose another overflow mode.","useCase":"Generate PDFs from application code","platforms":["Ruby","JRuby"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://prawnpdf.org/docs/prawn/2.5.0/Prawn/Text.html","locator":"Font coverage, formatted text and text_box overflow","retrievedAt":"2026-10-07T13:35:17Z","kind":"vendor"}]},{"name":"Raster image embedding","status":"limited","detail":"The core image API supports JPEG and PNG, with performance considerations for alpha-channel PNGs.","useCase":"Generate PDFs from application code","platforms":["Ruby","JRuby"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://prawnpdf.org/docs/prawn/2.5.0/Prawn/Images.html","locator":"JPEG/PNG support, positioning, fitting and alpha-channel costs","retrievedAt":"2026-10-07T13:35:17Z","kind":"vendor"}]}],"alternatives":[],"slug":"prawn","draftAlternatives":[{"targetSlug":"reportlab-toolkit","status":"limited","detail":"Can replace direct application-generated PDF layouts when moving the implementation to Ruby; ReportLab's Python APIs and higher-level layout objects must be rewritten.","useCase":"Generate PDFs from application code","platforms":["Ruby","JRuby"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://prawnpdf.org/docs/prawn/2.5.0/","locator":"Capabilities, non-HTML scope, supported runtimes and release policy","retrievedAt":"2026-10-07T13:35:17Z","kind":"vendor"},{"url":"https://docs.reportlab.com/reportlab/userguide/ch1_intro/","locator":"Python-based direct PDF generation and higher-level layout","retrievedAt":"2026-10-07T13:35:17Z","kind":"vendor"}]}],"evidence":[{"url":"https://prawnpdf.org/docs/prawn/2.5.0/","locator":"Capabilities, non-HTML scope, supported runtimes and release policy","retrievedAt":"2026-10-07T13:35:17Z","kind":"vendor"}],"document":{"version":1,"references":[{"url":"https://prawnpdf.org/docs/prawn/2.5.0/","locator":"Capabilities, non-HTML scope, supported runtimes and release policy","retrievedAt":"2026-10-07T13:35:17Z","id":"readme","title":"Prawn 2.5 documentation","kind":"vendor"},{"url":"https://prawnpdf.org/docs/prawn/2.5.0/Prawn/Text.html","locator":"Font coverage, formatted text and text_box overflow","retrievedAt":"2026-10-07T13:35:17Z","id":"text","title":"Text API","kind":"vendor"},{"url":"https://prawnpdf.org/docs/prawn/2.5.0/Prawn/Images.html","locator":"JPEG/PNG support, positioning, fitting and alpha-channel costs","retrievedAt":"2026-10-07T13:35:17Z","id":"images","title":"Image API","kind":"vendor"},{"url":"https://prawnpdf.org/docs/prawn/2.5.0/Prawn/Document/BoundingBox.html","locator":"Relative coordinates, calculated height and page movement","retrievedAt":"2026-10-07T13:35:17Z","id":"bounds","title":"Bounding boxes","kind":"vendor"},{"url":"https://github.com/prawnpdf/prawn/blob/master/LICENSE","locator":"Alternative terms and generated-output clause","retrievedAt":"2026-10-07T13:35:17Z","id":"license","title":"Prawn license","kind":"vendor"},{"url":"https://docs.reportlab.com/reportlab/userguide/ch1_intro/","locator":"Python-based direct PDF generation and higher-level layout","retrievedAt":"2026-10-07T13:35:17Z","id":"reportlab","title":"ReportLab introduction","kind":"vendor"}],"overviewCitations":["readme"],"licenseCitations":["license"],"sections":[{"id":"layout","heading":"Programmatic layout","paragraphs":[{"id":"layout-detail","content":[{"text":"Prawn exposes both positioned drawing and text-layout operations. Bounding boxes supply local coordinates, with fixed or calculated heights, and page movement can create another page when necessary. This approach lets an application encode repeatable document designs, but it also makes pagination and placement part of the program. The generated PDF is the output of that design logic, not a substitute for preserving the code that produced it."}],"citations":["bounds","text"]}]},{"id":"text","heading":"Text, fonts and overflow","paragraphs":[{"id":"text-detail","content":[{"text":"Text APIs accept UTF-8 strings, but built-in PDF fonts cover a much smaller character repertoire than Unicode. An external font must contain the required glyphs, and fallback fonts can be specified. Text boxes default to truncating excess content and return what was not printed. Shrinking to fit has a minimum font size, so it can still leave text unprinted. These behaviors make overflow checks important for variable-length names, descriptions or translated text."}],"citations":["text"]}]},{"id":"images","heading":"Image handling","paragraphs":[{"id":"images-detail","content":[{"text":"The core image method accepts JPEG and PNG files or readable image streams. Supplying a single dimension scales proportionally, while supplying both width and height can distort the image; fitting inside a rectangle preserves the aspect ratio. An explicitly positioned image does not move the text cursor. The documentation also warns that PNG alpha-channel processing can consume significant processor time and memory, which matters when generating image-heavy documents."}],"citations":["images"]}]},{"id":"maintenance","heading":"Runtime and licensing","paragraphs":[{"id":"maintenance-detail","content":[{"text":"Prawn supports maintained Ruby versions and matching JRuby implementations. Its release policy distinguishes stable APIs from experimental ones and warns that bug fixes can change behavior, so version numbers alone do not establish unchanged output. The license offers a choice of Ruby-style conditions, GPL version 2 or GPL version 3. Its output clause states that generated files do not automatically become subject to the library's copyright."}],"citations":["readme","license"]}]},{"id":"comparison","heading":"Substitution considerations","paragraphs":[{"id":"comparison-detail","content":[{"text":"Prawn can substitute for "},{"text":"ReportLab Toolkit","targetSlug":"reportlab-toolkit"},{"text":" in an application that generates PDFs from data and drawing commands, if implementing that logic in Ruby is acceptable. This involves rewriting Python code and any higher-level layout objects. Prawn's limited inline styling should not be mistaken for a browser rendering pipeline, and its drawing primitives do not by themselves provide a complete reporting designer."}],"citations":["reportlab","readme"]}]}]},"id":"Q621","revision":669,"updatedAt":"2026-10-13T00:12:42Z","sourceUrl":"https://substitutefor.net/entities/Q621?revision=669"}}