-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a342ed
commit df16249
Showing
4 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Basic usage | ||
|
||
## Convert a PDF- or Postscript-File to a JPEG | ||
|
||
``` | ||
<?php | ||
use Org_Heigl\Ghostscript\Ghostscript; | ||
// Create the Ghostscript-Wrapper | ||
$gs = new Ghostscript (); | ||
// Set the output-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(Ghostscript::ANTIALIASING_HIGH); | ||
// Set the jpeg-quality to 100 (This is device-dependent!) | ||
->getDevice()->setQuality(100); | ||
// convert the input file to an image | ||
if (true === $gs->render()) { | ||
echo 'success'; | ||
} else { | ||
echo 'some error occured'; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters