Class PrinceBase
Base class for Prince
and PrinceControl
.
Namespace: PrinceXML.Wrapper
Assembly: PrinceXML.Wrapper.dll
Syntax
public abstract class PrinceBase : object
Constructors
| Improve this Doc View SourcePrinceBase(String, PrinceEvents)
The PrinceBase
constructor.
Declaration
protected PrinceBase(string princePath, PrinceEvents events = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | princePath | |
PrinceEvents | events |
Properties
| Improve this Doc View SourceAllowAssembly
Used together with DisallowModify
, which creates an exception.
It allows the document to be inserted into another document or other
pages to be added, but the content of the document cannot be modified.
Declaration
public bool AllowAssembly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if assembly is allowed. Default value is false. |
AllowCopyForAccessibility
Used together with DisallowCopy
, which creates an exception by
enabling text access for screen reader devices for the visually impaired.
Declaration
public bool AllowCopyForAccessibility { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if text access is allowed. Default value is false. |
AuthMethods
HTTP authentication methods to enable.
Declaration
public List<AuthMethod> AuthMethods { get; }
Property Value
Type | Description |
---|---|
List<AuthMethod> | The authentication method to enable. |
AuthPassword
Specify the password for HTTP authentication.
Declaration
public string AuthPassword { get; set; }
Property Value
Type | Description |
---|---|
System.String | The password for authentication. |
AuthScheme
Send username and password credentials only for requests with the given scheme.
Declaration
public AuthScheme AuthScheme { get; set; }
Property Value
Type | Description |
---|---|
AuthScheme | The authentication scheme. |
AuthServer
Send username and password credentials to the specified server only.
Declaration
public string AuthServer { get; set; }
Property Value
Type | Description |
---|---|
System.String | The server to send credentials to (e.g. "localhost:8001"). The default is to send them to any server which challenges for authentication. |
AuthUser
Specify the username for HTTP authentication.
Declaration
public string AuthUser { get; set; }
Property Value
Type | Description |
---|---|
System.String | The username for authentication. |
BaseUrl
Specify the base URL of the input document. This can be used to override the path of the input document, which is convenient when processing local copies of a document from a website.
Declaration
public string BaseUrl { get; set; }
Property Value
Type | Description |
---|---|
System.String | The base URL or path of the input document. |
ConvertColors
Convert colors to output intent color space.
Declaration
public bool ConvertColors { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if colors are converted to output intent color space. Default value is false. |
CookieJar
Specify a file containing HTTP cookies.
Declaration
public string CookieJar { get; set; }
Property Value
Type | Description |
---|---|
System.String | The filename of the file containing HTTP cookies. |
Cookies
Add a value for the Set-Cookie
HTTP header value.
Declaration
public List<string> Cookies { get; }
Property Value
Type | Description |
---|---|
List<System.String> | The cookie to be added. |
Debug
Enable logging of debug messages.
Declaration
public bool Debug { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if debug logging is enabled. Default value is false. |
DisallowAnnotate
Disallow annotation of the PDF file.
Declaration
public bool DisallowAnnotate { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if annotation is disallowed. Default value is false. |
DisallowCopy
Disallow modification of the PDF file.
Declaration
public bool DisallowCopy { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if modification is disallowed. Default value is false. |
DisallowModify
Disallow modification of the PDF file.
Declaration
public bool DisallowModify { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if modification is disallowed. Default value is false. |
DisallowPrint
Disallow printing of the PDF file.
Declaration
public bool DisallowPrint { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if printing is disallowed. Default value is false. |
Encrypt
Specify whether encryption should be applied to the output file.
Declaration
public bool Encrypt { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if PDF encryption is enabled. Default value is false. |
FailDroppedContent
Fail-safe option that aborts the creation of a PDF if any content is dropped.
Declaration
public bool FailDroppedContent { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if fail-safe option is enabled. Default value is false. |
FailInvalidLicense
Fail-safe option that aborts the creation of a PDF if the Prince license is invalid or not readable.
Declaration
public bool FailInvalidLicense { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if fail-safe option is enabled. Default value is false. |
FailMissingGlyphs
Fail-safe option that aborts the creation of a PDF if glyphs cannot be found for any characters.
Declaration
public bool FailMissingGlyphs { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if fail-safe option is enabled. Default value is false. |
FailMissingResources
Fail-safe option that aborts the creation of a PDF if any resources cannot be loaded.
Declaration
public bool FailMissingResources { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if fail-safe option is enabled. Default value is false. |
FailPdfProfileError
Fail-safe option that aborts the creation of a PDF if there are problems complying with the specified PDF profile.
Declaration
public bool FailPdfProfileError { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if fail-safe option is enabled. Default value is false. |
FailPdfTagError
Fail-safe option that aborts the creation of a PDF if there are problems tagging the PDF for accessibility.
Declaration
public bool FailPdfTagError { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if fail-safe option is enabled. Default value is false. |
FailStrippedTransparency
Fail-safe option that aborts the creation of a PDF if transparent images are used with a PDF profile that does not support opacity.
Declaration
public bool FailStrippedTransparency { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if fail-safe option is enabled. Default value is false. |
FallbackCmykProfile
Set fallback ICC profile for uncalibrated CMYK.
Declaration
public string FallbackCmykProfile { get; set; }
Property Value
Type | Description |
---|---|
System.String | The fallback ICC profile. |
FileAttachments
File attachments that will be attached to the PDF file.
Declaration
public List<FileAttachment> FileAttachments { get; }
Property Value
Type | Description |
---|---|
List<FileAttachment> | The file attachment. |
ForceIdentityEncoding
Ensure that all fonts are encoded in the PDF using their identity encoding (directly mapping to glyph indices), even if they could have used MacRoman or some other encoding.
Declaration
public bool ForceIdentityEncoding { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if identity encoding is forced. Default value is false. |
HttpProxy
Specify the URL for the HTTP proxy server, if needed.
Declaration
public string HttpProxy { get; set; }
Property Value
Type | Description |
---|---|
System.String | The URL for the HTTP proxy server. |
HttpTimeout
Specify the timeout for HTTP requests.
Declaration
public int HttpTimeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The HTTP timeout in seconds. Value must be greater than 0. Default value is false. |
Iframes
Enable HTML iframes.
Declaration
public bool Iframes { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if HTML iframes is enabled. Default value is false. |
InputType
Specify the input type of the document. Setting this to InputType.Xml
or InputType.Html
is required if a document is provided via a
Stream
or string
, as the types of these documents cannot
be determined.
Declaration
public InputType InputType { get; set; }
Property Value
Type | Description |
---|---|
InputType | The document's input type. Default value is |
Insecure
Specify whether to disable SSL verification.
Declaration
public bool Insecure { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if SSL verification is disabled. Default value is false. |
JavaScript
Specify whether JavaScript found in documents should be run.
Declaration
public bool JavaScript { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if document scripts should run. Default value is false. |
KeyBits
Specify the size of the encryption key.
Declaration
public KeyBits? KeyBits { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<KeyBits> | The size of the encryption key. Default value is |
LicenseFile
Specify the license file.
Declaration
public string LicenseFile { get; set; }
Property Value
Type | Description |
---|---|
System.String | The filename of the license file. |
LicenseKey
Specify the license key. This is the <signature>
field in the
license file.
Declaration
public string LicenseKey { get; set; }
Property Value
Type | Description |
---|---|
System.String | The license key. |
Log
Specify a file that Prince should use to log messages. If this property
is not set, then Prince will not write to any log. This property does
not affect the operation of PrinceEvents
, which will also receive
messages from Prince.
Declaration
public string Log { get; set; }
Property Value
Type | Description |
---|---|
System.String | The filename that Prince uses to log messages. |
MaxPasses
Defines the maximum number of consequent layout passes.
Declaration
public int MaxPasses { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of maximum passes. Value must be greater than 0. Default value is unlimited passes. |
Media
Specify the media type.
Declaration
public string Media { get; set; }
Property Value
Type | Description |
---|---|
System.String | The media type (e.g. "print", "screen"). Default value is "print". |
NoArtificialFonts
Specify whether artificial bold/italic fonts should be generated if necessary.
Declaration
public bool NoArtificialFonts { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if artificial bold/italic fonts are disabled. Default value is false. |
NoAuthorStyle
Ignore author style sheets.
Declaration
public bool NoAuthorStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if author style sheets are ignored. Default value is false. |
NoAuthPreemptive
Do not authenticate with named servers until asked.
Declaration
public bool NoAuthPreemptive { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if authentication preemptive is disabled. Default value is false. |
NoCompress
Specify whether compression should be applied to the output PDF file.
Declaration
public bool NoCompress { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if PDF compression is disabled. Default value is false. |
NoDefaultStyle
Ignore default style sheets.
Declaration
public bool NoDefaultStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if default style sheets are ignored. Default value is false. |
NoEmbedFonts
Specify whether fonts should be embedded in the output PDF file.
Declaration
public bool NoEmbedFonts { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if PDF font embedding is disabled. Default value is false. |
NoNetwork
Disable network access (prevents HTTP downloads).
Declaration
public bool NoNetwork { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if network access is disabled. Default value is false. |
NoObjectStreams
Disable PDF object streams.
Declaration
public bool NoObjectStreams { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if PDF object streams are disabled. Default value is false. |
NoParallelDownloads
Disable downloading multiple HTTP resources at once.
Declaration
public bool NoParallelDownloads { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if parallel downloads are disabled. Default value is false. |
NoRedirects
Disable all HTTP and HTTPS redirects.
Declaration
public bool NoRedirects { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if redirects are disabled. Default value is false. |
NoSubsetFonts
Specify whether embedded fonts should be subset in the output PDF file.
Declaration
public bool NoSubsetFonts { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if PDF font subsetting is disabled. Default value is false. |
NoWarnCssUnknown
Disable warnings about unknown CSS features.
Declaration
public bool NoWarnCssUnknown { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if warnings are disabled. Default value is false. |
NoWarnCssUnsupported
Disable warnings about unsupported CSS features.
Declaration
public bool NoWarnCssUnsupported { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if warnings are disabled. Default value is false. |
OwnerPassword
Specify the owner password for the PDF file.
Declaration
public string OwnerPassword { get; set; }
Property Value
Type | Description |
---|---|
System.String | The owner password. |
PdfAuthor
Specify the document author for PDF metadata.
Declaration
public string PdfAuthor { get; set; }
Property Value
Type | Description |
---|---|
System.String | The document author. |
PdfCreator
Specify the document creator for PDF metadata.
Declaration
public string PdfCreator { get; set; }
Property Value
Type | Description |
---|---|
System.String | The document creator. |
PdfEventScripts
Include an AcrosJS script to run on a specific event.
Declaration
public Dictionary<PdfEvent, string> PdfEventScripts { get; }
Property Value
Type | Description |
---|---|
Dictionary<PdfEvent, System.String> | A mapping of PDF events to the filenames or URLs of the AcroJS scripts. |
PdfForms
Enable PDF forms by default.
Declaration
public bool PdfForms { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if PDF forms is enabled by default. Default value is false. |
PdfId
Specify the PDF ID to use.
Declaration
public string PdfId { get; set; }
Property Value
Type | Description |
---|---|
System.String | The PDF ID. |
PdfKeywords
Specify the document keywords for PDF metadata.
Declaration
public string PdfKeywords { get; set; }
Property Value
Type | Description |
---|---|
System.String | The document keywords. |
PdfLang
Specify the PDF document's Lang entry in the document catalog.
Declaration
public string PdfLang { get; set; }
Property Value
Type | Description |
---|---|
System.String | The PDF document's Lang entry. |
PdfOutputIntent
Specify the ICC profile to use.
Declaration
public string PdfOutputIntent { get; set; }
Property Value
Type | Description |
---|---|
System.String | The ICC profile. |
PdfProfile
Specify the PDF profile to use.
Declaration
public PdfProfile PdfProfile { get; set; }
Property Value
Type | Description |
---|---|
PdfProfile | The PDF profile. |
PdfScript
Include an AcroJS script to run when the PDF is opened.
Declaration
public string PdfScript { get; set; }
Property Value
Type | Description |
---|---|
System.String | The filename or URL of the AcroJS script. |
PdfSubject
Specify the document subject for PDF metadata.
Declaration
public string PdfSubject { get; set; }
Property Value
Type | Description |
---|---|
System.String | The document subject. |
PdfTitle
Specify the document title for PDF metadata.
Declaration
public string PdfTitle { get; set; }
Property Value
Type | Description |
---|---|
System.String | The document title. |
Scripts
JavaScript scripts that will run before conversion.
Declaration
public List<string> Scripts { get; }
Property Value
Type | Description |
---|---|
List<System.String> | The filename of the script to run. |
SslCaCert
Specify an SSL certificate file.
Declaration
public string SslCaCert { get; set; }
Property Value
Type | Description |
---|---|
System.String | The filename of the SSL certificate file. |
SslCaPath
Specify an SSL certificate directory.
Declaration
public string SslCaPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | The SSL certificate directory. |
SslCert
Specify an SSL client certificate file. On MacOS, specify a PKCS#12 file containing a client certificate and private key. Client authentication is not supported on Windows.
Declaration
public string SslCert { get; set; }
Property Value
Type | Description |
---|---|
System.String | The filename of the SSL client certificate file. |
SslCertType
Specify the SSL client certificate file type. This option is not supported on MacOS or Windows.
Declaration
public SslType SslCertType { get; set; }
Property Value
Type | Description |
---|---|
SslType | The SSL client certificate file type. |
SslKey
Specify an SSL private key file. This option is not supported on MacOS or Windows.
Declaration
public string SslKey { get; set; }
Property Value
Type | Description |
---|---|
System.String | The filename of the SSL private key file. |
SslKeyPassword
Specify a password for the SSL private key.
Declaration
public string SslKeyPassword { get; set; }
Property Value
Type | Description |
---|---|
System.String | The password for the SSL private key. |
SslKeyType
Specify the SSL private key file type. This option is not supported on MacOS or Windows.
Declaration
public SslType SslKeyType { get; set; }
Property Value
Type | Description |
---|---|
SslType | The SSL private key file type. |
SslVersion
Set the minimum version of SSL to allow.
Declaration
public SslVersion SslVersion { get; set; }
Property Value
Type | Description |
---|---|
SslVersion | The minimum version to allow. Default value is |
StyleSheets
CSS style sheets that will be applied to each input document.
Declaration
public List<string> StyleSheets { get; }
Property Value
Type | Description |
---|---|
List<System.String> | The filename of the CSS style sheet to apply. |
TaggedPdf
Enable tagged PDF.
Declaration
public bool TaggedPdf { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if tagged PDF is enabled. Default value is false. |
UserPassword
Specify the user password for the PDF file.
Declaration
public string UserPassword { get; set; }
Property Value
Type | Description |
---|---|
System.String | The user password. |
Verbose
Enable logging of informative messages.
Declaration
public bool Verbose { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if verbose logging is enabled. Default value is false. |
XInclude
Enable XInclude and XML external entities (XXE). Note that XInclude only
applies to XML files. To apply it to HTML files, the input format needs
to be specified by setting InputType
.
Declaration
public bool XInclude { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if XInclude and XXE are enabled. Default value is false. |
XmlExternalEntities
Enable XML external entities (XXE).
Declaration
public bool XmlExternalEntities { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if XXE is enabled. Default value is false. |
Xmp
Specify an XMP file that contains XMP metadata to be included in the output PDF file.
Declaration
public string Xmp { get; set; }
Property Value
Type | Description |
---|---|
System.String | The filename of the XMP file. |
Methods
| Improve this Doc View SourceAddFileAttachment(String)
Add a file attachment that will be attached to the PDF file.
Declaration
public void AddFileAttachment(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL of the file attachment. |
Convert(List<String>, Stream)
Convert multiple XML or HTML files to a PDF file.
Declaration
public abstract 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. |
Convert(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 abstract 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. |
Convert(String, Stream)
Convert an XML or HTML file to a PDF file.
Declaration
public abstract 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. |
ConvertString(String, Stream)
Convert an XML or HTML string to a PDF file.
Declaration
public abstract 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. |
FailSafe(Boolean)
Enables/disables all fail-safe options.
Declaration
public void FailSafe(bool failSafe)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | failSafe | The value to set all fail-safe options to. |
GetBaseCommandLine()
The common base command lines used by Prince and the Prince control interface.
Declaration
protected List<string> GetBaseCommandLine()
Returns
Type | Description |
---|---|
List<System.String> | A list of base command lines. |
ReadMessages(StreamReader)
Handle (structured) messages received from Prince.
Declaration
protected bool ReadMessages(StreamReader reader)
Parameters
Type | Name | Description |
---|---|---|
StreamReader | reader | The reader for messages received from Prince. |
Returns
Type | Description |
---|---|
System.Boolean | true if Prince returns a "success" message. |
StartPrince(List<String>)
Starts a Prince process.
Declaration
protected Process StartPrince(List<string> args)
Parameters
Type | Name | Description |
---|---|---|
List<System.String> | args | The command line arguments for Prince. |
Returns
Type | Description |
---|---|
Process | The Prince process. |