Download the PHP package khmer-pdf/laravel-kh-pdf without Composer

On this page you can find all versions of the php package khmer-pdf/laravel-kh-pdf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-kh-pdf

laravel-kh-pdf

Latest Stable Version Total Downloads License

Laravel PDF with Khmer Font Support using mPDF.

Laravel Khmer PDF

Laravel Khmer PDF is a package designed to simplify PDF generation in Laravel with built-in support for Khmer fonts. It integrates seamlessly with mPDF to create professional-looking PDFs.

Installation

Install the package via Composer:

Publish the configuration file:

This will create a config/khPdf.php file where you can customize font settings and mPDF configurations.

Usage

Basic PDF Generation

Use the PdfKh facade to generate PDFs:

Methods

The trait provides the following methods:

Method Description Example
loadHtml($html) Sets the HTML content for the PDF. PdfKh::loadHtml(view('pdf.template')->render());
download($filename) Prompts the browser to download the generated PDF. PdfKh::download('file.pdf');
stream($filename) Displays the PDF directly in the browser. PdfKh::stream('file.pdf');
save($path, $disk) Saves the PDF to the specified storage disk. PdfKh::save('pdfs/report.pdf', 'public');
addMPdfConfig($config) Adds custom mPDF configuration settings. PdfKh::addMPdfConfig(['mode' => 'utf-8', 'format' => 'A4-L']);
watermarkText($text, $opacity, $font, $size, $angle, $color, $config) Adds a text watermark to the PDF. PdfKh::watermarkText('Confidential', 0.2, 'khmeros', 100, 45, '#FF0000', []);
watermarkImage($path, $size, $position, $opacity, $behindContent, $config) Adds an image watermark to the PDF. PdfKh::watermarkImage('path/to/image.png', 'p', 'p', 1, false, []);
writeBarcode($code, $horizontal, $vertical, $showIsbn, $size, $border) Writes a barcode in the PDF. PdfKh::writeBarcode('123456789', 10, 10, true, 1, true);

Examples

template.blade.php

Adding custom mPDF Config

You can configure mPDF settings using the addMPdfConfig method:

Saving a PDF

Streaming a PDF

Adding a Text Watermark

Adding an Image Watermark

Adding a Barcode

Configuration

The khPdf.php config file allows you to adjust font paths, default styles, and mPDF options.

Example:

License

This package is open-source software licensed under the MIT license.

Contributions

Contributions are welcome! Feel free to submit pull requests or issues on the GitHub repository.


All versions of laravel-kh-pdf with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
mpdf/mpdf Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package khmer-pdf/laravel-kh-pdf contains the following files

Loading the files please wait ....