Code Monkey home page Code Monkey logo

avery-fpdf-labels's Introduction

Introduction

This is a simple FPDF and Avery template class. It provides easy implementation of Avery shipping label templates.

Supported Templates

  • Avery 5160

To-Do Templates

  • Avery 5162
  • Avery 5163
  • Avery 5195
  • Avery 5816
  • Avery 5817
  • Avery 8160

To-Do Code

N/A

Usage

See the documentation below or index.php or actual implementations.

Setup

// Import required files
require("FPDF.class.php");
require("AveryTemplates.class.php");

// Instantiate class (See supported Avery templates above)
$pdf = new amattu\Avery_5160();

// Set default properties
$pdf->SetTitle("FPDF Template Example");
$pdf->AddPage("P", "Letter");
$pdf->SetFont('Helvetica', '', 11); // Font optional
$pdf->SetTextColor(25, 25, 25); // Color optional

// Build PDF
$pdf->build();

// Output PDF
$pdf->Output("I", "Labels.pdf");

add(array $lines, int $row = 0, int $col = 0)

This function adds a new label to the list of labels to be produced. There is currently no way to revoke a label once it has added.

/**
 * Add a single label to the PDF
 *
 * @param array $lines an array of label liens
 * @param integer $row optional desired insert row
 * @param integer $col optional diesired intert column
 * @throws TypeError
 * @throws BadValueException
 * @author Alec M. <https://amattu.com>
 * @date 2021-09-05T13:49:28-040
 */
public function add(array $lines, int $row = 0, int $col = 0) : void;

Usage

$lines = Array(
  "Line 1",
  "Line 2",
  "Line 3",
  "Line 4"
);

$pdf->add($lines);

build()

/**
 * Build the completed PDF with labels
 *
 * NOTE:
 *   (1) To save resources, no PDF is built until
 *   this function is called.
 *
 * @return void
 * @throws InvalidStateException
 * @author Alec M. <https://amattu.com>
 * @date 2021-09-05T13:50:58-040
 */
public function build() : void;

Usage

$pdf->build();

Requirements & Dependencies

avery-fpdf-labels's People

Contributors

amattu2 avatar ncavallini 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.