Cube.Pdf.Ghostscript 2.13.0

Library to wwap Ghostscript in .NET Framework.

Install-Package Cube.Pdf.Ghostscript -Version 2.13.0
dotnet add package Cube.Pdf.Ghostscript --version 2.13.0
paket add Cube.Pdf.Ghostscript --version 2.13.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

AppVeyor Codecov

Cube.Pdf.Ghostscript is a wrapper library of the Ghostscript, which is available for .NET Framework 3.5, 4.5 or more. Note that the Cube.Pdf.Ghostscript library is available for NuGet, but you need to copy the gsdll32.dll to the executing directory manually. You can download the DLL from www.ghostscript.com or our GitHub releases.

Usage

Cube.Pdf.Ghostscript.Converter is the base class of other converter classes and a thin wrapper of the Ghostscript API. Basic interfaces of converters are as follows:

public class Converter
{
    public Converter(Format format);
    public ICollection<Argument> Options;
    public ICollection<Code> Codes;
    public void Invoke(string src, string dest);
}

When you convert a PostScript file to any other formats, you specify the target format at the constructor of the Converter class, add some options, and finally execute the Invoke method. The Ghostscript API has two kinds of parameters, one is normal arguments and the other is PostScript codes. Options and Codes properties of the Converter class correspond respectively.

Instead of using the Converter class directly, you can use some inherited classes according to your purpose. For example, the following code converts to the PDF format.

// using Cube.Pdf.Ghostscript;
var converter = new PdfConverter
{
    Paper        = Paper.Auto,
    Orientation  = Orientation.Auto,
    ColorMode    = ColorMode.Rgb,
    Resolution   = 600,
    Compression  = Encoding.Jpeg,
    Downsampling = Downsampling.None,
    Version      = new Version(1, 7),
};
converter.Invoke(@"path\to\src.ps", @"path\to\dest.pdf");

When you set values to the properties, Converter inherited classes automatically create and add the corresponding arguments or PostScript codes to the Ghostscript API. The library provides the following variations. All available formats and other options are defined in the Parameters directory.

When you need to add some options manually, you create a new instance of the Argument class and add it to the Options property. Constructors of the Argument class are as follows:

public class Argument
{
    public Argument(string name, string value);
    public Argument(string name, bool value);
    public Argument(string name, int value);
    public Argument(char type);
    public Argument(char type, int value);
    public Argument(char type, string name);
    public Argument(char type, string name, bool value);
    public Argument(char type, string name, int value);
    public Argument(char type, string name, string value);
    public Argument(char type, string name, string value, bool literal);
}

Dependencies

Contributing

  1. Fork Cube.Pdf repository.
  2. Create a feature branch from the stable branch (git checkout -b my-new-feature origin/stable). The master branch may refer some pre-released NuGet packages. See AppVeyor.yml if you want to build and commit in the master branch.
  3. Commit your changes.
  4. Rebase your local changes against the stable (or master) branch.
  5. Run test suite with the NUnit console or the Visual Studio (NUnit 3 test adapter) and confirm that it passes.
  6. Create new Pull Request.

License

Copyright © 2010 CubeSoft, Inc. The Cube.Pdf.Ghostscript library is licensed under the GNU AGPLv3.

AppVeyor Codecov

Cube.Pdf.Ghostscript is a wrapper library of the Ghostscript, which is available for .NET Framework 3.5, 4.5 or more. Note that the Cube.Pdf.Ghostscript library is available for NuGet, but you need to copy the gsdll32.dll to the executing directory manually. You can download the DLL from www.ghostscript.com or our GitHub releases.

Usage

Cube.Pdf.Ghostscript.Converter is the base class of other converter classes and a thin wrapper of the Ghostscript API. Basic interfaces of converters are as follows:

public class Converter
{
    public Converter(Format format);
    public ICollection<Argument> Options;
    public ICollection<Code> Codes;
    public void Invoke(string src, string dest);
}

When you convert a PostScript file to any other formats, you specify the target format at the constructor of the Converter class, add some options, and finally execute the Invoke method. The Ghostscript API has two kinds of parameters, one is normal arguments and the other is PostScript codes. Options and Codes properties of the Converter class correspond respectively.

Instead of using the Converter class directly, you can use some inherited classes according to your purpose. For example, the following code converts to the PDF format.

// using Cube.Pdf.Ghostscript;
var converter = new PdfConverter
{
    Paper        = Paper.Auto,
    Orientation  = Orientation.Auto,
    ColorMode    = ColorMode.Rgb,
    Resolution   = 600,
    Compression  = Encoding.Jpeg,
    Downsampling = Downsampling.None,
    Version      = new Version(1, 7),
};
converter.Invoke(@"path\to\src.ps", @"path\to\dest.pdf");

When you set values to the properties, Converter inherited classes automatically create and add the corresponding arguments or PostScript codes to the Ghostscript API. The library provides the following variations. All available formats and other options are defined in the Parameters directory.

When you need to add some options manually, you create a new instance of the Argument class and add it to the Options property. Constructors of the Argument class are as follows:

public class Argument
{
    public Argument(string name, string value);
    public Argument(string name, bool value);
    public Argument(string name, int value);
    public Argument(char type);
    public Argument(char type, int value);
    public Argument(char type, string name);
    public Argument(char type, string name, bool value);
    public Argument(char type, string name, int value);
    public Argument(char type, string name, string value);
    public Argument(char type, string name, string value, bool literal);
}

Dependencies

Contributing

  1. Fork Cube.Pdf repository.
  2. Create a feature branch from the stable branch (git checkout -b my-new-feature origin/stable). The master branch may refer some pre-released NuGet packages. See AppVeyor.yml if you want to build and commit in the master branch.
  3. Commit your changes.
  4. Rebase your local changes against the stable (or master) branch.
  5. Run test suite with the NUnit console or the Visual Studio (NUnit 3 test adapter) and confirm that it passes.
  6. Create new Pull Request.

License

Copyright © 2010 CubeSoft, Inc. The Cube.Pdf.Ghostscript library is licensed under the GNU AGPLv3.

Version History

Version Downloads Last updated
2.13.0 47 11/20/2018
2.12.0 50 10/23/2018
2.11.0 62 9/28/2018