Class PrinceControl
Class for creating persistent Prince control processes that can be used for multiple consecutive document conversions.
Inherited Members
Namespace: PrinceXML.Wrapper
Assembly: PrinceXML.Wrapper.dll
Syntax
public class PrinceControl : PrinceBase
Constructors
| Improve this Doc View SourcePrinceControl(String, PrinceEvents)
Constructor for PrinceControl
.
Declaration
public PrinceControl(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 SourceVersion
Get the version string for the running Prince process.
Declaration
public string Version { get; }
Property Value
Type | Description |
---|---|
System.String | The version string. |
Methods
| Improve this Doc View SourceAddFileAttachment(Byte[], String, String)
Add a file attachment that will be attached to the PDF file.
Declaration
public void AddFileAttachment(byte[] attachment, string fileName, string description)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | attachment | The file attachment as a byte array. |
System.String | fileName | The filename of the file attachment. |
System.String | description | The description of the file attachment. |
AddPdfEventScript(PdfEvent, Byte[])
Include an AcrosJS script to run on a specific event.
Declaration
public void AddPdfEventScript(PdfEvent pdfEvent, byte[] pdfScript)
Parameters
Type | Name | Description |
---|---|---|
PdfEvent | pdfEvent | The PDF event. |
System.Byte[] | pdfScript | The AcroJS script as a byte array. |
AddScript(Byte[])
Add a JavaScript script that will run before conversion.
Declaration
public void AddScript(byte[] script)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | script | The script as a byte array. |
AddStyleSheet(Byte[])
Add a CSS style sheet that will be applied to each input document.
Declaration
public void AddStyleSheet(byte[] styleSheet)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | styleSheet | The CSS style sheet as a byte array. |
Convert(List<String>, Stream)
Convert multiple XML or HTML files to a PDF file.
Declaration
public override bool Convert(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 PDF output. |
Returns
Type | Description |
---|---|
System.Boolean | true if a PDF file was generated successfully. |
Overrides
| Improve this Doc View SourceConvert(Stream, Stream)
Convert an XML or HTML stream to a PDF file. Note that it may be helpful to
specify a base URL or path from the input document using BaseUrl
.
This allows relative URLs and paths in the document (e.g. for images) to be
resolved correctly.
Declaration
public override bool Convert(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 PDF output. |
Returns
Type | Description |
---|---|
System.Boolean | true if a PDF file was generated successfully. |
Overrides
| Improve this Doc View SourceConvert(String, Stream)
Convert an XML or HTML file to a PDF file.
Declaration
public override bool Convert(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 PDF output. |
Returns
Type | Description |
---|---|
System.Boolean | true if a PDF file was generated successfully. |
Overrides
| Improve this Doc View SourceConvertString(String, Stream)
Convert an XML or HTML string to a PDF file.
Declaration
public override bool ConvertString(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 PDF output. |
Returns
Type | Description |
---|---|
System.Boolean | true if a PDF file was generated successfully. |
Overrides
| Improve this Doc View SourceSetPdfScript(Byte[])
Include an AcroJS script to run when the PDF is opened.
Declaration
public void SetPdfScript(byte[] pdfScript)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | pdfScript | The AcroJS script as a byte array. |
Start()
Start a Prince control process that can be used for multiple consecutive document conversions.
Declaration
public void Start()
Stop()
Stop the Prince control process.
Declaration
public void Stop()