ghostscript4js
Advanced tools
Comparing version 1.0.3 to 1.0.5
# Changelog | ||
## 1.0.5 / 2017-02-22 | ||
* Fix in documentation of **`ghostscript4js`**. | ||
## 1.0.3 / 2017-02-20 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "ghostscript4js", | ||
"description": "Bindings for the Ghostscript C API to bring Ghostscript power to the Node.JS world.", | ||
"version": "1.0.3", | ||
"version": "1.0.5", | ||
"contributors": [ | ||
@@ -6,0 +6,0 @@ { |
@@ -36,3 +36,3 @@ <p align="center"> | ||
Ghostscript can also serve as the back-end for **PDF** to **raster image** (png, tiff, jpeg, etc.) converter; this is often | ||
combined with a PostScript printer driver in "virtual printer" PDF creators.[citation needed] | ||
combined with a PostScript printer driver in "virtual printer" PDF creators. | ||
@@ -56,15 +56,13 @@ As it takes the form of a language interpreter, Ghostscript can also be used as a general purpose programming environment. | ||
At time i created this module i do not able to find any module on npm that execute Ghostscript command through its C API, | ||
otherwise there are some module that call Ghostscript through the execution of the corresponding shell command. This is | ||
good way to start use some library from node, but there are the following drawbacks: | ||
At the time i created this module i was not able to find any module on npm that execute Ghostscript command through its C API, | ||
otherwise there were some module that call Ghostscript through the execution of the corresponding shell command. This is a | ||
good way to start using some library from node, but there are the following drawbacks: | ||
* **Performance** - The call to the shell command take more time and more resources than call a library C or C++ API directly | ||
* **Performance** - The call to the shell command take more time and more resources than calling a library C or C++ API directly from Node.js environment. | ||
from Node.js environment. | ||
* **Errror handler** - Sometimes you cannot intercept and handle errors in a good and a proper way. | ||
* **Errror handler** - Sometimes you cannot intercept and handle errors in a good and proper way. | ||
To fit all needs Ghostscript4JS has sync and async methods so it could be used in a web application where it's very important | ||
to not block the event loop, so all requests will be served without any delay originated by our application. | ||
To fit all needs Ghostscript4JS has sync and async method so it could be used in a web application where it's very important | ||
to not block the event loop, so all request will be served whiout any delay originated by our application. | ||
[Understanding Node.js event loop](https://nodesource.com/blog/understanding-the-nodejs-event-loop/) | ||
@@ -76,9 +74,9 @@ | ||
Before install Ghostscript4JS youe need to assure you have been installed the following preequisites: | ||
Before installing Ghostscript4JS you need to assure you have the following prerequisites: | ||
* Install **Node.JS** see: [Installing Node.js via package manager](https://nodejs.org/en/download/package-manager/) | ||
* **Node.JS** see: [Installing Node.js via package manager](https://nodejs.org/en/download/package-manager/) | ||
* Install **Node.js native addon build tool** see: [node-gyp](https://github.com/nodejs/node-gyp) | ||
* **Node.js native addon build tool** see: [node-gyp](https://github.com/nodejs/node-gyp) | ||
* Install **Ghostscript** for your Operating System. | ||
* **Ghostscript** for your Operating System. | ||
@@ -101,3 +99,3 @@ ## Linux | ||
At this point you need to set enviroment variable **GS4JS_HOME** to ```/usr/lib/x86_64-linux-gnu``` | ||
At this point you need to set the enviroment variable **GS4JS_HOME** to ```/usr/lib/x86_64-linux-gnu``` | ||
@@ -116,5 +114,5 @@ ### Red Hat | Fedora | ||
At this point you need to set enviroment variable **GS4JS_HOME** to ```/usr/lib64``` or ```/usr/lib``` based on you architecture | ||
At this point you need to set the enviroment variable **GS4JS_HOME** to ```/usr/lib64``` or ```/usr/lib``` based on you architecture | ||
In general based on your Linux OS and architecture you have to set environment variable **GS4JS_HOME** to point on folder contains ```libgs.so``` library. | ||
In general, based on your Linux OS and architecture, you have to set the environment variable **GS4JS_HOME** to point on folder containing ```libgs.so``` library. | ||
@@ -125,5 +123,5 @@ ## Windows | ||
* Install Ghostscript on your system for example in ```C:\gs``` | ||
* Install Ghostscript on your system, for example in ```C:\gs``` | ||
* Add enviroment variable **GS4JS_HOME** to point on a folder contains Ghostscript DLL and Library files (Es. gsdll64.dll and gsdll64.lib) typically they are located in **bin** folder of you ghostscript installation for example ```C:\gs\bin``` | ||
* Add the environment variable **GS4JS_HOME** to point to a folder containing Ghostscript's DLL and Library files (Es. gsdll64.dll and gsdll64.lib). Typically, they are located in **bin** folder of you ghostscript installation, for example ```C:\gs\bin``` | ||
@@ -140,3 +138,3 @@ ## macOS | ||
* Set environment variable **GS4JS_HOME** to ```/usr/local/lib``` | ||
* Set the environment variable **GS4JS_HOME** to ```/usr/local/lib``` | ||
@@ -153,3 +151,3 @@ ## Official installation guide to install Ghostscript | ||
If you want use ghostscript4js you have to install it. There are two methods for that: | ||
If you want to use ghostscript4js you have to install it. There are two methods for that: | ||
@@ -187,9 +185,9 @@ In dependencies of your ```package.json``` add the following item: | ||
The module ghostscript4js allow you to use some installation options that you can use when in your operating system something is different against standard installation. | ||
The module ghostscript4js allows you to use some installation options that you can use when in your operating system something is different against standard installation. | ||
**--GS4JS_HOME** Set the GS4JS_HOME variable that represent the path in your system where is located the ghostscript library | ||
**--GS4JS_HOME** Set the GS4JS_HOME variable that represents the path in your system where is located the ghostscript library | ||
Es. ```npm install ghostscript4js --GS4JS_HOME="C:/gs/bin"``` | ||
**--GS4JS_LIB** Set the GS4JS_LIB variable that represent the file name for the ghostscript library installed in your system | ||
**--GS4JS_LIB** Set the GS4JS_LIB variable that represents the file name for the ghostscript library installed in your system | ||
@@ -200,3 +198,3 @@ Es. ```npm install ghostscript4js --GS4JS_LIB="libgs.so"``` | ||
**--GS4JS_DLL** Set the GS4JS_DLL variable that represent the file name for the ghostscript DLL installed in your windows system | ||
**--GS4JS_DLL** Set the GS4JS_DLL variable that represents the file name for the ghostscript DLL installed in your windows system | ||
@@ -229,6 +227,6 @@ Es. ```npm install ghostscript4js --GS4JS_DLL="gsdll64.dll"``` | ||
**version()** method return an object that contains information about version of Ghostscript library | ||
**version()** method returns an object that contains information about version of Ghostscript library | ||
installed on the system. It is important in those circumstances where you have to take | ||
decision based on different version. | ||
The returned data aee similar to the example repoted below: | ||
The returned data are similar to the example repoted below: | ||
@@ -244,4 +242,4 @@ ```js | ||
This is a synchronous method and return the version info or throw an Error to indicate that | ||
something was wrong in executing it. | ||
This is a synchronous method and returns the version info or throws an Error to indicate that | ||
something went wrong during its execution. | ||
@@ -272,3 +270,3 @@ #### Example - version | ||
**executeSync(cmd)** method take the Ghostscript command parameters in input as a string and execute it in a synchronous way. | ||
**executeSync(cmd)** method takes the Ghostscript command parameters in input as a string and executes in a synchronous way. | ||
If something wrong happens in calling this method an Error with description and code error will be thrown. | ||
@@ -293,6 +291,4 @@ | ||
**execute(cmd, callback)** method take in input the Ghostscript command parameters as a string and an optional callbackand. The execution will be asynchronous so | ||
this ensure better performance especially in a web application enviroment, because the Node.Js event loop will not block. | ||
This method has optional callback function as input in that case a possible error will be handled by this function. If noone function will be provided the method | ||
return a Promise that will be resolved or rejected all as reported in the following example. | ||
**execute(cmd, callback)** method takes in input the Ghostscript command parameters as a string and an optional callback. The execution will be asynchronous so this ensure better performance especially in a web application enviroment, because it'll not block the Node.Js event loop. | ||
This method has an optional callback function as input, in that case, a possible error will be handled by this function. If noone function will be provided the method returns a Promise that will be resolved or rejected as reported in the following example. | ||
@@ -334,11 +330,9 @@ #### Example - execute | ||
The error raised from **ghostscript4js** in all of its method is an instance of Error object that cointains a message that | ||
describe what happened and at the same time cointains the Ghostscript error code so you can inspect what ahhpened in a better | ||
way. At this link [Ghostscript error codes](https://ghostscript.com/doc/current/API.htm#return_codes) you can find all Ghostscript | ||
errors code. | ||
describes what happened and at the same time cointains the Ghostscript error code so you can inspect what happened in a better | ||
way. At this link [Ghostscript error codes](https://ghostscript.com/doc/current/API.htm#return_codes) you can find all Ghostscript errors code. | ||
### Min and Max supported revision | ||
This module was builded based on Ghostscript C API that is compatible with some specifica versions. The module has two | ||
properties **MIN_SUPPORTED_REVISION** and **MAX_SUPPORTED_REVISION** which respectively indicate the maximum and minimum of supported | ||
Ghostscript's version. | ||
This module was built based on Ghostscript C API that is compatible with some specifics versions. The module has two | ||
properties **MIN_SUPPORTED_REVISION** and **MAX_SUPPORTED_REVISION** which respectively indicate the minimum and maximum supported Ghostscript's version. | ||
@@ -387,2 +381,2 @@ #### Example - Min and Max supported revision | ||
Licensed under [Apache license V2](./LICENSE) | ||
Licensed under [Apache license V2](./LICENSE) |
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
78731
367