ANTIALIASING_NONE
ANTIALIASING_NONE
No Anti-Aliasing
This class contains a wrapper around the Ghostscript-Application.
This needs the Ghostscript application to be installed on the server. If the gs-executable is not available the class will not be able to execute anything
A working example might look like the following code:
// First we describe the output-format $device = new Org_Heigl_Ghostscript_Device_Jpeg ();
// Set the JPEG-Quality to 100 $device -> setQuality ( 100 );
// Next we Create the ghostscript-Wrapper $gs = new Org_Heigl_Ghostscript ();
// Set the device $gs -> setDevice ( $device ) // Set the input file -> setInputFile ( 'path/to/my/ps/or/pdf/file' ) // Set the output file that will be created in the same directory as the input -> setOutputFile ( 'output' ) // Set the resolution to 96 pixel per inch -> setResolution ( 96 ) // Set Text-antialiasing to the highest level -> setTextAntiAliasing ( Org_Heigl_Ghostscript::ANTIALIASING_HIGH );
// convert the input file to an image if ( true === $gs -> render () ) { echo 'success'; } else { echo 'some error occured'; }
Alternatively the example could read as follows
// Create the ghostscript-Wrapper $gs = new Org_Heigl_Ghostscript ();
// Set the device $gs -> setDevice ( 'jpeg' ) // Set the input file -> setInputFile ( 'path/to/my/ps/or/pdf/file' ) // Set the output file that will be created in the same directory as the input -> setOutputFile ( 'output' ) // Set the resolution to 96 pixel per inch -> setResolution ( 96 ) // Set Text-antialiasing to the highest level -> setTextAntiAliasing ( Org_Heigl_Ghostscript::ANTIALIASING_HIGH );
// Set the jpeg-quality to 100 $gs -> getDevice () -> setQuality ( 100 );
// convert the input file to an image if ( true === $gs -> render () ) { echo 'success'; } else { echo 'some error occured'; }
__construct() : void
Create a new Instance of the Ghostscript wrapper.
The new Instance will use a jpeg-device as default
None found |
setGsPath(string|null $path = null) : string
Set the path to the gs-executable and return it.
This method will be called on load of the class and needs not to be called during normal operation.
If you have Ghostscript installed in a non-standard-location that can not be found via the 'which gs' command, you have to set the path manualy
string|null | $path | The path to set |
None found |
None found |
setInputFile(string|\Org_Heigl\Ghostscript\SplFileInfo $file) : self
Set the file that shall be processes
This should be a PostScript (ps), Enhanced Postscript (eps) or PortableDocumentformat (pdf) File.
string|\Org_Heigl\Ghostscript\SplFileInfo | $file | The File to use as input. |
when the provided file is not supported
None found |
getInputFile() : \Org_Heigl\Ghostscript\SplFileInfo
Get the file that shall be processed
None found |
setOutputFile(string $name = 'output') : \Org_Heigl\Ghostscript\Ghostscript
Set the name of the output file(s)
This name does not need a file-extension as that is set from the output format.
The name can contain a placeholder like '%d' or '%02d'. This will be replaced by the pagenumber of the processed page. For more information on the format see the PHP documentation for sprintf
string | $name | The filename |
None found |
getOutputFile() : string
Get the output filename.
This is NOT the name the file can be retrieved with as Ghostscript can modify the filename, but the returned string containes the directory the file(s) reside in.
None found |
getBasePath() : string
Get the basepath of the execution.
Thisis set to the directory containing $_infile.
If $_infile is not set, it is set to the systems default tmp-directory.
None found |
getRenderString() : string
Get the command-line that can be executed via exec
None found |
isGraphicsAntiAliasingSet() : boolean
Check whether Anti ALiasing for graphics is set
None found |
setGraphicsAntiAliasing(integer $level) : self
Set graphics-AntiAliasing
integer | $level | The AntiaAliasing level to set. |
None found |
getGraphicsAntiAliasing() : integer
Get the text-AntiAliasing level
None found |
isTextAntiAliasingSet() : boolean
Check whether Anti ALiasing for text is set
None found |
setTextAntiAliasing(integer $level) : self
Set text-AntiAliasing
integer | $level | The AntiaAliasing level to set. |
None found |
getTextAntiAliasing() : integer
Get the text-AntiAliasing level
None found |
setResolution( $horizontal, $vertical = null) : self
Set the resolution for the rendering
$horizontal | ||
$vertical |
None found |
setDevice(\Org_Heigl\Ghostscript\Device\DeviceInterface|string $device) : self
Set the output-device
\Org_Heigl\Ghostscript\Device\DeviceInterface|string | $device |
None found |
getDevice() : \Org_Heigl\Ghostscript\Device\DeviceInterface
Get the device-object
None found |
setUseCie( $useCie = true) : self
Set whether to use the CIE-Map for conversion between CMYK and RGB or not
$useCie |
None found |
None found |
useBox(string $box)
Which Box shall be used to generate the output from.
This can be one of
string | $box | The box to use @return self |
None found |
getBox() : string|null
Get the name of the box to be used for rendering
This returns either 'crop' or 'media' if one of these boxes shall be rendered or NULL if the switch shall not be set.
None found |
setDefaultProfile(string $profile, string $space = null) : self
Add the given Profile for Color-Management as Input-Profile.
The Profile will be added as CSA-File to perform the translation of Colors from the Input-File to the Internal ProcessColosSpace.
The CSA-File can be created via the OpenSource-Tool icc2ps from the littleCMS-Package available at http://www.littlecms.org
The CSA-File can be generated via the following command from any
icc-file:
icc2ps -i
This gerneated CSA-File has to be adapted according to the following
example:
currentglobal true setglobal
/DefaultCMYK
[ /CIEBasedDEFG
<<
...
...
] /ColorSpace defineresource pop setglobal where the Part in the brackets is the part that is generated from the icc2ps-tool.
For more Information on Color-Conversion and Color-Management refer to the Homepage of ghostscript, the ICC or have a look at a Search-Engine.
string | $profile | The Name of the CSA-Profile to use or the complete path to an appropriate CSA-File. |
string | $space | The Color-Space to set the profile for. This can be one of 'rgb', 'cmyk' or 'gray'. This parameter is currently not supported! |
None found |
getDefaultProfile( $space = 'cmyk') : string|false
Get the default Input-Profile
$space |
None found |
setDeviceProfile(string $profile) : self
Add the given Profile for Color-Management as Device-Output-Profile.
The Profile will be added as CRD-File to perform the translation of Colors from the Internal ProcessColorSpace to the Output-File.
The CRD-File can be created via the OpenSource-Tool icc2ps from the littleCMS-Package available at http://www.littlecms.org
The CRD-File can be generated via the following command from any
icc-file:
icc2ps -o
This gerneated CRD-File has to be adapted by appeding the following
line to it:
/Current /ColorRendering findresource setcolorrendering
For more Information on Color-Conversion and Color-Management refer to the Homepage of ghostscript, the ICC or have a look at a Search-Engine.
string | $profile | The Name of the CRD-Profile to use or the complete path to an appropriate CRD-File. |
None found |
getDeviceProfile() : string|false
Get the currently set device-Profile
None found |
setPageStart(integer $page) : self
Set the page to start rendering
integer | $page |
None found |
setPageEnd(integer $page) : self
Set the page to stop rendering
integer | $page |
None found |