Papercut
Guide
Laravel
Reference
Examples
Changelog
GitHub
Guide
Laravel
Reference
Examples
Changelog
GitHub
  • Laravel

    • Laravel
    • Configuration
    • Preview routes

Preview routes

Getting a layout right means rendering it over and over. Preview routes give each document a fixed URL that renders it with sample data, so you can just refresh the browser to see your latest change.

Register each view along with a closure that returns its data. A service provider is a good place for this:

use Papercut\Laravel\Facades\Papercut;

Papercut::preview('pdf.invoice', fn () => ['invoice' => Invoice::factory()->make()]);

Then set PAPERCUT_PREVIEW=true in your .env file.

RouteWhat it shows
GET /_papercuta list of the registered views
GET /_papercut/{view}one view, as a PDF in the browser
GET /_papercut/{view}?format=htmlthe same view as HTML

For safety, the routes only work in the local environment, whatever the setting says. To change the URL prefix, set preview.path.

Edit this page on GitHub
Last Updated: 10/21/26, 1:31 PM
Prev
Configuration