Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wappla/laravel-markdown-to-pdf
Create PDF files with markdown in laravel
https://github.com/wappla/laravel-markdown-to-pdf
dompdf laravel laravel5 markdown markdown-to-pdf package pdf php
Last synced: 3 days ago
JSON representation
Create PDF files with markdown in laravel
- Host: GitHub
- URL: https://github.com/wappla/laravel-markdown-to-pdf
- Owner: wappla
- License: mit
- Created: 2018-01-05T12:41:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-05T08:25:43.000Z (over 5 years ago)
- Last Synced: 2024-04-18T18:17:03.125Z (5 months ago)
- Topics: dompdf, laravel, laravel5, markdown, markdown-to-pdf, package, pdf, php
- Language: PHP
- Homepage:
- Size: 12.7 KB
- Stars: 6
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Package still in development..
# Markdown to pdf
Simple package to convert markdown files to PDF in laravel.
## Requirements
- Laravel > 5.5## Installation
Install the package with composer:
```
composer require 'wappla/laravel-markdown-to-pdf'
```This packages uses the auto discovery feature of laravel. So there is no need to register the service provider or alias.
## Usage
Create a blade view and add the markdown to pdf component. Between the component element you can start writing markdown.
Below i created a simple example.blade.php :
```
@component('MarkdownToPDF::layout')
# Hello
@endcomponent
```### To view this as a PDF file in your browser you dan do:
```php
return \MarkdownToPDF::loadView('example')->stream();
```The standard directory for loading views is resources/views. No need to add the blade.php extension. If you would like to specify a custom directory you can use the dot notation.
```php
return \MarkdownToPDF::loadView('custom-directory.example')->stream();
```### Store this view in storage
Specifiy a custom filename or leave blank to save your pdf in storage.
```php
return \MarkdownToPDF::loadView('example')->save('awesome-file.pdf');
```The pdf will be stored based on your Laravel filesystem configuration. If you would like to specify a custom location you can create your own disk and add a second parameter to the save method.
The below example stores the pdf file on the public disk:
```php
return \MarkdownToPDF::loadView('example')->save('awesome-file.pdf', 'public');
```## Configuration
Use the standard `php artisan vendor:publish` laravel command an select the correct number or be more specific:
To publish all the configuration and views:
```
php artisan vendor:publish --provider="Wappla\LaravelMarkdownToPDF\MarkdownToPDFServiceProvider"
```Only publish views:
```
php artisan vendor:publish --tag="markdown-to-pdf-views"
```Only publish config:
```
php artisan vendor:publish --tag="markdown-to-pdf-config"
```