mralston/tailpdf

Laravel friendly wrapper for TailPDF.

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/mralston/tailpdf

v1.2.1 2026-01-11 22:32 UTC

This package is auto-updated.

Last update: 2026-01-12 10:47:33 UTC


README

Introduction

Laravel friendly wrapper for TailPDF. This package renders PDF files from HTML or Blade views and Tailwind CSS using the tailpdf.com service.

Installation

composer require mralston/tailpdf

Configuration

Register an account at https://tailpdf.com/ and generate an API key. Past this into your .env file.

TAILPDF_API_KEY=YOUR KEY HERE

Usage

Use the TailPdf facade to render your PDF.

<?php

// Render and return raw PDF content
$pdf = TailPdf::defaultTailwindConfigFile() // load tailwind.config.js
    ->html('<h1>Test</h1>') // supply HTML directly
    ->pdf() // render PDF
    ->raw(); // fetch raw PDF
    
// Return a streamed PDF response to the browser
return TailPdf::defaultTailwindConfigFile()
    ->html('<h1>Test</h1>')
    ->pdf()
    ->stream(); // stream can be returned from Laravel controller
    
// Return a streamed PDF download
return TailPdf::defaultTailwindConfigFile()
    ->html('<h1>Test</h1>')
    ->pdf()
    ->download('test.pdf');

// Save a PDF to disk
TailPdf::defaultTailwindConfigFile()
    ->html('<h1>Test</h1>')
    ->pdf()
    ->save('test.pdf');

// Render PDF from Laravel view
TailPdf::defaultTailwindConfigFile()
    ->view('my-view', [
        'var' => 'value',
    ])
    ->pdf()
    ->save('test.pdf');

// Render PDF asyncronously and upload to bucket (see https://tailpdf.com/docs/async-jobs/)
TailPdf::defaultTailwindConfigFile()
    ->html('<h1>Test</h1>')
    ->async(
        $bucketUrl, // Writeable bucket URL from AWS S3 / Cloudflare R2 / GCP Cloud Storage API
        $webhookUrl // URL where you receive status updates
    )
    ->pdf();

$status = TailPdf::pollStatus(); // Check status manually

Security Vulnerabilities

Please e-mail security vulnerabilities directly to me.

TailPDF Service

This package requires a TailPDF account. Please visit https://tailpdf.com/

The TailPDF service is copyright to Warm Energy Labs Limited. This package is not affiliated with Warm Energy Labs Limited.

Licence

PDF is open-sourced software licenced under the MIT license.