GithubHelp home page GithubHelp logo

andrekelling / jspdf-template Goto Github PK

View Code? Open in Web Editor NEW
45.0 3.0 5.0 2.2 MB

Invoice template and setup for jsPDF usage in ES6.

Home Page: https://andrekelling.github.io/jspdf-template/

JavaScript 100.00%
jspdf jspdf-yworks svg-images boilerplate

jspdf-template's Introduction

jsPDF Template

This a styled invoice Template jsPDF in an ES6 / ECMAScript webpack setup.

Includes svg2pdf for better SVG support.

Here there is a demo.

Install

  1. npm install

If you want the usable node package, you can install it via npm:

npm i jspdf-invoice -S it is here https://www.npmjs.com/package/jspdf-invoice

Build

Creates a bundle JS file which provides the global method printPDF().

For demonstration a docs GitHub page is build.

  1. npm run build

Development

  1. npm run dev
  2. npm run serve

Publish

Is done via GitHub action.

  • raise version in dist/package.json

A copy of the src dir is taken as artifact for the node package in the dist dir.

Custom-Font file

I do use a custom font here. Which is prepared as base64 code like following: https://github.com/parallax/jsPDF#use-of-unicode-characters--utf-8

  1. My custom fonts are laying as .ttf font-files in src/fonts subdirectory.
  2. prepared JS script with the font's base64 code are in src/print/fonts
  3. they got a import { jsPDF } from 'jspdf'; added at the very top

Structure

  • Print components or template partials are placed in src/print/partials
  • fetchSvg and newPage are tools placed in src/print/utils

Image sizes

Images need to be SVG in here!

  • Logo Size: width="40" height="49"
  • Address-bar: width="668" height="56", which is scaled down to keep details
  • Background: width="733" height="528", which is centralised and hangs a bit over the edges

Issues

jspdf-template's People

Contributors

andrekelling avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.