All Projects → AMBERSIVE → laravel-document-viewer

AMBERSIVE / laravel-document-viewer

Licence: other
Helper tools to create printable documents in laravel

Programming Languages

PHP
23972 projects - #3 most used programming language
Blade
752 projects

Projects that are alternatives of or similar to laravel-document-viewer

derivejs
DeriveJS is a reactive ODM - Object Document Mapper - framework, a "wrapper" around a database, that removes all the hassle of data-persistence by handling it transparently in the background, in a DRY manner.
Stars: ✭ 54 (+315.38%)
Mutual labels:  document
scanbot-sdk-example-ios
No description or website provided.
Stars: ✭ 17 (+30.77%)
Mutual labels:  document
paper-terminal
Print Markdown to a paper in your terminal
Stars: ✭ 33 (+153.85%)
Mutual labels:  document
android-oss-best-practices
Best practices on creating Android OSS library projects [JA]
Stars: ✭ 32 (+146.15%)
Mutual labels:  document
react-router-v4-CN
React Router V4 中文文档
Stars: ✭ 806 (+6100%)
Mutual labels:  document
rabbitmq-persian
rabbitmq به زبان ساده
Stars: ✭ 19 (+46.15%)
Mutual labels:  document
everydocs-core
A simple Document Management System for private use with basic functionality to organize your documents digitally
Stars: ✭ 112 (+761.54%)
Mutual labels:  document
You-Dont-Know-Axios
Enrich documents for axios
Stars: ✭ 111 (+753.85%)
Mutual labels:  document
dawn-api
A RESTful API package
Stars: ✭ 25 (+92.31%)
Mutual labels:  document
GroupDocs.Classification-for-.NET
GroupDocs.Classification-for-.NET samples and showcase (text and documents classification and sentiment analysis)
Stars: ✭ 38 (+192.31%)
Mutual labels:  document
DocuNet
Code and dataset for the IJCAI 2021 paper "Document-level Relation Extraction as Semantic Segmentation".
Stars: ✭ 84 (+546.15%)
Mutual labels:  document
elasticsearch-doc
elasticsearch中文文档——基于7.11
Stars: ✭ 96 (+638.46%)
Mutual labels:  document
aspose-words-cloud-node
Node.Js library for communicating with the Aspose.Words Cloud API
Stars: ✭ 20 (+53.85%)
Mutual labels:  document
prototype
📖Prototype Document
Stars: ✭ 45 (+246.15%)
Mutual labels:  document
bayou
Collaborative document editing, with Quill-based front end
Stars: ✭ 21 (+61.54%)
Mutual labels:  document
books
Programming books
Stars: ✭ 27 (+107.69%)
Mutual labels:  document
soldoc
A solidity documentation generator, based in NatSpec format. 📃 with standalone HTML, pdf, gitbook and docsify output ✏️ just plug and play.
Stars: ✭ 54 (+315.38%)
Mutual labels:  document
document-visibility
React hook for subscribing to document visibility
Stars: ✭ 31 (+138.46%)
Mutual labels:  document
wizard
🍳Wizardoc is a WEBAPP for managing documents and knowledge.
Stars: ✭ 57 (+338.46%)
Mutual labels:  document
fluentd-docs
This repository is deprecated. Go to fluentd-docs-gitbook repository.
Stars: ✭ 49 (+276.92%)
Mutual labels:  document

Document viewer

The goal of this project is the attemp to provide a helper functionality for creating beautiful, printable and secure documents.

Maintainability Test Coverage Build Status

Installation

composer require ambersive/documentviewer

Usage

Step 1: Create a printable

php artisan make:printable "Invoice"

Step 2: Register the document viewer

Define a route in your desired router. Please be aware that default laravel middleware for web and api might require modifications there (eg for the post request).

$signed = false

Route::document(
    "invoices/{id}", 
    "invoices", 
    \App\Printables\Invoice::class, 
    [
        // Middleware for getting the document
    ], 
    $signed, 
    \App\Printables\Invoice::class, // for file upload handling
    [
        // Middleware for postback / upload the document
    ]
);

The signed attribute will always be in effect for the get request of the document.

If you do not want a upload leave the upload class empty or null.

Step 3: Modifiy the Class

The command above will create Printable Class in the folder Printable within app_path

First of all you should define data which is present or required in the specific blade file.

Then you should provide an uploadHandler. This will be required if you use our Laravel Package for Print generation and the Print-API.

use Illuminate\Http\Request;

use AMBERSIVE\DocumentViewer\Abstracts\DocumentAbstract;

class Invoice extends DocumentAbstract
{

    public array $data   = [];

    // Define the blade you want to return as printable document
    public String $blade = "ambersive.documentviewer::printable_default";
    public bool  $useValidationEndpoint = false; 

    public function setData(){
        // Request is available in $this->request
        // Save stuff in $this->data
        // This function must return $this (= chainable)
        // Params are provided in $this->params
        return $this;
    }

    public function uploadDocumentHandler(Request $request) {

        // Handle the file upload
        // Requires a response (preferable json)
        return ['status' => 200];

    }

    public function validateDocumentHandler(Request $request) {

        // Handle the validation
        // This information is a helper 
        // Requires a response (preferable json)
        return ['status' => 200];

    }

}

Step 4: Modify the blade file

The make command also creates a blade file within the resource folder. It will come with some basic scaffold settings so you will be able to create beautiful documents in no time.

If you want to create a custom blade file make sure you extend it with our base blade. Otherwise the enhanced view optimizations won't work.

@extends('ambersive.documentviewer::printable')

A full example might look like:

@extends('ambersive.documentviewer::printable')

@section('styles')

    <style>
        body {
            // Custom Page style goes here
        }
    </style>

@endsection

@section('document')

    <div>Printable document</div>

@endsection

Need a way to create PDF files?

We created a microservice which is also open-source to create pdf files. If you need a smooth way to interact with this microservice you can use our package for that.

Security Vulnerabilities

If you discover a security vulnerability within this package, please send an e-mail to Manuel Pirker-Ihl via [email protected]. All security vulnerabilities will be promptly addressed.

License

This package is open-sourced software licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].