{"id":18487975,"url":"https://github.com/rse/node-prince","last_synced_at":"2025-04-04T10:03:48.729Z","repository":{"id":16162988,"uuid":"18909113","full_name":"rse/node-prince","owner":"rse","description":"Node API for executing PrinceXML via prince(1) CLI","archived":false,"fork":false,"pushed_at":"2024-12-18T17:12:08.000Z","size":193,"stargazers_count":54,"open_issues_count":10,"forks_count":25,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T09:05:17.879Z","etag":null,"topics":["css","generation","html","javascript","pdf","princexml","wrapper","xml"],"latest_commit_sha":null,"homepage":"https://npmjs.com/prince","language":"Shell","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/rse.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-18T09:38:16.000Z","updated_at":"2025-03-08T21:55:29.000Z","dependencies_parsed_at":"2023-02-18T20:15:16.931Z","dependency_job_id":"8795d927-63a7-4243-9ffb-7496213dbd09","html_url":"https://github.com/rse/node-prince","commit_stats":{"total_commits":212,"total_committers":10,"mean_commits":21.2,"dds":0.06603773584905659,"last_synced_commit":"de32b0dcc84e3e21d53408e260c7643ba7beb8e2"},"previous_names":[],"tags_count":79,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fnode-prince","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fnode-prince/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fnode-prince/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fnode-prince/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rse","download_url":"https://codeload.github.com/rse/node-prince/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157045,"owners_count":20893202,"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":["css","generation","html","javascript","pdf","princexml","wrapper","xml"],"created_at":"2024-11-06T12:51:07.037Z","updated_at":"2025-04-04T10:03:48.702Z","avatar_url":"https://github.com/rse.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"\nNode-Prince\n===========\n\n[Node](http://nodejs.org/) API for executing the XML/HTML to PDF renderer\n[PrinceXML](http://www.princexml.com/) via `prince` CLI.\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/prince.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/rse/node-prince.png\" alt=\"\"/\u003e\n\nAbstract\n--------\n\nThis is a [Node](http://nodejs.org/) API for executing the\nXML/HTML to PDF renderer [PrinceXML](http://www.princexml.com/) CLI `prince` from within\nJavaScript. The essential point of this Node extension is not primarily\nto just abstract away the asynchronous CLI execution. Instead there\nare two other major points: First, this Node extension provides a\nfixed dependency, as other Node extensions which require PrinceXML can\njust depend (via their NPM `package.json` file) onto this extension.\nSecond, as this Node extension can \u0026mdash; across platforms \u0026mdash;\nautomatically download, locally unpack and use a PrinceXML distribution,\nthere is no need for any previously available global PrinceXML\ninstallation. Just depend on this Node extension and PrinceXML is\navailable!\n\nInstallation\n------------\n\nUse the Node Package Manager (NPM) to install this module\nlocally (default) or globally (with option `-g`):\n\n    $ npm install [-g] prince\n\nATTENTION: In case you are behind a corporate firewall, you usually\nhave to configure your corporate proxy before installing this module.\nFor this, either configure the proxy inside NPM (e.g. `npm config set proxy http://proxy.example.com:3128`)\nor alternatively set the environment variable `http_proxy` (e.g. `export http_proxy=http://proxy.example.com:3128`).\n\nNOTICE: PrinceXML provides just distribution-specific and dynamically\nlinked Linux binaries. The Node-Prince installation procedure tries to\ndetect your particular distribution on `npm install [-g] prince` and\ndownloads the corresponding binary. But because of the dynamic linking\nof PrinceXML binaries, it still can be that you first have to install\nsome distribution-specific system dependencies. For instance, under\nDebian 8.0 you first have to install the necessary system packages with\n`apt-get install nodejs nodejs-legacy npm libgif4 curl`.\n\nUsage\n-----\n\n```js\nconst Prince = require(\"prince\")\nconst util   = require(\"util\")\n\nPrince()\n    .inputs(\"test.html\")\n    .output(\"test.pdf\")\n    .execute()\n    .then(function () {\n        console.log(\"OK: done\")\n    }, function (error) {\n        console.log(\"ERROR: \", util.inspect(error))\n    })\n```\n\nAPI\n---\n\n- `Prince([options]): Prince`: constructor for the API. Call this once\n  for every XML/HTML to PDF conversion process.\n  This returns the Prince API for further method chaining.\n\n- `Prince#binary(binary): Prince`: set the path to the prince(1) binary.\n  By default it is `prince` (in case PrinceXML was found globally\n  installed at the Node API installation time) or the path to the\n  `prince` binary of the locally installed PrinceXML distribution (in\n  case PrinceXML was not found globally installed at the Node API\n  installation time).\n  This returns the Prince API for further method chaining.\n\n- `Prince#prefix(prefix): Prince`: set the path to the PrinceXML\n  installation. This by default is either empty\n  (in case PrinceXML was found globally\n  installed at the Node API installation time) or the path to the\n  locally installed PrinceXML distribution (in case PrinceXML was not\n  found globally installed at the Node API installation time).\n  This returns the Prince API for further method chaining.\n\n- `Prince#license(filename): Prince`: set the path to the PrinceXML\n  license file. This by default uses the path `license/license.dat`\n  under the PrinceXML installation.\n  This returns the Prince API for further method chaining.\n\n- `Prince#timeout(timeout): Prince`: set the execution timeout in milliseconds.\n  The by default it is `10000` (10s).\n  This returns the Prince API for further method chaining.\n\n- `Prince#maxbuffer(maxbuffer): Prince`: set the execution maximum stdout/stderr buffer size in bytes.\n  The by default it is `10485760` (10MB).\n  This returns the Prince API for further method chaining.\n\n- `Prince#cwd(dirname): Prince`: set the current working directory for execution.\n  The by default it is `.` (current working directory).\n  This returns the Prince API for further method chaining.\n\n- `Prince#inputs(filename): Prince`: set one (in case `filename` is a string)\n   or multiple (in case `filename` is an array of strings) input XML/HTML files.\n  This returns the Prince API for further method chaining.\n\n- `Prince#output(filename): Prince`: set the output PDF file.\n  This returns the Prince API for further method chaining.\n  This is optional if the PrinceXML option `raster-output` is given.\n\n- `Prince#option(name, value[, forced]): Prince`: set a PrinceXML option\n  name `name` to a value `value`. The API knows the officially supported\n  options of PrinceXML 9.0 and by default rejects unknown options.\n  But arbitrary options can be passed by setting `forced` to `true`\n  in case a different PrinceXML version should be used. This returns\n  the Prince API for further method chaining.\n\n- `Prince#execute(): Promise`: asynchronously execute the conversion\n  process. This returns a promise. On success it resolves to\n  an object with `stdout` and `stderr` fields. On error, it\n  resolves to an object with `error`, ` stdout` and `stderr` fields.\n\nSee Also\n--------\n\nCompanion Grunt task [grunt-princess](https://github.com/rse/grunt-princess)\n\nLicense\n-------\n\nCopyright \u0026copy; 2014-2024 Dr. Ralf S. Engelschall (http://engelschall.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fnode-prince","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frse%2Fnode-prince","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fnode-prince/lists"}