Documentation
Learn ngpdf
Start with the guide, keep the reference open while you build, and read the project pages to see how the engine works and where it is going.
Guide
- Getting startedInstall @ngpdf/core with ng add, write a PDF document as an Angular component and download it or get a Blob from the browser with PdfRenderer.
- Documents and pagesSet PDF metadata on pdf-document, pick page sizes and orientation on pdf-page, add page padding and start new pages with breakBefore.
- Layout and stylingHow ngpdf lays out pdf-* elements with flexbox through Yoga, how to write styles and bindings, and which units, colors and borders work.
- Text and fontsWrite text with pdf-text, use the standard PDF fonts or your own with providePdfFonts, and learn how ngpdf falls back between fonts, wraps lines, hyphenates words, cuts text with max-lines and handles line height.
- TablesBuild tables with pdf-table, pdf-row and pdf-cell, size columns in points, fr, percent or to their content, merge cells with span and repeat header rows on each page.
- PaginationHow ngpdf breaks content into pages - pagination units, table rows and row views taller than a page, text that breaks between lines with orphans and widows, repeated table headers, breakBefore, breakAfter, keeping a view or table together and pdf-page-number formats.
- ImagesAdd PNG and JPEG images with pdf-image from a data URL, a URL, a Blob, an ArrayBuffer or a Uint8Array, and control their size with width, height and object-fit.
- Lines and shapesDraw charts, signature lines and other shapes with pdf-canvas, a box whose paint function draws paths with fills, strokes, dashes and transforms.
- Components in documentsSplit a PDF document into your own Angular components and use pipes, signals, dependency injection and locales inside it, as in any template.
- Server renderingRender a document to PDF bytes in Node with renderToBuffer from @ngpdf/core/server - in a plain script or an Angular SSR route, with no DOM - and how images and fonts are fetched on the server.
Reference
- ElementsReference for the thirteen pdf-* elements of @ngpdf/core, with every input, its type, its default value and what it does in the rendered PDF.
- Rendering APIReference for PdfRenderer, renderToBlob, downloadPdf, pdfResource, PdfDownload, the PdfViewer preview and VERSION in @ngpdf/core - signatures, option types, render lifecycle, errors and dev-mode warnings.
- Style propertiesEvery CSS property ngpdf reads, with its accepted values, units, defaults and inheritance, plus the properties it ignores and the values that throw.
Project
- How it worksThe ngpdf pipeline from Angular renderer to node tree, styles, Yoga layout, pagination, display list and pdfkit, plus the lazy engine and bundle size.
- SecurityWhat ngpdf does about security - bounded parsing, no PDF scripts or actions, how images are fetched, how to report a vulnerability and supported versions.
- Limitations and roadmapWhat ngpdf does not do yet, from fonts and links to tables and images, and what is planned next for @ngpdf/core.
- ContributingHow to contribute to ngpdf - the Docker dev script, writing tests first, the checks to run, changesets, Conventional Commits and code review.