PDF Maker 1.0.0 · changelog

PDF Maker changelog

All notable changes to this package are documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[1.0.0] - 2026-10-08

Added

  • PdfDocument: writes PDF 1.7 files in C#, to a byte[] (ToBytes), to a Stream (Save(Stream)) or to a file (Save(string)). No native plugin and no third-party library.
  • Pages: A3, A4, A5, Letter, Legal and custom sizes (PdfPageSize), portrait or landscape, margins (PdfMargins), and PdfUnit to convert millimetres, centimetres, inches and pixels to points.
  • Canvas (PdfCanvas): text at a position, lines, rectangles, rounded rectangles, ellipses, circles, arcs, polygons and bezier paths; fill and stroke colours with opacity; line width, caps, joins and dashes; clipping; SaveState and RestoreState; translate, rotate and scale.
  • Images (PdfImage): from a Texture2D (readable or not, with optional JPEG storage), from PNG bytes (decoded in C#), from JPEG bytes (stored unchanged) and from Color32 pixels. Transparency is kept as a soft mask.
  • PNG image data is inflated into a buffer that starts small and grows with the data, never beyond the size the image header describes. A damaged file that declares a large picture fails before that memory is allocated, and data beyond the picture is ignored.
  • PdfCapture.Screenshot and PdfCapture.RenderCamera to put the screen or a camera view on a page.
  • Fonts (PdfFont): the twelve standard fonts (Helvetica, Times and Courier in four styles each) with width tables for Latin text in the Windows-1252 character set, and TrueType fonts embedded from bytes or from a TextAsset, with a ToUnicode map so that text can be copied and searched. PdfFont.HasGlyph and PdfFont.CanDraw tell whether a font can draw a text. PdfDocument.SubsetFonts reduces an embedded font to the glyphs the document uses.
  • PdfFontAsset and the menu Assets > Create > luanrobs > PDF Maker > PDF Font Asset, which stores a .ttf file as an asset that can be referenced in the Inspector and is included in builds. The Inspector of the asset shows the font name, family, glyph count and size.
  • Layout layer on PdfDocument: AddHeading, AddParagraph (left, centre, right and justified), AddLink, AddBulletList, AddNumberedList, AddTable, AddImage, AddSpace, AddHorizontalLine, AddPageBreak and BeginKeepTogether / EndKeepTogether. Content flows onto new pages as needed. Styles are set with PdfTextStyle and PdfStyleSheet.
  • PdfCanvas.DrawTextBox and PdfCanvas.MeasureTextBox: wrapped, aligned text in a box.
  • Text breaking, shared by paragraphs, lists, table cells and text boxes: a line breaks after a run of spaces, after a hyphen inside a word and at a zero width space (U+200B). It never breaks after a hyphen that starts a word or follows a no-break space (a minus sign, as in -1250.00, or --force), or after a hyphen between two digits (as in 2026-10-09), so numbers and dates stay whole.
  • PdfTable: columns by weight, wrapping cells, header rows repeated on every page, borders, cell padding, striped rows, backgrounds per row and per cell, and alignment per column and per cell.
  • PdfDocument.Header and PdfDocument.Footer callbacks with PdfPageContext, called when the number of pages is known, for "Page X of Y". PdfPage.ShowHeaderAndFooter turns them off for a page.
  • Hyperlinks: PdfDocument.AddLink for text and PdfPage.AddLink for any area of a page.
  • Document properties (PdfMetadata): title, author, subject, keywords, creator, producer and creation date.
  • Flate compression through System.IO.Compression (PdfCompression: None, Fast, Optimal).
  • PdfDocument.Deterministic: the same calls give the same bytes on the same runtime (platform, Unity version and scripting backend), for tests and comparisons.
  • Building and saving a document on a worker thread. Only the calls that read Unity objects need the main thread.
  • Demo sample with six uGUI scenes: menu, hello world, report (table, drawn charts, camera render and screenshot), landscape certificate, invoice and Unicode text in an embedded font. Each of the five demo scenes saves its PDF to Application.persistentDataPath and opens it on a click, with PDF Viewer when that package is installed. Without PDF Viewer, on Android, iOS, tvOS, visionOS and WebGL the Open button shows where the file is instead, and the line at the bottom of the scene says so.
  • Manual with API reference, layout rules, limitations and troubleshooting.
  • EditMode tests.

Tested

  • Unity 6000.3.12f1 on Windows 11: 760 EditMode tests passed; Play mode entered three times in a row with Domain Reload disabled; a Windows player (Direct3D 12), built with Mono and again with IL2CPP and managed stripping at High, ran a test driver that loads the five demo scenes, calls Generate() on each component from code and builds an 11-page document with shapes, text, images, tables, lists, links, headers and footers. Every PDF from the tests and the demo was read with pypdf; their pages (pages 1, 250 and 500 for the 500-page file) were drawn with the PDF engine of Windows and inspected as images.
  • After the fixes that followed the independent review: the EditMode tests and the Editor run of the demo builders were repeated, and on 2026-10-09 both Windows players (Mono, and IL2CPP with managed stripping at High) were rebuilt and the test driver was run in them again; their PDFs were read with pypdf again.
  • Release QA on 2026-10-15, all after those fixes:
    • Clean projects: the package was installed from a .tgz archive into a new, empty project created with Unity 6000.3.12f1 and into one created with Unity 6000.0.84f1 (each with its default packages, plus uGUI and the Test Framework), and the Demo sample was imported. In both: 760 EditMode tests passed; the six sample scenes opened with no missing scripts; a Windows player (Mono) built with no errors or warnings and the test driver passed in it.
    • Play mode was entered three times in a row with Domain Reload disabled in Unity 6000.3.12f1, and the documents were again byte for byte the ones built in Edit mode.
    • Android (IL2CPP, managed stripping at High, ARM64 and x86-64): a Unity 6000.3.12f1 build (lowest API level 25) ran the test driver on emulators with Android 16 (API 36) and Android 7.1.1 (API 25), and a Unity 6000.0.84f1 build from the clean project (lowest API level 23) ran it on emulators with Android 7.0 (API 24) and Android 7.1.1 (API 25). All emulators were x86-64. The driver passed on each, with Roboto from the device as the embedded font.
    • Every PDF of these runs was read with pypdf in strict mode, with warnings treated as errors, and checked byte by byte against its cross-reference table.
  • Not run: WebGL, macOS, Linux, iOS, Windows 10, a physical Android device, ARM64 code on Android (the emulators ran the x86-64 code), Android API 23 and 26 to 35, the Input System, URP and HDRP, and any PDF viewer other than the engine of Windows. No button of the demo was clicked, and the PDF Viewer branch of the demo was compiled but not run.
  • After the fixes of a second review, on 2026-10-15: 768 EditMode tests passed in the development project (Unity 6000.3.12f1) and in new projects created with Unity 6000.3.12f1 and Unity 6000.0.84f1 with the package installed from a .tgz archive; in both new projects the six sample scenes opened with no missing scripts, a Mono Windows player built with no errors or warnings and the test driver passed in it; the Unity 6000.3.12f1 Android build passed again on the Android 16 (API 36) emulator. All their PDFs passed pypdf in strict mode and the byte-level cross-reference check. Also on 2026-10-15, on the final code in the development project (Unity 6000.3.12f1): the IL2CPP Windows player (managed stripping at High) was built and the test driver passed in it, its PDFs read with pypdf in strict mode, and Play mode was entered three times in a row with Domain Reload disabled with the documents byte for byte the ones built in Edit mode. Not repeated after these fixes: the Android runs on API 24 and 25.
  • An independent review (ten passes over the code and the documents) and a second review of the fixes were done before release; the fixes for their findings are part of this version and are covered by tests where a test was possible.
  • The manual lists what was run for this version in its "Tested on" table and in the section "What was tested and what was not". A row that says "not run yet" was not run.

Known limitations

  • Out of scope in this version: reading, editing or merging existing PDF files; forms; digital signatures; encryption; PDF/A; Arabic and Indic shaping, right-to-left and vertical text; kerning and ligatures; HTML or rich-text input; mixed fonts or styles inside one paragraph.
  • Fonts: OpenType fonts with CFF outlines, font collections (.ttc) and WOFF files are not supported, only TrueType outlines; the Symbol and ZapfDingbats standard fonts are not offered. Standard fonts are not embedded in the file, and some PDF viewers do not draw fonts that are not embedded. You are responsible for the license of the fonts you embed.
  • Images: interlaced PNG files are not supported; the EXIF orientation of a JPEG file is not applied.
  • Tables: no cells that span columns or rows, no images in cells.
  • A heading only checks that there is room for itself and two lines of body text; it is not tied to a table, an image or a KeepTogether paragraph after it, which can move to the next page and leave the heading behind.
  • A subset of an embedded font does not carry the name table. In the PDF engine of Windows, a subset of Courier New was drawn slightly lighter than the whole font; SubsetFonts = false embeds whole fonts.
  • No internal links, bookmarks or outlines. No gradients or patterns. Fills use the non-zero winding rule only.
  • The file is built as one byte array, so it cannot be larger than about 2 GB. Files of that size were not tried. Save does not stream: the first save needs about twice the size of the file in managed memory, and a save that fails (for example for lack of memory) cannot be repeated on the same document.
  • PdfCapture.Screenshot, PdfCapture.RenderCamera, and PdfImage.FromTexture for a texture that is not readable or with a jpegQuality above 0, destroy their scratch textures with Object.DestroyImmediate. Unity refuses that call in physics callbacks, animation events, rendering callbacks and OnValidate; called from there, Unity logs an error and the scratch textures are left behind. Call these methods from Update, a coroutine or a UI event.
  • Files are not tagged, so they are not accessible (PDF/UA) PDFs. Colours are RGB.
  • No automatic hyphenation. A soft hyphen (U+00AD) is drawn where it stands and is never a break point. A variable TrueType font is drawn in its default instance only.
  • Up to 64 table columns; pages of 3 to 14400 points on a side; images of up to 16384 pixels on a side.
  • PdfCapture.RenderCamera uses Camera.Render(). For a URP camera whose Render Type is Overlay, and when called while a scriptable render pipeline is rendering, the picture comes out black and no exception is thrown.
  • WebGL has no threads, so a document is built on the main thread there.