Giter Club home page Giter Club logo

laravel-markdown-to-pdf's Introduction

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"

laravel-markdown-to-pdf's People

Contributors

christophvh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jws1837

laravel-markdown-to-pdf's Issues

Doesn't work with Laravel 5.7

It seems like this doesn't work with Laravel 5.7:

Installation request for wappla/laravel-markdown-to-pdf dev-master -> satisfiable by wappla/laravel-markdown-to-pdf[dev-master].
- Conclusion: remove laravel/framework v5.7.26
- Conclusion: don't install laravel/framework v5.7.26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.