Download the PHP package xslain/html2media without Composer

On this page you can find all versions of the php package xslain/html2media. 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 html2media

🌟 Html2Media Livewire Component Documentation πŸ“„

Html2Media is a powerful Laravel Livewire package that allows you to generate PDFs, preview documents, and directly print content from your application. πŸš€


πŸ“Œ Overview

The Html2Media package provides flexible Livewire components for your Laravel applications, enabling:


✨ Features


πŸ”§ Installation

To install the package, simply run the following command:

After installation, publish the assets:

The Html2Media components will be automatically registered with Livewire.


πŸš€ Basic Usage

Method 1: Using the Livewire Component

You can use the Html2Media Livewire component directly in your Blade templates:

Method 2: Using the Button Component

For a simple button that triggers PDF generation:

Method 3: Creating Custom Livewire Components

Create your own Livewire component that uses the Html2Media trait:


βš™οΈ Configuration Methods

Here's how you can customize your Html2Media components!

1. πŸ“‚ filename()

Set the name of the generated PDF file. ✍️

Usage:


2. πŸ“„ pagebreak()

Define page break behavior. Customize how and where page breaks occur within the document. πŸ›‘

Usage:


3. πŸ”„ orientation()

Set the page orientation for the PDF, either portrait or landscape. πŸ–ΌοΈ

Usage:


4. πŸ“ format()

Define the format of the PDF, including standard sizes like A4 or custom dimensions. πŸ“

Usage:


5. πŸ” scale()

Control the rendering quality of the PDF by adjusting the scale factor. πŸ“Š

Usage:


6. πŸ“ margin()

Set the margins for the PDF document. πŸ“

Usage:


7. πŸ”— enableLinks()

Enable or disable PDF hyperlinks. When enabled, hyperlinks are automatically added on top of all anchor tags. 🌐

Usage:


8. πŸ’» content()

Set the content for the document. Typically, you'll pass a Blade view for the content. πŸ“

Usage:


🎨 Complete Example

Here's a complete example of a custom Livewire component with Html2Media:

Corresponding Blade template (livewire/report-generator.blade.php):


⚑ Quick Examples

1. Simple PDF Download Button:

2. Multi-action Component:


πŸ“‹ Requirements


🏁 Conclusion

The Html2Media package for Livewire makes it easy to generate PDFs, preview documents, and print content directly from your Laravel app. With flexible configuration options and seamless Livewire integration, you can tailor it to your specific needs, ensuring smooth document handling. ✨

We hope this documentation helps you get started quickly. πŸš€ Happy coding! πŸŽ‰


2. πŸ“„ pagebreak()

Define page break behavior. Customize how and where page breaks occur within the document. πŸ›‘

Usage:


3. πŸ”„ orientation()

Set the page orientation for the PDF, either portrait or landscape. πŸ–ΌοΈ

Usage:


4. πŸ“ format()

Define the format of the PDF, including standard sizes like A4 or custom dimensions. πŸ“

Usage:


5. πŸ”— enableLinks()

Enable or disable automatic hyperlink conversion in the PDF. πŸ”—

Usage:


6. πŸ”§ scale()

Adjust the scaling factor for HTML to PDF conversion. πŸ”

Usage:


7. πŸ–¨οΈ print()

Enable or disable the print button in the modal. πŸ–¨οΈ

Usage:


8. πŸ‘οΈ preview()

Enable a preview option for the document content before printing or saving. πŸ‘€

Usage:


9. πŸ’Ύ savePdf()

Enable the option to directly save the content as a PDF. πŸ’Ύ

Usage:


10. βœ… requiresConfirmation()

Show a confirmation modal before performing the action. πŸ›‘

Usage:


11. πŸ’» content()

Set the content for the document. Typically, you’ll pass a Blade view for the content. πŸ“

Usage:


🎨 Example Usage

Here’s a complete example of configuring the Html2MediaAction:

This configuration will:


πŸ“Š Livewire Component Usage

You can use the Html2Media components in various ways throughout your Livewire application. Here are the available components:

This makes the package flexible and usable in various contexts throughout your Laravel application. 🌍


⚑ Quick Examples

  1. For direct printing:

This will directly open the print dialog for the HTML content. πŸ–¨οΈ

  1. For saving as PDF:

This will save the HTML content as a PDF. πŸ’Ύ


🏁 Conclusion

The Html2Media package for Livewire makes it easy to generate PDFs, preview documents, and print content directly from your Laravel app. With flexible configuration options, you can tailor it to your specific needs, ensuring smooth document handling. ✨

We hope this documentation helps you get started quickly. πŸš€ Happy coding! πŸŽ‰


All versions of html2media with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0
livewire/livewire Version ^3.0
spatie/laravel-package-tools Version ^1.13
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 xslain/html2media contains the following files

Loading the files please wait ...