# pdf-write-page

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

Latest version **1.2.0** (published 2015-05-08) · 0 weekly downloads

## Install

```sh
npm install pdf-write-page
pnpm add pdf-write-page
yarn add pdf-write-page
bun add pdf-write-page
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2015-05-08 |
| First published | 2015-05-05 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.x |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Author | Manuel Baesler |
| Maintainers | baslr |
| Keywords | pdf, write, text, image |

## Links

- npm: https://www.npmjs.com/package/pdf-write-page
- Repository: https://github.com/baslr/node-pdf-write-page
- Homepage: http://github.com/baslr/node-pdf-write-page/
- Issues: http://github.com/baslr/node-pdf-write-page/issues
- npm.io page: https://npm.io/package/pdf-write-page

## Dependencies (2)

- [merge](https://npm.io/package/merge.md) ^1.2.0
- [hummus](https://npm.io/package/hummus.md) ^1.0.40

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2015-05-08
- 1.1.0 — 2015-05-06
- 1.0.0 — 2015-05-05

## README

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

### API

Example:
```coffeescript
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:
```coffeescript
.image(x, y, path, opts)
```

#### .page()
set the current page that is modified
Pagecount starts as 0

exmaple:
```coffeescript
    .page(1) # update page 2
```

#### .cfg()
options:
```coffeescript
    fontPath   : ''
    size       : 14
    colorspace : 'gray'
    color      : 0x00
```

---
_Source: https://npm.io/package/pdf-write-page · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
