Contents [ ]
  • NAME
  • VERSION
  • SYNOPSIS
  • DESCRIPTION
    • psconvert
      • Enter specs
      • Output choices
    • Paper Sizes
  • DIAGNOSTICS
  • CONFIGURATION AND ENVIRONMENT
  • DEPENDENCIES
  • INCOMPATIBILITIES
  • BUGS AND LIMITATIONS
  • AUTHOR
  • COPYRIGHT AND LICENSE
  • DISCLAIMER OF WARRANTY

NAME

PostScript::Convert – Use Ghostscript to transform PostScript or PDF to different codecs

VERSION

This doc describes model 0.03 of PostScript::Convert, launched March 15, 2014.

SYNOPSIS

use PostScript::Convert;
 
psconvert($filename, $output_filename);
 
# Base output filename on enter filename:
psconvert($filename, format => 'pdf');
 
my $postscript = "%!PS-Adobe-3.0 ...";
psconvert($postscript, $output_filename);
 
my $ps = PostScript::File->new;
$ps->add_to_page(...);
psconvert($ps, filename => $output_filename, format => 'pnggray');

DESCRIPTION

PostScript::Convert makes use of Ghostscript to transform PostScript or PDF to different codecs. You’ll need to have Ghostscript put in.

It exports a single perform:

psconvert

psconvert($enter, [$output_filename], [options...])

This takes the PostScript code or PDF file pointed to by $enter and processes it by means of Ghostscript. The return worth shouldn’t be significant. It throws an exception if an error happens.

Enter specs

$enter have to be one of many following:

A string

That is interpreted as a filename to open.

A scalar reference

This have to be a reference to a string containing a PostScript doc.

An array reference

This have to be a reference to an array of strings, which when joined collectively kind a PostScript doc. No newlines are added when becoming a member of.

An open filehandle

Any argument accepted by “openhandle” in Scalar::Util is interpreted as a filehandle to learn from.

A PostScript::File object

Observe: in eps mode, this may generate a number of output information if the doc has a number of pages.

Another object

The item should implement a get__PostScript_File methodology that returns a PostScript::File object. (Observe: there are 2 underscores after get)

Output choices

The remaining arguments after $enter are key-value pairs that management the output. If there are an odd variety of arguments following $enter, then the primary one is the filename.

Choices added since model 0.01 are marked with the model they had been added in (e.g. “(v0.02)”).

filename

That is the output filename. If omitted, it will likely be calculated from enter and format.

format

That is the output format. If omitted, it will likely be taken from the extension of filename. Accepted codecs are:

png

24-bit coloration PNG

pnggray

8-bit grayscale PNG

pngmono

1-bit monochrome PNG

pdf

The popular PDF model (at present 1.4, however topic to vary).

pdf14

PDF model 1.4 (Acrobat 5.0 – 2001)

pdf13

PDF model 1.3 (Acrobat 4.0 – 1999)

pdf12

PDF model 1.2 (Acrobat 3.0 – 1996)

jpg

(v0.03) coloration JPEG with default extension .jpg (Observe: JPEG encoding shouldn’t be beneficial. It is designed for photo-realistic pictures, not the textual content and line artwork extra generally present in PostScript information.)

You’ll be able to management the compression high quality by utilizing gs_param => ['-dJPEGQ=N'] (the place N is an integer from 0 to 100). The default is dependent upon your Ghostscript, however is normally 75.

jpeg

(v0.03) coloration JPEG with default extension .jpeg

jpeggray

(v0.03) grayscale JPEG with default extension .jpeg

ghostscript

That is the Ghostscript executable to make use of. It defaults to gs, besides on Microsoft Home windows, the place it’s gswin32c.exe. (It’s possible you’ll use a pathname right here.)

embrace

An arrayref of directories so as to add to Ghostscript’s search path (for superior customers solely).

enter

That is the enter filename. (That is used just for calculating filename when vital. It doesn’t imply to really learn from this file, and it needn’t exist on disk.) If omitted, it will likely be taken from $enter (if that may be a filename or a PostScript::File object containing a filename).

paper_size

(v0.02) The specified output paper measurement. This is usually a string indicating a recognized paper measurement, a string of the shape WIDTHxHEIGHT (the place WIDTH and HEIGHT are in inches), or an arrayref of two numbers [ WIDTH, HEIGHT ] (the place WIDTH and HEIGHT are in factors). If omitted, Ghostscript will use its default paper measurement, until you move a PostScript::File object (or an object that provides a PostScript::File), by which case the paper measurement will likely be taken from that object.

decision

(v0.02) The specified output decision in pixels per inch. That is both a string of two integers separated by x (XRESxYRES) or a single integer (if the X and Y decision needs to be the identical). (Handed to gs as its -r possibility.)

gadget

The Ghostscript gadget to make use of (for superior customers solely). That is usually set robotically from the format.

gs_param

An arrayref of further parameters to move to Ghostscript (for superior customers solely).

unsafe

Ghostscript is often run with -dSAFER, which prevents the PostScript code from accessing the filesystem. Passing unsafe => 1 will use -dNOSAFER as an alternative. Do not do that until you belief the PostScript code you might be changing.

See also  Super Nintendo (SNES)

Paper Sizes

Paper sizes will not be case delicate. These are the recognized sizes: “comm #10 envelope”, “envelope-c5”, “envelope-dl”, “envelope-monarch”, europostcard, govt, folio, “half-letter”, ledger, authorized, letter, very good, tabloid, “us-legal”, “us-letter”, A0 – A10, B0 – B10.

DIAGNOSTICS

Cannot %s STDIN: %s

There was an error whereas redirecting STDIN with a purpose to run Ghostscript.

Cannot search non permanent file: %s

A search failed for the required cause.

Do not know find out how to deal with a %s

You handed an object that psconvert does not settle for as $enter.

Do not know find out how to deal with a %s ref

psconvert solely accepts a scalar or array reference as $enter.

Anticipated extension in %s

The non permanent filename created by PostScript::File should have an extension, but it surely did not.

Ghostscript failed: exit standing %s

Ghostscript didn’t exit efficiently. The exit standing is reported as a decimal quantity ($? >> 8), adopted by ” (signal %d)” if $? & 127 is non-zero, adopted by ” (core dumped)” if $? & 128.

ghostscript not outlined

The ghostscript possibility was one way or the other unset. This should not occur, because it has a default worth.

Should have PostScript::File 2.00 or later, that is solely %s

PostScript::Convert is not straight appropriate with variations of PostScript::File older than 2.00. (If you cannot improve PostScript::File, then you may write the PostScript to a file and move that file to psconvert.)

No extension outlined for format %s

The required format did not outline a file extension.

No extension in %s

The output filename should have a file extension.

No output gadget provided

The gadget possibility (which usually comes from the format) was not set.

No output filename provided

You did not specify an output filename, nor did you present an enter filename to guess it from.

No output format or filename provided

You did not specify the format possibility, nor did you provide an output filename from which to guess it.

Unable to find out format from %s

You did not specify the format possibility, and the output filename you provided does not match any recognized format.

Unable to open %s: %s

Opening the required file failed for the required cause.

Unknown format %s

The format you specified shouldn’t be legitimate.

Unknown paper measurement %s

The paper_size you specified shouldn’t be legitimate.

See also  Krita FAQ ¶

CONFIGURATION AND ENVIRONMENT

PostScript::Convert expects to discover a Ghostscript executable someplace in your $ENV{PATH}. (See the ghostscript possibility for particulars.)

DEPENDENCIES

PostScript::Convert is dependent upon Carp, Exporter, File::Spec, File::Temp, and Scalar::Util. All of those are core modules, however chances are you’ll want to put in a more recent model of File::Temp.

It additionally requires you to have Ghostscript (http://pages.cs.wisc.edu/~ghost/) put in someplace in your PATH, until you employ the ghostscript choice to specify its location.

INCOMPATIBILITIES

PostScript::Convert shouldn’t be appropriate with variations of PostScript::File older than 2.00. (Nevertheless, you would have an older model of PostScript::File write the PostScript to a file, after which move that file to psconvert.)

BUGS AND LIMITATIONS

No bugs have been reported.

AUTHOR

Christopher J. Madsen <perl AT cjmweb.web>

Please report any bugs or characteristic requests to <bug-PostScript-Convert AT rt.cpan.org> or by means of the net interface at http://rt.cpan.org/Public/Bug/Report.html?Queue=PostScript-Convert.

You’ll be able to observe or contribute to PostScript-Convert’s improvement at https://github.com/madsen/postscript-convert.

COPYRIGHT AND LICENSE

This software program is copyright (c) 2014 by Christopher J. Madsen.

That is free software program; you may redistribute it and/or modify it underneath the identical phrases because the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

See also  Slenderman GTA 5, over 80%

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Leave a Reply

Your email address will not be published.