Lightweight native rendering capabilities for PDF, HTML, Code, Text, Markdown, and SVG.
FastPreview provides high-speed content rasterization for Java applications. It delivers off-heap pixel buffers directly to FastImage, bypassing the overhead of traditional UI frameworks.
// Quick Start — Render a PDF page to FastImage
import fastpreview.api.FastPreview;
import fastpreview.api.PreviewRequest;
import fastpreview.api.PreviewResult;
public class Demo {
public static void main(String[] args) {
FastPreview api = new FastPreview();
PreviewRequest request = new PreviewRequest(new File("document.pdf"), 800, 600);
PreviewResult result = api.render(request);
if (result.isSuccess()) {
System.out.println("Rendered in " + (result.getRenderTimeNanos() / 1_000_000.0) + " ms");
}
}
}- Key Features
- Architecture
- Installation
- Try the Demo
- Backends
- Platform Support
- Building from Source
- License
- Related Projects
- 🚀 Native Performance — Direct integration with PDFium, WebView2, and Skia.
- ⚡ Zero-Copy — Off-heap pixel buffers delivered directly to FastImage.
- 📦 Modular Backends — Pluggable support for PDF, HTML, Markdown, and more.
- 🎯 Deterministic — Predictable rendering times for batch processing.
FastPreview follows a strict pipeline:
Content → Layout → Rasterization → PixelBuffer → FastImage
For more details, see ARCHITECTURE.md.
FastJava modules require two dependencies: the module itself, and FastCore.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- 1. FastPreview Module -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastpreview</artifactId>
<version>0.1.0</version>
</dependency>
<!-- 2. FastCore (Required for native loading) -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastcore</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:fastpreview:0.1.0'
implementation 'com.github.andrestubbe:fastcore:0.1.0'
}- Clone this repository
- Run
run-demo.bat - Or navigate to
examples/DemoPDFand runmvn exec:java
| Content Type | Backend | Status |
|---|---|---|
| PDFium | 🚧 Integrating | |
| HTML | WebView2 | 🚧 Integrating |
| Code | Syntax + FastTheme | ✅ Skeleton |
| Text | DirectWrite | 🚧 Planned |
| Markdown | Custom AST Renderer | 🚧 Planned |
| SVG | Skia | 🚧 Planned |
| Platform | Status |
|---|---|
| Windows 10/11 (x64) | ✅ Fully Supported |
| Linux | 🚧 Planned |
| macOS | 🚧 Planned |
For detailed instructions on compiling the C++ JNI code and building the Maven FatJAR, see COMPILE.md.
MIT License — See LICENSE file for details.
- FastImage — High-performance image processing
- FastCore — Native Library Loader for Java
- FastTheme — Unified styling and colors
Made with ⚡ by Andre Stubbe