PDF Viewer 1.0.0 · changelog

PDF Viewer 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-12

Added

  • Importer that turns every .pdf file in the project into a PdfAsset, with file size and page count shown in the Inspector. The scripting define LUANROBS_PDF_IMPORTER_OPT_IN makes the importer opt-in per file when another package also imports .pdf files.
  • Windows Editor: page preview in the Inspector when a .pdf is selected, with previous and next buttons.
  • PdfAsset.Open() and PdfAsset.Open(PdfViewerOptions) to open a PDF with one call. PdfAsset.Open() can be picked directly in a Button's On Click () list or any other UnityEvent, with no component and no script.
  • Default viewer options per PDF: Override Default Options in the import settings of each .pdf, stored with the asset and used whenever it is opened without explicit options. PdfAsset.HasDefaultOptions and PdfAsset.DefaultOptions expose them. Explicit options passed to an open call replace them completely.
  • Native full-screen PDF viewer for Android, built on the platform PdfRenderer. Shipped as Java source and compiled by Gradle at build time. The library supports API 23 and newer; Unity 6000.3 raises an app's minimum to API 25 on its own.
  • In-game full-screen PDF viewer for Windows 10/11 x64 (Standalone player and the Editor's Play mode), built on the PDF engine that is part of Windows (Windows.Data.Pdf). Mouse, keyboard and touch input, shown on top of the game with no Canvas or EventSystem needed. Rendering goes through one small native DLL whose C++ source is included in Native~/Windows.
  • PdfViewerOptions: title, start page, vertical or horizontal scrolling, night mode, toolbar, page indicator, zoom and maximum zoom. The same options apply on Android and Windows.
  • PdfViewer static API to open a PDF from a PdfAsset, raw bytes, an absolute file path, StreamingAssets or a URL, and to close the viewer.
  • PdfViewer events: Opened, PageChanged, Closed and Error, raised on the Unity main thread. Each accepted open ends with exactly one Closed or one Error. On Windows the events arrive live; on Android they arrive when the player returns to the game.
  • PdfOpenButton component (luanrobs > PDF Open Button) to open a PDF from a uGUI Button or any UnityEvent without code, with viewer options per button and a warning when no PDF is assigned.
  • Fallback for macOS, Linux and the Editor outside Play mode that opens the PDF in the system PDF app.
  • Page rendering API: PdfDocument and PdfPageRequest. Load a PDF from a PdfAsset, bytes, a file or StreamingAssets without showing the viewer, read the page count and page sizes, and render any page into a Texture2D in the background, optionally in night mode. PdfDocument.IsSupported tells whether the platform supports it. Android and Windows (player and Editor, in Play mode and in Edit mode).
  • PdfPageImage component (luanrobs > PDF Page Image) to show one page of a PDF in a uGUI RawImage without code, with page, resolution and night mode, and NextPage and PreviousPage for any UnityEvent. A new page, resolution or night mode keeps the previous page on screen until the new one is ready; a new PDF clears the image until its page is ready. The component runs in Play mode only: outside Play mode it loads nothing and Refresh() does nothing.
  • On Windows, the pixel buffer of a rendered page is kept for the next page only when it is 16 MB or smaller (a 2048 x 2048 page). The buffer of a larger page, up to 64 MB at 4096 x 4096, is released as soon as its texture exists, so one large page does not hold that memory for as long as its document stays open.
  • PdfDocument.MaxTextureSize and the Windows renderer use the same limit, 4096 pixels, when the graphics device reports no maximum texture size, so a size taken from GetRenderSize is always accepted by RenderPage.
  • Demo sample with eight uGUI scenes (menu, Button On Click, no-code button, one line of code, viewer options, events and resume, other sources, page to texture) and three sample PDFs with embedded fonts. The sample needs the uGUI package (com.unity.ugui); in a project without it the sample scripts are skipped by the compiler instead of stopping the project from compiling.
  • Manual with API reference, the Windows viewer, memory notes, limitations, test coverage and troubleshooting, as Documentation~/index.md and as Documentation~/PDF Viewer Manual.pdf.
  • Third-Party Notices.txt, which lists the fonts embedded in the PDFs and the Microsoft components compiled into the Windows DLL (the Visual C++ runtime and C++/WinRT).
  • 506 EditMode tests.

Tested

  • 506 EditMode tests pass on Unity 6000.3.12f1 in the development project, and in two new projects on Unity 6000.0.84f1 and 6000.3.12f1 that installed the package from its .tgz file. No other Unity release was tested.
  • In a new Unity 6000.3.12f1 project without the com.unity.ugui package, with the Demo sample imported, the project compiled with the sample scripts skipped and the 472 EditMode tests that do not need uGUI passed. No scene, Play mode or player was run there.
  • Windows 11 x64: three Mono players run without sending input (Unity 6000.3.12f1 with Direct3D 12 and the Input System package, Unity 6000.0.84f1 with Direct3D 11 and the legacy Input Manager, and Unity 6000.3.12f1 in a new project) passed an automated check of the viewer, PdfDocument, night mode, the runtime object names and the eight demo scenes. In the Editor, PDF Page Image ran in Play mode and demo scene 07 ran in two Play sessions in a row with Domain Reload disabled.
  • Android emulators: API 36 (build made by Unity 6000.3) and API 29, 26, 24 and 23 (build made by Unity 6000.0). The automated check passed on all five. The viewer events, page rendering (also with rotated and cropped pages) and the two Android fixes were checked: no repeated page report after Android recreates the viewer, and no skipped page number when the screen stalls during a fling. The stall was simulated, because rotating an emulator during a fling never caused the skip.
  • Samsung Galaxy S23 (Android 16): one automated check, and scrolling, flings and the scene 07 buttons with taps and swipes sent through adb. Pinch zoom and rotating the phone while reading were also tried by hand and worked (not logged or measured).
  • Not run for this version: Windows 10, mouse, keyboard and touch input in the Windows players, PDF Page Image in a player or on Android, and PdfDocument.Load(byte[]), LoadFile and LoadStreamingAsset on Android.
  • The manual lists exactly what was run and what was not.

Known limitations

  • Built-in viewers exist for Android and Windows only. macOS and Linux open the system PDF app and were not tested. iOS is not supported in this version; a native iOS viewer is planned.
  • The Windows viewer needs Windows 10 or 11, 64-bit, and was tested on Windows 11 only. It has no gamepad control. Touch input in it was not tested.
  • Only one viewer can be open at a time. An open call made while a viewer is open is ignored and raises Error.
  • Page rendering to textures works on Android and Windows only. Page textures have no mipmaps, cannot be read back with GetPixels and are at most 4096 pixels per side. At most two page requests of a document are rendered at a time, with no priorities. That limit and the number of textures created per frame count per document, and every PDF Page Image has a document of its own, so many large ones on one screen render at once. Rendered pages have no text selection and no links.
  • Password-protected PDFs are not supported.
  • No text selection, no clickable links and no search in the viewer, on Android and on Windows: pages are shown as images.
  • On Android 6.0 (API 23) the system renderer does not draw text whose font is not embedded in the PDF. The same file is rendered correctly on API 24 and newer.
  • On Android 6.0 to 7.1 (API 23 to 25) the native viewer draws a page that is stored rotated, or whose page box does not start at the origin, without the rotation or the cropping. This was seen on API 23 and 24; API 25 was not run. Page rendering with PdfDocument draws such pages correctly there.
  • On Android, one repeated PageChanged for the same page was seen once in 42 synthetic trials on API 26. The cause was not determined.
  • On Android, pressing HOME and then starting the game again from its launcher icon closes the viewer. Closed is raised with the page that was on screen.
  • On Android, OpenStreamingAsset reads from the APK/AAB assets and does not support the legacy Split Application Binary (OBB) layout.