Giter Site home page Giter Site logo

nimpdf's Introduction

nimPDF

nimPDF is a free PDF writer library, written mostly in nim programming language

nimPDF was heavily inspired by PHP-FPDF but also influenced by jagPDF, libHaru(especially for the demo), PyFPDF, pdfkit

after lodePNG substituted with PNG decoder written in nim, nimPDF become one step closer to 100% pure nim

nimPDF implements the following features(see demo.pdf):

  • images

    • PNG -- use LodePNG, still in C now written in nim
    • JPEG -- use uJPEG (MicroJPEG) -- KeyJ's Small Baseline JPEG Decoder, still in C
    • BMP -- use EasyBMP, already ported to nim, support 1bit, 4bit, 8bit, 16bit, 24bit, and 32bit images
    • beside transparency from original image(such as from PNG), you can adjust individual image transparency as easy as other elements in your document
  • text and fonts

    • support TTF/TTC font subsetting -- use Google sfntly, ported(partially) to nim and modified
    • you can easily tell the library to look for fonts in certain folder(s)
    • you only need to ask for font family name and it's style, the library will try to find the right one for you(if avilable)
    • text encoded in UTF-8 if you use TTF/TTC
    • 14 base font in PDF use Standard,MacRoman,WinAnsi encoding
    • TTF/TTC fonts can be written vertically if they have vertical metrics
  • Path construction

    • straight segments, Bezier curves, elliptical arcs, roundrect
    • join styles and miter limits
    • dash patterns
    • path clipping
    • arbitrary path bounding box calculation(i use it to implement gradient too)
    • construct path from mathematical function - taken from C# GraphDisplay
  • Color spaces

    • Gray, RGB, CMYK
    • alpha channel for text, path, and images too!
    • linear gradient to fill any closed shape
    • radial gradient to fill any closed shape
  • Interactive Features(see demo folder)

    • Page Labels
    • Document Outline
    • Hyperlinks
    • Text annotation
    • Encryption(protect document with password)
    • choose between ARC4-40, ARC4-128, AES-128, AES-256 encryption mode
    • Form Field: TextField
  • Coordinate Space

    • top-down mode
    • bottom-up mode
    • unit measured in point, inch, and mm
  • others

    • output to file or memory using nim stream module
    • images, fonts, and other resources search path(s)
    • document compression using flate decode(use lodePNG compressor)
    • transformation and graphics state
  • unimplemented features

    • CIE based color space
    • patterns(this can be achieved using PDF primitives and path clipping)
    • encryption
    • annotation
    • hyperlinks
    • other encoding beside UTF-8(nim has encoding module, i will use it someday)
    • basic text formating(will be implemented as separate layer)
    • radial gradient and multi color gradient
    • table generator(as in FPDF)(will be implemented as separate layer)
    • document outline
    • permission

Documentation

The documentation is generated using docutils

The documentation provided may not be complete, please help to improve it

Installation and build instructions

  • build general demo: nim c demo
  • build specific demo: goto nimPDF/demo folder, type nim e build.nims

Dependencies

  • nimBMP
  • nimPNG
  • nimAES
  • nimSHA2

nimpdf's People

Watchers

 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.