{"id":21396412,"url":"https://github.com/baslr/node-pdf-write-page","last_synced_at":"2025-03-16T14:42:31.147Z","repository":{"id":31536730,"uuid":"35101299","full_name":"baslr/node-pdf-write-page","owner":"baslr","description":"just write text in different color, font, and size to a existing pdf and save the result","archived":false,"fork":false,"pushed_at":"2015-11-20T13:46:14.000Z","size":231,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T07:46:18.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baslr.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-05T13:27:34.000Z","updated_at":"2015-05-08T14:20:43.000Z","dependencies_parsed_at":"2022-08-25T22:41:33.753Z","dependency_job_id":null,"html_url":"https://github.com/baslr/node-pdf-write-page","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fnode-pdf-write-page","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fnode-pdf-write-page/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fnode-pdf-write-page/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fnode-pdf-write-page/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baslr","download_url":"https://codeload.github.com/baslr/node-pdf-write-page/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243885887,"owners_count":20363644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T14:26:57.697Z","updated_at":"2025-03-16T14:42:31.124Z","avatar_url":"https://github.com/baslr.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"just write text in different color, font, and size to a existing pdf and save the result\n\n### API\n\nExample:\n```coffeescript\npdf = require 'pdf-write-page'\npdf {in:'test_unmodified.pdf', out:'test_modified.pdf', pageNumber:0}\n.write 10, 0, 'A'\n.write 10, 14, 'B'\n.cfg {size:60}\n.write 10, 28, 'C'\n.restoreCfg()\n.write 100, 100, 'D'\n.end()\n```\n\n`end` also saves to `out` path.\n\npage offset is bottom, left (x = 0, y = 0)\n\n#### .write()\nwrites some text\n\n    .write(x, y, text)\n\n#### .image()\nadd an image (jpg, pdf, tiff) to the pdf\n\ncopied from \u003chttps://github.com/galkahana/HummusJS/wiki/Show-images\u003e\n\nOptionally there's a 4th parameter which is an options object. The object may have the following properties, to modify the default image placement behaviour:\n\n* `index` - for multi-page image formats (tiff, PDF), `index` determines the page to show. Default is the first image in the collection.\n* `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:\n    *  `width` - required, width of bounding box\n    * `height` - required, height of bounding box\n    * `proportional` - boolean, should the fit method maintain the image proportions?\n    * `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.\n\nexample:\n```coffeescript\n.image(x, y, path, opts)\n```\n\n#### .page()\nset the current page that is modified\nPagecount starts as 0\n\nexmaple:\n```coffeescript\n    .page(1) # update page 2\n```\n\n#### .cfg()\noptions:\n```coffeescript\n    fontPath   : ''\n    size       : 14\n    colorspace : 'gray'\n    color      : 0x00\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaslr%2Fnode-pdf-write-page","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaslr%2Fnode-pdf-write-page","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaslr%2Fnode-pdf-write-page/lists"}