Cube.Pdf.Ghostscript 2.17.0

Ghostscript based PDF library available for the .NET Framework 3.5, 4.5, or later.

There is a newer version of this package available.
See the version list below for details.
Install-Package Cube.Pdf.Ghostscript -Version 2.17.0
dotnet add package Cube.Pdf.Ghostscript --version 2.17.0
<PackageReference Include="Cube.Pdf.Ghostscript" Version="2.17.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cube.Pdf.Ghostscript --version 2.17.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Cube.Pdf.Ghostscript, 2.17.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Cube.Pdf.Ghostscript as a Cake Addin
#addin nuget:?package=Cube.Pdf.Ghostscript&version=2.17.0

// Install Cube.Pdf.Ghostscript as a Cake Tool
#tool nuget:?package=Cube.Pdf.Ghostscript&version=2.17.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

AppVeyor Azure Pipelines Codecov

Cube.Pdf.Ghostscript is a library to use the Ghostscript in the .NET Framework 3.5, 4.5, or later.
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 Cube.Native.Ghostscript NuGet package.

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:

// using System.Collections.Generics;
// using Cube.Pdf.Ghostscript;

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;
// 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 PdfVersion(1, 7),
};
converter.Invoke(@"path\to\src.ps", @"path\to\dest.pdf");

When you set values to the properties, Converter inherited classes automatically 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:

// using Cube.Pdf.Ghostscript;

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 master or stable branch (e.g. git checkout -b my-new-feature origin/master). Note that the master branch may refer to some pre-release NuGet packages. Try the rake clean and copy commands when build errors occur.
  3. Commit your changes.
  4. Rebase your local changes against the master or stable branch.
  5. Run test suite with the NUnit console or the Visual Studio (NUnit 3 test adapter) and confirm that it passes.
  6. Create a new Pull Request.

License

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

AppVeyor Azure Pipelines Codecov

Cube.Pdf.Ghostscript is a library to use the Ghostscript in the .NET Framework 3.5, 4.5, or later.
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 Cube.Native.Ghostscript NuGet package.

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:

// using System.Collections.Generics;
// using Cube.Pdf.Ghostscript;

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;
// 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 PdfVersion(1, 7),
};
converter.Invoke(@"path\to\src.ps", @"path\to\dest.pdf");

When you set values to the properties, Converter inherited classes automatically 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:

// using Cube.Pdf.Ghostscript;

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 master or stable branch (e.g. git checkout -b my-new-feature origin/master). Note that the master branch may refer to some pre-release NuGet packages. Try the rake clean and copy commands when build errors occur.
  3. Commit your changes.
  4. Rebase your local changes against the master or stable branch.
  5. Run test suite with the NUnit console or the Visual Studio (NUnit 3 test adapter) and confirm that it passes.
  6. Create a new Pull Request.

License

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

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Cube.Pdf.Ghostscript:

Package Downloads
Cube.Pdf.Converter
Core module of the CubePDF application.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.1.4 79 5/12/2021
3.1.3 78 4/15/2021
3.1.2 127 2/9/2021
3.1.1 180 12/4/2020
3.1.0 203 11/11/2020
3.0.0 194 10/7/2020
2.20.2 244 9/8/2020
2.20.1 245 7/28/2020
2.20.0 332 6/9/2020
2.18.4 254 4/27/2020
2.18.2 235 4/15/2020
2.18.1 392 11/25/2019
2.18.0 270 11/12/2019
2.17.0 386 8/2/2019
2.16.1 338 7/3/2019
2.16.0 365 6/21/2019
2.15.0 365 4/19/2019
2.14.0 425 2/17/2019
2.13.0 448 11/20/2018
2.12.0 408 10/23/2018
2.11.0 445 9/28/2018
Show less