定制 mralston/tailpdf 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mralston/tailpdf

最新稳定版本:v1.2.1

Composer 安装命令:

composer require mralston/tailpdf

包简介

Laravel friendly wrapper for TailPDF.

README 文档

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.

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-10