Cube.Pdf.Generating
9.1.0
dotnet add package Cube.Pdf.Generating --version 9.1.0
NuGet\Install-Package Cube.Pdf.Generating -Version 9.1.0
<PackageReference Include="Cube.Pdf.Generating" Version="9.1.0" />
paket add Cube.Pdf.Generating --version 9.1.0
#r "nuget: Cube.Pdf.Generating, 9.1.0"
// Install Cube.Pdf.Generating as a Cake Addin #addin nuget:?package=Cube.Pdf.Generating&version=9.1.0 // Install Cube.Pdf.Generating as a Cake Tool #tool nuget:?package=Cube.Pdf.Generating&version=9.1.0
Cube.Pdf.Generating
The Cube.Pdf.Generating package provides the wrapper APIs for the Ghostscript in the .NET Framework 3.5, 4.6, .NET Standard 2.0, or later. Note that the library reuqires the gsdll32.dll. You can download the DLL from www.ghostscript.com or Cube.Native.Pdfgen 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.
- DocumentConverter ... PS/EPS/PDF
- ImageConverter ... PNG/JPEG/BMP/TIFF
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);
}
Contributing
- Fork Cube.Pdf repository.
- Create a feature branch from the master 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 clobber and copy commands when build errors occur.
- Commit your changes.
- Rebase your local changes to the master branch.
- Run the dotnet test command or the Visual Studio (NUnit 3 test adapter) and confirm that it passes.
- Create a new Pull Request.
License
Copyright © 2010 CubeSoft, Inc. See License.md for more information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net35 is compatible. net40 was computed. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 3.5
- Cube.Native.Pdfgen (>= 10.4.0)
- Cube.Pdf (>= 9.1.0)
-
.NETFramework 4.6
- Cube.Native.Pdfgen (>= 10.4.0)
- Cube.Pdf (>= 9.1.0)
-
.NETStandard 2.0
- Cube.Native.Pdfgen (>= 10.4.0)
- Cube.Pdf (>= 9.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Cube.Pdf.Generating:
Package | Downloads |
---|---|
Cube.Pdf.Converter
Core module of the CubePDF application. |
GitHub repositories
This package is not used by any popular GitHub repositories.