Git Product home page Git Product logo

form2pdf's Introduction

form2pdf

This project was made with ❤️ ​to Alê.

The main objective is to take the existing process of transforming form into PDF esier.

Requirements

It is needed you to have composer to install the required mpdf package (a PHP Library to generate PDF files).

Use

  1. First of all, install mpdf package by running the command:

    composer install
    
  2. Once you had the package installed, you can open your server to see the index.html page and select your template requested;

  3. Fill the form fields with your answers, then, click the submit button;

  4. You will see the page of your final PDF with your template and respective answers rendered.

Creating a new template

To create a new template, just create a folder with the name of your template on the folder templates. Inside this folder, you must obtain the files index.json (with your configurations), and content.html (you can provide the header.html and footer.html files too).

Remember to insert the name of the template in the settings.json in templates array.

In your index.json, should contain a json with this structure:

{
  "title": "Example Title",
  "description": "This is a description",
  "form": []
}

You can add the output attribute to specify the filename (you can user variables from the answors of your form by using double curly braces "{{variable}}") if you want to save it (if yes, it will be generated in output/template_name/filename.pdf).

In your form array, you put the fields of you form. Example:

{
  "type": "field type",
  "name": "Field name"
}

Possible field types are: text, number, radio, checkbox.

Type peculiarities

If the field type is radio and checkbox, you should provide the options attribute, an array of strings.

If the field type is radio, you can use the attribute "other": true to allow the responder of the form select "other" option and insert a value.

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.