Native Shell
Native Shell은 모든 플랫폼의 앱 안에서 만들어지는 AI UI입니다
Papercut은 Blade 또는 PHP에서 PDF·Word·HTML을 생성하고 페이지 구분이 정상 작동합니다
Papercut builds PDFs, Word files and HTML from Blade or plain PHP, with page breaks that just work. Here's a transcript as a Blade view: And a route that sends it to the browser...
개발 도구PHP · HTMLGitHub @One-Learning-Community온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
Blade components that compile to a real page-aware PDF layout engine for modern PHP. No browser, no HTML.
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗Page-aware PDF, Word, and HTML for modern PHP.
Write documents as Blade views, or build them with a fluent PHP API. Papercut lays them out page by page: table headers repeat, rows aren't cut in half, headings stay with what follows them, and Page {page} of {total} is one tag. It's pure PHP, with PDFs written by Denis Skripchenko's php-pdf (see Built on), so there's no headless Chrome, wkhtmltopdf or Node on your server. The same template also exports to HTML, and to Word.
Templates use a small set of <x-doc::*> tags instead of HTML and CSS. That's what keeps pagination predictable, and it makes mistakes loud: a typo in an attribute is an error that names the tag, not a silently wrong page. HTML you already have, such as rich text from an editor, comes in through <x-doc::markup>.
Documentation · Guide · Laravel · Recipes · Reference · Examples
Status: 0.9, before 1.0. Until 1.0 a minor version may change the API; patch versions won't. See Status below.
<x-doc::document title="Transcript">
<x-doc::page size="a4" margin="20mm">
<x-doc::column gap="8pt">
<x-doc::h1>{{ $student }}</x-doc::h1>
<x-doc::table columns="3fr 25mm 20mm">
<x-doc::thead><x-doc::th>Course</x-doc::th><x-doc::th>Credits</x-doc::th><x-doc::th>Grade</x-doc::th></x-doc::thead>
@foreach ($courses as $c)
<x-doc::tr><x-doc::td>{{ $c->title }}</x-doc::td><x-doc::td>{{ $c->credits }}</x-doc::td><x-doc::td align="right">{{ $c->grade }}</x-doc::td></x-doc::tr>
@endforeach
</x-doc::table>
</x-doc::column>
<x-slot:footer><x-doc::page-number format="Page {page} of {total}" align="center" /></x-slot:footer>
</x-doc::page>
</x-doc::document>
return Papercut::view('pdf.transcript', compact('student', 'courses'))->pdf()->download('transcript.pdf');
$invoice = Papercut::view('pdf.invoice', compact('invoice'));
return $invoice->pdf()->download('invoice.pdf'); // PDF
return $invoice->html(); // full HTML page
// {!! $invoice->html() !!} // fragment inside another Blade view
return $invoice->docx()->download('invoice.docx'); // Word, with papercut/docx installed
// Attach to a mailable or notification; it renders when attached.
public function attachments(): array
{
return [Papercut::view('pdf.invoice', ['invoice' => $this->invoice])->pdf()->attachment('invoice.pdf')];
}
// Store on any disk, for example from a queued job.
Papercut::view('pdf.report', ['report' => $report])->pdf()->store("reports/{$report->id}.pdf", 's3');
// Download from a Livewire or Filament action.
return Papercut::view('pdf.invoice', ['invoice' => $invoice])->pdf()->streamDownload('invoice.pdf');
Preview routes render each document with sample data at a fixed URL while you work on it. The recipes cover queues, S3, mail, Livewire, Filament and SVG charts.
gap, grow, justify, align, spacers.Page {page} of {total}), bookmarks built from headings, and a table of contents with page numbers, dot leaders and links.ext-gd), SVG drawn as vectors, and QR codes, plain or styled.phiki/phiki package.<x-doc::markup> turns an HTML fragment or plain text (say, from a rich text editor) into Papercut nodes, and reports anything it couldn't convert.papercut/docx, which writes real Word headings, lists, tables and a table of contents field.<x-doc::callout type="warning">).<x-doc::*> tags (see examples/laravel/views/components).<x-doc::*> component builds a node of the core engine (Papercut\Row, Papercut\Table, ...) and,
instead of emitting HTML, returns a short opaque marker string that stands in for that node in a
per-render registry.dskripchenko/php-pdf.HTML and Word exports walk the same node tree instead of the page layout, so they keep the document's structure (headings, lists, tables) for a browser or for Word to flow.
Papercut stands on two libraries by Denis Skripchenko, and wouldn't exist without them.
dskripchenko/php-pdf writes every PDF Papercut makes. Papercut decides where things go on the page; php-pdf turns
that into a PDF. It parses, subsets and embeds the fonts and applies their kerning, embeds the images, draws SVG,
encodes QR codes, encrypts, and reads existing PDFs for page templates. It can also sign and merge the result.
When Papercut needed more, such as even-odd fills in SVG and faster font loading, the maintainer added it upstream.dskripchenko/php-docx writes Papercut's Word files.Both are pure PHP and MIT licensed. If Papercut is useful to you, they deserve a star too.
papercut/core is framework-agnostic. Build the same documents with a fluent, immutable PHP API; see
packages/core and the runnable scripts in examples/core.
| Blade | Plain PHP | |
|---|---|---|
| Invoice | examples/laravel/views/invoice.blade.php | examples/core/invoice.php |
| Transcript | examples/laravel/views/transcript.blade.php | examples/core/transcript.php |
| Report | examples/laravel/views/report.blade.php | examples/core/report.php |
| Integration guide (mixed orientation, code blocks) | examples/laravel/views/guide.blade.php | examples/core/documents/guide.php |
| Certificate (fills in a PDF template; PDF only) | examples/laravel/views/certificate.blade.php | examples/core/documents/certificate.php |
Render the Blade examples with php examples/laravel/render.php (after cd packages/laravel && composer install).
The guide lives at one-learning-community.github.io/papercut (source in site/). Package READMEs: packages/core, packages/laravel and packages/docx.
0.9, before 1.0. Until 1.0 a minor version may change the API; patch versions won't. Versions and compatibility says what the promise covers. Word, LibreOffice and Google Docs lay out a Word file themselves, so its page breaks can differ from the PDF's. No performance or compatibility benchmarks have been
published; don't assume any. Requires PHP 8.4+, and Laravel 12 or 13 for papercut/laravel (CI tests against both).
Not supported yet: HarfBuzz shaping (the backend exposes no glyph-level drawing API; its built-in shaping covers kerning and ligatures within runs), right-to-left and bidirectional paragraph layout, hyphenation, Knuth-Plass line breaking, fillable form fields (AcroForms) and PDF/A. Filling in an existing PDF works through page templates. Signing and merging aren't built in, but php-pdf can do both to a Papercut PDF; see Passwords, signatures and merging.
LICENSE). Third-party notices: NOTICE.md.packages/core/resources/fonts/Inter/LICENSE.txt).packages/core/resources/fonts/Cousine/OFL.txt).dskripchenko/php-pdf: MIT.dskripchenko/php-docx: MIT.| Knowledge base article (HTML from a rich text editor) | examples/laravel/views/article.blade.php | examples/core/documents/article.php |
| Academic paper (two-column body, full-width title and abstract) | examples/laravel/views/paper.blade.php | examples/core/documents/paper.php |
| Form responses (decorators) | examples/laravel/views/responses.blade.php | examples/core/documents/responses.php |