Giter Club home page Giter Club logo

node-pdf-write-page's Introduction

just write text in different color, font, and size to a existing pdf and save the result

API

Example:

pdf = require 'pdf-write-page'
pdf {in:'test_unmodified.pdf', out:'test_modified.pdf', pageNumber:0}
.write 10, 0, 'A'
.write 10, 14, 'B'
.cfg {size:60}
.write 10, 28, 'C'
.restoreCfg()
.write 100, 100, 'D'
.end()

end also saves to out path.

page offset is bottom, left (x = 0, y = 0)

.write()

writes some text

.write(x, y, text)

.image()

add an image (jpg, pdf, tiff) to the pdf

copied from https://github.com/galkahana/HummusJS/wiki/Show-images

Optionally there's a 4th parameter which is an options object. The object may have the following properties, to modify the default image placement behaviour:

  • index - for multi-page image formats (tiff, PDF), index determines the page to show. Default is the first image in the collection.
  • transformation - transformation method. Can be either a array or an object. If it is a array, then transformation will be a 6 numbers matrix, allowing you to scale, rotate, translate or whatnot. If it is an object, than it is meant for defining an image fitting behaviour. You will define bounding with/height, and the module will scale the image in accordance. the object may have the following attributes:
    • width - required, width of bounding box
    • height - required, height of bounding box
    • proportional - boolean, should the fit method maintain the image proportions?
    • fit - either always or overflow. If always Fit may always happen scaling up or down. If overflow fit will scale only if the image dimensions overflow the box.

example:

.image(x, y, path, opts)

.page()

set the current page that is modified Pagecount starts as 0

exmaple:

    .page(1) # update page 2

.cfg()

options:

    fontPath   : ''
    size       : 14
    colorspace : 'gray'
    color      : 0x00

node-pdf-write-page's People

Contributors

baslr avatar frikkievb avatar

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.