GithubHelp home page GithubHelp logo

cobooguo / pdfgen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andrerenaud/pdfgen

0.0 1.0 0.0 696 KB

Simple C PDF Writer/Generation library

License: The Unlicense

C 95.80% Makefile 1.60% Shell 1.32% Dockerfile 0.71% Python 0.55%

pdfgen's Introduction

PDFGen

PDFGen Logo

Buy Me A Coffee

Simple C PDF Creation/Generation library. All contained a single C-file with header and no external library dependencies.

Useful for embedding into other programs that require rudimentary PDF output.

Supports the following PDF features

  • Text of various fonts/sizes/colours
  • Primitive drawing elements
    • Lines
    • Rectangles
    • Filled Rectangles
    • Polygons
    • Filled Polygons
    • Bezier curves
  • Bookmarks
  • Barcodes (Code-128 & Code-39)
  • Embedded images
    • PPM/PGM (binary format only)
    • JPEG
    • PNG (Alpha Channels are not supported)
    • BMP

Example usage

#include "pdfgen.h"

int main(void) {
    struct pdf_info info = {
        .creator = "My software",
        .producer = "My software",
        .title = "My document",
        .author = "My name",
        .subject = "My subject",
        .date = "Today"
    };
    struct pdf_doc *pdf = pdf_create(PDF_A4_WIDTH, PDF_A4_HEIGHT, &info);
    pdf_set_font(pdf, "Times-Roman");
    pdf_append_page(pdf);
    pdf_add_text(pdf, NULL, "This is text", 12, 50, 20, PDF_BLACK);
    pdf_add_line(pdf, NULL, 50, 24, 150, 24, 3, PDF_BLACK);
    pdf_save(pdf, "output.pdf");
    pdf_destroy(pdf);
    return 0;
}

License

License: Unlicense

The source here is public domain. If you find it useful, please drop me a line at [email protected].

Builds

Build status: GitHub Actions

Appveyor status: Build status

Code Coverage: Coverage Status

Coverity scan: Coverity scan

Static Analysis

This is a code base that I use to test static analysis tools. As such the build system is quite a bit more complex than should be necessary for a project of this size.

pdfgen's People

Contributors

andrerenaud avatar mcgouganp avatar juliangmp avatar twpayne avatar polarisru avatar epicalert avatar endanke avatar jdek avatar mattparks avatar phf avatar ribalgz avatar yevgenypats avatar

Watchers

James Cloos 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.