Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "topdf", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A node.js addon for Oracle's pdf export library.", | ||
@@ -10,3 +10,4 @@ "main": "lib/topdf.js", | ||
"scripts": { | ||
"install": "node-gyp rebuild" | ||
"install": "node-gyp rebuild", | ||
"test": "node test/test.js" | ||
}, | ||
@@ -13,0 +14,0 @@ "repository": { |
A node.js addon for Oracle's pdf export library. | ||
# Usage | ||
## Example | ||
@@ -8,25 +8,5 @@ ```javascript | ||
// the default settings | ||
var options = { | ||
watermark: './test/etc/test.png', | ||
fontdirectory: '/usr/share/fonts/truetype/msttcorefonts', | ||
override: false, | ||
gridlines: false, | ||
headings: false, | ||
}; | ||
// convert a single document, using custom settings | ||
topdf.convert('./test/etc/foo.xlsx', './test/etc/foo.pdf', options, function (err, success) { | ||
if (err || !success) { | ||
console.log(err); | ||
} else { | ||
console.log(success); | ||
} | ||
/* ... */ | ||
@@ -36,34 +16,26 @@ }); | ||
# Options | ||
## API | ||
1. watermark | ||
> A path to an image file to be used as the watermark image. This defaults to not watermark image if this propery is omitted. | ||
### convert(source, destination, [options,] callback) | ||
2. fontdirectory | ||
> A path to a directory containing true type fonts to be used. This defaults to `/usr/share/fonts/truetype/msttcorefonts` if this property is omitted. This option is *required*, if the default does not fit your setup. | ||
Takes a `source` document and saves it to `destination` as a PDF. The `options` parameter is optional. | ||
3. override | ||
> A `boolean` specifying whether or not you wish to override the settings specified in the document. This defaults to `false`, which means any settings stored in the document to be converted will be used. This must be `true` in order to use any other formatting options. | ||
- `watermark`: A path to an image file to be used as the watermark image. This defaults to no watermark, if this propery is omitted. | ||
- `fontdirectory`: A path to a directory containing true type fonts to be used. This option is *required*, if the default does not fit your setup. This defaults to `/usr/share/fonts/truetype/msttcorefonts`. | ||
- `override`: A `boolean` specifying whether or not you wish to override the settings specified in the document. This defaults to `false`, which means any settings stored in the document to be converted will be used. This must be `true` in order to use any other formatting options. | ||
- `gridlines`: A `boolean` specifying whether or not to print gridlines in spreadsheet documents. This `defaults` to `false`. | ||
- `headings`: A `boolean` specifying whether or not to print headings in spreadsheet documents. This `defaults` to `false`. | ||
- `memory`: An `integer` specifying the maximum about of memory, in MB, that the PDF converter may use for caching the `source` file. More memory means less disk reads. Must be a value in the following collection: `4`, `16`, `64`, `256`, `1024`. This defaults to `16`. | ||
- `pages`: An `integer` specifying the maximum number of pages to write to the `destination` file. Specifying `0` will save all pages. This `defaults` to `0`. | ||
4. gridlines | ||
> A `boolean` specifying whether or not to print gridlines in spreadsheet documents. This `defaults` to `false`. | ||
## Runtime Prerequisites | ||
5. headings | ||
> A `boolean` specifying whether or not to print headings in spreadsheet documents. This `defaults` to `false`. | ||
Make sure `/usr/local/lib/pdfexport` is in `$LD_LIBRARY_PATH`. | ||
# Runtime Prerequisites | ||
## Compiling Prerequisites | ||
Make sure `/usr/local/lib/pdfexport` is in `$LD_LIBRARY_PATH`. Also, I currently have the font directory hard-coded to `/usr/share/fonts/truetype/msttcorefonts`. I plan to make this configurable, soon. | ||
# Compiling Prerequisites | ||
Download the Oracle pdf export SDK, place the header files in `/usr/local/include/pdfexport` and the *entire* contents of the sdk's `redist` directory into `/usr/local/lib/pdfexport`. Make sure `/usr/local/lib/pdfexport` is in `$LD_LIBRARY_PATH`. | ||
# Oracle | ||
## Oracle | ||
You can download Oracle's tools at the following URL: http://www.oracle.com/technetwork/middleware/content-management/downloads/oit-dl-otn-097435.html |
var topdf = require('../lib/topdf'); | ||
var topdf = require('../lib/topdf'), | ||
assert = require('assert'); | ||
@@ -7,5 +8,7 @@ // set some options | ||
headings: true, | ||
override: true, | ||
gridlines: true, | ||
headings: true | ||
memory: 1024, | ||
pages: 10 | ||
@@ -17,12 +20,8 @@ }; | ||
if (err || !success) { | ||
console.log(err); | ||
} else { | ||
console.log(success); | ||
} | ||
// no errors | ||
assert.ifError(err); | ||
// successful | ||
assert.ok(success); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36246
50
39