PDF Engine
Overview of PNPDF, PrintNow's custom PDF generation library built for print production workflows.
PNPDF is PrintNow's custom PDF generation library, purpose-built to replace the third-party PdfSharp 1.35 dependency. It is a write-only library designed for professional print production — generating press-ready PDFs with full CMYK support, spot colors, ICC profiles, and PDF/X-4 compliance. PNPDF has zero external dependencies, targets .NET Standard 2.0, and integrates seamlessly across the PrintNow platform.
Every PDF that PrintNow generates — customer proofs, merged order files, single-page exports, and print-ready output — flows through PNPDF.
Why PNPDF Was Built
PdfSharp 1.35 served as PrintNow's PDF library for years, but it lacked critical features for professional print production:
- No native CMYK color space support
- No spot color or Pantone support
- No PDF/X-4 compliance for press-ready output
- No ICC profile embedding
- No font subsetting (embedded full fonts, inflating file sizes)
- No transparency blend modes beyond basic opacity
- Limited to PDF 1.4 output
PNPDF was built as a drop-in API replacement with matching class names and method signatures, while adding the advanced features print production demands.
Capabilities
Color Management
| Feature | Description |
|---|---|
| RGB colors | Standard RGB color space with 0-255 or 0.0-1.0 value ranges. |
| CMYK colors | Native DeviceCMYK color space for print-accurate color output. |
| Grayscale | DeviceGray color space for monochrome output. |
| Spot colors | Named separation colors (e.g., Pantone) with tint support and CMYK/RGB alternates. |
| ICC profiles | Embed ICC profiles for color-managed workflows. Built-in profiles include FOGRA39, FOGRA51, GRACoL, SWOP, and Japan Color. |
| Rich black | Utilities for standard rich black formulations and ink coverage limits. |
Graphics and Drawing
| Feature | Description |
|---|---|
| Shapes | Rectangles, ellipses, arcs, pies, lines, and complex paths with Bezier curves. |
| Gradients | Linear and radial gradients with multi-stop support. |
| Patterns | Tiling patterns with rotation and scale transformations. |
| Transparency | Independent fill and stroke opacity with 16 blend modes (Multiply, Screen, Overlay, etc.). |
| Clipping | Clipping paths with even-odd and winding fill modes. |
| Transformations | Translate, rotate, scale, and custom matrix transforms with save/restore state. |
| Overprint | Separate fill and stroke overprint control for press-accurate ink behavior. |
Text and Fonts
| Feature | Description |
|---|---|
| Font formats | TrueType (.ttf) and CFF/OpenType (.otf) with automatic format detection. |
| Font subsetting | Embeds only the glyphs used in the document, significantly reducing file size. |
| Font styles | Regular, Bold, Italic, BoldItalic, Underline, and Strikeout with combinations. |
| Text alignment | Nine alignment positions (TopLeft, Center, BottomRight, etc.). |
| Text measurement | Accurate width and height measurement for layout calculations. |
| Text to path | Convert text to vector outlines for effects and clipping. |
Images
| Feature | Description |
|---|---|
| JPEG | RGB and CMYK JPEG with passthrough (no re-encoding). ICC profile preservation. |
| PNG | RGB, RGBA (alpha extracted as soft mask), Grayscale, and Indexed color. ICC profile preservation. |
| Deduplication | Images embedded once and referenced by content hash, even when drawn multiple times. |
| PDF templates | Import existing PDF pages as templates via XPdfForm for overlays and backgrounds. |
Print Production
| Feature | Description |
|---|---|
| PDF/X-4 | Full compliance with validation. Output intent embedding and XMP metadata generation. |
| Page boxes | MediaBox, TrimBox, BleedBox, ArtBox, and CropBox for print preparation. |
| Print marks | Crop marks, registration marks, and color bars. |
| PDF versions | Output as PDF 1.0 through 2.0. Object streams and cross-reference streams for PDF 1.5+. |
| Compression | FlateDecode compression with optional object streams for compact file sizes. |
Dieline Spot Plates
For Print CAD products, the print-ready PDF carries the dieline as separate spot-color plates, one per line type. A converter can then image cuts, creases, seals, windows and zippers separately.
- One plate per line type. Each line type prints on a spot plate named by its Spot Name in Dieline Colors. This includes the flexible packaging types Seal, Window, Zipper, Valve and Tear Notch.
- Custom styles. A custom line style drawn in Print CAD gets its own plate only after it is mapped in Dieline Colors. Custom styles are drawn as lines only (stroke, no fill). Unmapped custom styles are left out of the PDF.
- Exact names. Spot names are kept exactly as typed, including spaces, accents and symbols, so they match the converter's separation names.
- Only the chosen variant. Lines in a conditional group that is off for the customer's options (for example, no window) don't appear on any plate.
- Same output everywhere. Files from the remote merge service have the same plates as files generated in the store.
How It Fits in the Platform
PNPDF sits at the foundation of PrintNow's PDF pipeline:
- PdfManager (Data layer) — the rendering engine that converts product designs into PDF pages. It processes text, images, and drawing spaces, calling PNPDF to compose the final output.
- PdfLibraryCompat — an abstraction layer between PdfManager and PNPDF, providing a stable interface during the migration from PdfSharp.
- MergeManager — the orchestration layer that coordinates order and product merges, calling PdfManager for each product and assembling the results.
Product Design (JSON)
↓
PdfManager (rendering engine)
↓
PdfLibraryCompat (abstraction)
↓
PNPDF (PDF generation)
↓
PDF file → Azure Blob Storage or Local File SystemEvery product ordered through the storefront, remerged by an admin, or triggered via the Enterprise API flows through this pipeline.
Related Pages
- Merge Engine — how PDFs are assembled into final order output
- Admin Remerge — trigger and monitor PDF remerges from the admin
- Orders — order management where merged PDFs are accessed
- Products — product configuration that feeds the PDF pipeline