Class Prince
Class that provides the default interface to Prince, where each document conversion invokes a new Prince process.
Inherited Members
Namespace: PrinceXML.Wrapper
Assembly: PrinceXML.Wrapper.dll
Syntax
public class Prince : PrinceBase
Constructors
| Improve this Doc View SourcePrince(String, PrinceEvents)
Constructor for Prince
Declaration
public Prince(string princePath, PrinceEvents events = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | princePath | The path of the Prince executable. For example, this may be
|
| PrinceEvents | events | An implementation of |
Properties
| Improve this Doc View SourceCssDpi
Changes the DPI of the "px" units in CSS.
Declaration
public int CssDpi { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The DPI of the "px" units. Value must be greater than 0. Default value is 96 dpi. |
NoSystemFonts
Disable the use of system fonts. Only fonts defined with font-face
rules in CSS will be available.
Declaration
public bool NoSystemFonts { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | true if system fonts are disabled. Default value is false. |
Options
Specify additional Prince command-line options.
Declaration
public List<(string, string)> Options { get; }
Property Value
| Type | Description |
|---|---|
| List<System.ValueTuple<System.String, System.String>> | The command line option, comprised of a key and an optional value.
Pass in a |
PageMargin
Specify the page margin.
Declaration
public string PageMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The page margin to use (e.g. "20mm"). |
PageSize
Specify the page size.
Declaration
public string PageSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The page size to use (e.g. "A4"). |
RasterBackground
Set the background. Can be used when rasterizing to an image format that supports transparency.
Declaration
public RasterBackground RasterBackground { get; set; }
Property Value
| Type | Description |
|---|---|
| RasterBackground | The raster background. Default value is |
RasterDpi
Specify the resolution of raster output.
Declaration
public int RasterDpi { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The raster output resolution. Vlaue must be greater than 0. Default value is 96 dpi. |
RasterFormat
Specify the format for the raster output.
Declaration
public RasterFormat RasterFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| RasterFormat | The format for the raster output. Default value is |
RasterJpegQuality
Specify the level of JPEG compression when generating raster output in JPEG format.
Declaration
public int RasterJpegQuality { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The level of JPEG compression. Valid range is between 0 and 100 inclusive. Default value is 92. |
RasterPage
Set the page number to be rasterized.
Declaration
public int RasterPage { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The page number to be rasterized. Value must be greater than 0. Defaults to rasterizing all pages. |
RasterThreads
Set the number of threads to use for multi-threaded rasterization.
Declaration
public int RasterThreads { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The number of threads to use. Default value is the number of cores and hyperthreads the system provides. |
Remaps
Rather than retrieving documents using a URL, remap them to a local directory.
Declaration
public List<(string, string)> Remaps { get; }
Property Value
| Type | Description |
|---|---|
| List<System.ValueTuple<System.String, System.String>> | A tuple, where the first value is a URL, and the second is the directory to remap that URL to. |
Methods
| Improve this Doc View SourceConvert(List<String>, Stream)
Class that provides the default interface to Prince, where each document conversion invokes a new Prince process.
Declaration
public override bool Convert(List<string> inputPaths, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| List<System.String> | inputPaths | |
| Stream | output |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
| Improve this Doc View SourceConvert(List<String>, String)
Convert multiple XML or HTML files to a PDF file.
Declaration
public bool Convert(List<string> inputPaths, string outputPath)
Parameters
| Type | Name | Description |
|---|---|---|
| List<System.String> | inputPaths | The filenames of the input XML or HTML documents. |
| System.String | outputPath | The filename of the output PDF file. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if a PDF file was generated successfully. |
Convert(Stream, Stream)
Class that provides the default interface to Prince, where each document conversion invokes a new Prince process.
Declaration
public override bool Convert(Stream input, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | input | |
| Stream | output |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
| Improve this Doc View SourceConvert(String, Stream)
Class that provides the default interface to Prince, where each document conversion invokes a new Prince process.
Declaration
public override bool Convert(string inputPath, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | inputPath | |
| Stream | output |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
| Improve this Doc View SourceConvert(String, String)
Convert an XML or HTML file to a PDF file.
Declaration
public bool Convert(string inputPath, string outputPath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | inputPath | The filename of the input XML or HTML document. |
| System.String | outputPath | The filename of the output PDF file. If not provided, the name of the output
file will be the same as the name of the input file, but with the |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if a PDF file was generated successfully. |
ConvertInputList(String, Stream)
Convert multiple XML or HTML files to a PDF file by reading an input list from a specified file. (An input list is a newline-separated sequence of file paths / URLs.)
Declaration
public bool ConvertInputList(string inputListPath, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | inputListPath | The path to the input list file. |
| Stream | output | The output Stream to which Prince will write the PDF output. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if a PDF file was generated successfully. |
ConvertInputList(String, String)
Convert multiple XML or HTML files to a PDF file by reading an input list from a specified file. (An input list is a newline-separated sequence of file paths / URLs.)
Declaration
public bool ConvertInputList(string inputListPath, string outputPath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | inputListPath | The path to the input list file. |
| System.String | outputPath | The filename of the output PDF file. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if a PDF file was generated successfully. |
ConvertString(String, Stream)
Class that provides the default interface to Prince, where each document conversion invokes a new Prince process.
Declaration
public override bool ConvertString(string input, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | input | |
| Stream | output |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
| Improve this Doc View SourceConvertString(String, String)
Convert an XML or HTML string to a PDF file.
Declaration
public bool ConvertString(string input, string outputPath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | input | The XML or HTML document in the form of a string. |
| System.String | outputPath | The filename of the output PDF file. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if a PDF file was generated successfully. |
Rasterize(List<String>, Stream)
Rasterize multiple XML or HTML files.
Declaration
public bool Rasterize(List<string> inputPaths, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| List<System.String> | inputPaths | The filenames of the input XML or HTML documents. |
| Stream | output | The output Stream to which Prince will write the raster output. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the input was successfully rasterized. |
Rasterize(List<String>, String)
Rasterize multiple XML or HTML files.
Declaration
public bool Rasterize(List<string> inputPaths, string outputPath)
Parameters
| Type | Name | Description |
|---|---|---|
| List<System.String> | inputPaths | The filenames of the input XML or HTML documents. |
| System.String | outputPath | A template string from which the raster files will be named (e.g. "page_%02d.png" will cause Prince to generate page_01.png, page_02.png, ..., page_10.png etc.). |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the input was successfully rasterized. |
Rasterize(Stream, Stream)
Rasterize an XML or HTML stream.
Declaration
public bool Rasterize(Stream input, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | input | The input Stream from which Prince will read the XML or HTML document. |
| Stream | output | The output Stream to which Prince will write the raster output. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the input was successfully rasterized. |
Rasterize(String, Stream)
Rasterize an XML or HTML file.
Declaration
public bool Rasterize(string inputPath, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | inputPath | The filename of the input XML or HTML document. |
| Stream | output | The output Stream to which Prince will write the raster output. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the input was successfully rasterized. |
Rasterize(String, String)
Rasterize an XML or HTML file.
Declaration
public bool Rasterize(string inputPath, string outputPath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | inputPath | The filename of the input XML or HTML document. |
| System.String | outputPath | A template string from which the raster files will be named (e.g. "page_%02d.png" will cause Prince to generate page_01.png, page_02.png, ..., page_10.png etc.). |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the input was successfully rasterized. |
RasterizeInputList(String, Stream)
Rasterize multiple XML or HTML files by reading an input list from a specified file. (An input list is a newline-separated sequence of file paths / URLs.)
Declaration
public bool RasterizeInputList(string inputListPath, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | inputListPath | The path to the input list file. |
| Stream | output | The output Stream to which Prince will write the raster output. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the input was successfully rasterized. |
RasterizeInputList(String, String)
Rasterize multiple XML or HTML files by reading an input list from a specified file. (An input list is a newline-separated sequence of file paths / URLs.)
Declaration
public bool RasterizeInputList(string inputListPath, string outputPath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | inputListPath | The path to the input list file. |
| System.String | outputPath | A template string from which the raster files will be named (e.g. "page_%02d.png" will cause Prince to generate page_01.png, page_02.png, ..., page_10.png etc.). |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the input was successfully rasterized. |
RasterizeString(String, Stream)
Rasterize an XML or HTML string.
Declaration
public bool RasterizeString(string input, Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | input | The XML or HTML document in the form of a string. |
| Stream | output | The output Stream to which Prince will write the raster output. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the input was successfully rasterized. |
RasterizeString(String, String)
Rasterize an XML or HTML string.
Declaration
public bool RasterizeString(string input, string outputPath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | input | The XML or HTML document in the form of a string. |
| System.String | outputPath | A template string from which the raster files will be named (e.g. "page_%02d.png" will cause Prince to generate page_01.png, page_02.png, ..., page_10.png etc.). |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the input was successfully rasterized. |