PHPackages                             webstasolutions/laratex - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. webstasolutions/laratex

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

webstasolutions/laratex
=======================

A package for creating PDFs in Laravel using LaTeX

v1.1.2(1y ago)14.0k[1 PRs](https://github.com/webstasolutions/laratex/pulls)MITPHPPHP ^8.0

Since Jan 11Pushed 1y agoCompare

[ Source](https://github.com/webstasolutions/laratex)[ Packagist](https://packagist.org/packages/webstasolutions/laratex)[ Docs](https://github.com/webstasolutions/laratex)[ GitHub Sponsors](https://github.com/webstasolutions)[ RSS](/packages/webstasolutions-laratex/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (9)Used By (0)

[![Contributors](https://camo.githubusercontent.com/1f97c9ab94c09859b4d768dfceadaa287340c0cddc546abde06b9d30796b8f27/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f776562737461736f6c7574696f6e732f6c6172617465782e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/webstasolutions/laratex/graphs/contributors)[![Forks](https://camo.githubusercontent.com/4c2033ddfe5d8c752040bb7c9813aebc77a239d9f410ba9ce611c1b50b704ca5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f776562737461736f6c7574696f6e732f6c6172617465782e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/webstasolutions/laratex/network/members)[![Stargazers](https://camo.githubusercontent.com/b2902977a0e05eff3e498adbe1f034c513f887089124431c59901f31ed5fe71b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f776562737461736f6c7574696f6e732f6c6172617465782e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/webstasolutions/laratex/stargazers)[![Issues](https://camo.githubusercontent.com/04d5ef7e50a3248f710179918bc642068c6b47935a9eafc30a32b5e5df17ec9d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f776562737461736f6c7574696f6e732f6c6172617465782e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/webstasolutions/laratex/issues)[![MIT License](https://camo.githubusercontent.com/fad48566cc5f3996ff886514c1fac1b778a19d58f6075d4c5003bf757bcf6091/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f776562737461736f6c7574696f6e732f6c6172617465782e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/webstasolutions/laratex/blob/master/LICENSE.md)

 [ ![Laratex](laratex.png) ](https://github.com/webstasolutions/laratex)

### LaraTeX

[](#laratex)

 A laravel package to generate PDFs using LaTeX

 · [Report Bug](https://github.com/webstasolutions/laratex/issues) · [Request Feature](https://github.com/webstasolutions/laratex/issues)

 For better visualization you can find a small **Demo** and the **HTML to LaTeX converter** [here](https://laratest.wismann.ch).

 Table of Contents1. [Note](#note)
2. [Getting Started](#getting-started)
    - [Prerequisites](#prerequisites)
    - [Installation](#installation)
    - [Configuration](#configuration)
3. [Usage](#usage)
    - [Dry Run](#dry-run)
    - [Preparing a Laravel View with LaTeX Content](#preparing-a-laravel-view-with-latex-content)
    - [Using graphics inside of your LaTeX files](#using-graphics-inside-of-your-latex-files)
    - [Download a PDF File](#download-a-pdf-file)
    - [Save a PDF file](#save-a-pdf-file)
    - [Return the PDF content](#return-the-pdf-content)
    - [Return the PDF inline](#return-the-pdf-inline)
    - [Return the TeX data](#return-the-tex-data)
    - [Using Raw TeX](#using-raw-tex)
    - [Bulk download in a ZIP archive](#bulk-download-in-a-zip-archive)
4. [Convert HTML to LaTeX BETA](#convert-html-to-latex-beta)
5. [Garbage Collection](#garbage-collection)
6. [Error Handling](#error-handling)
7. [Contribution](#contribution)
8. [Credits](#credits)
9. [Changelog](#changelog)
10. [License](#license)

NOTE
----

[](#note)

This package was tested in two different environments while using the package for those two special processes. If you experience any issues in all the time you are using it please open an issue so I can make this package better with every update :)

Getting Started
---------------

[](#getting-started)

### Important information about your environment

[](#important-information-about-your-environment)

This package was developed and tested on Unix (FreeBSD) servers and has been tested successfully on a Windows machine both running pdflatex. Always make sure to write your paths correctly :)

This package makes use of the `storage_path()` function. On Windows it is possible that the absolute path will be written out with backslashes. Windows is really good with paths using both forward &amp; backslashes but just keep this in mind if something doesn't work that well on windows.

### Prerequisites

[](#prerequisites)

You need to have `texlive-full` installed on your server. This program has tex packages and language libraries which help you generate documents. Note : You can also choose to install `textlive` which is the lighter version of the package.

The difference is:

- When you install `textlive` and want to use any additional tex package, you need to install it manually.
- `texlive-full` comes with these extra packages. As a result it may take up some additional space on your server (to store the package library files).

If you are choosing a hosting provider that doesn't allow you to install applications yourself please make sure that pdflatex is installed or ask if it can get installed. Also make sure that you have SSH access to the server as you might need it to find out in which path your pdflatex installation is sitting.

### Installation

[](#installation)

You can install the package with composer:

```
composer require webstasolutions/laratex
```

### Configuration

[](#configuration)

To load the config file with php artisan run the following command:

```
php artisan vendor:publish --tag=config
```

After this please make sure to configure your LaraTeX installation. In your LaraTeX Config file `\config\laratex.php` you can configure two settings:

**binPath**If your system doesn't allow to just run the command line command "pdflatex" you may specify the correct one. On Unix systems you can find out which bin path to use by running the command `which pdflatex`

If you are running this package with on a windows system please check this in cmd.exe before. There you should find out if running the command `pdflatex` works in cmd or if you need to provide the absolute path to your pdflatex application.

**tempPath**This specifies the folder where temporary files are saved while rendering a tex file into a PDF file. It is important that you always **start your path without a slash** and **end your path with a slash** (e.g. app/pdf/)

Usage
-----

[](#usage)

### Dry Run

[](#dry-run)

Before diving into the usage directly, it is important that you make sure that the required programs are installed properly on your server. The package comes with a dryrun method. It will automatically generate a file called `dryrun.pdf` if everything is set up properly on the server. If not please double-check the configuration of the `binPath` above.

```
` or `` (Example: `\textbf{}`).

**Important note when using html characters**

When using the `{{ }}` statement in a blade template, Laravel's blade engine always sends data through the PHP function `htmlspecialchars()` first. This will convert characters like `&` to `&amp;` and `
