Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

wappla/laravel-markdown-to-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

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:

 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.

 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.

 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:

 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"

AltStyle によって変換されたページ (->オリジナル) /