Prince.dll
PrinceCom.Prince
Public Sub SetPrincePath(ByVal exePath As String)
Public Function Convert(ByVal xmlPath As String, _
Optional ByVal pdfPath As String = "") As Long
Public Function ConvertMultiple(ByRef xmlPaths() As String, ByVal pdfPath As String)
Public Sub AddStyleSheet(ByVal cssPath As String)
Public Sub ClearStyleSheets()
Public Sub AddScript(ByVal jsPath As String)
Public Sub ClearScripts()
Public Sub AddFileAttachment(ByVal filePath As String)
Public Sub ClearFileAttachments()
Public Sub SetLicenseFile(ByVal file As String)
Public Sub SetLicenseKey(ByVal key As String)
Public Sub SetInputType(ByVal inputType As String)
Public Sub SetJavaScript(ByVal js As Boolean)
Public Sub SetHTML(ByVal html As Boolean)
Public Sub SetLog(ByVal logFile As String)
Public Sub SetBaseURL(ByVal baseurl As String)
Public Sub SetXInclude(ByVal xinclude As Boolean)
Public Sub SetHttpUser(ByVal user As String)
Public Sub SetHttpPassword(ByVal password As String)
Public Sub SetHttpProxy(ByVal proxy As String)
Public Sub SetInsecure(ByVal insecure As Boolean)
Public Sub SetFileRoot(ByVal fileRoot As String)
Public Sub SetEmbedFonts(ByVal embed As Boolean)
Public Sub SetSubsetFonts(ByVal subset As Boolean)
Public Sub SetCompress(ByVal compress As Boolean)
Public Sub SetExtraOptions(ByVal extra As String)
Public Sub SetEncrypt(ByVal encrypt As Boolean)
Public Sub SetEncryptInfo(ByVal keyBits As Integer, _
ByVal userPassword As String, _
ByVal ownerPassword As String, _
ByVal disallowPrint As Boolean, _
ByVal disallowModify As Boolean, _
ByVal disallowCopy As Boolean, _
ByVal disallowAnnotate As Boolean)
Notes:
SetPrincePath
takes one string argument: exePath
exePath
is the full path of the prince.exe
file. If you have Prince installed, it should be in the
prince\engine\bin
directory.Convert
function. Convert
will exit
with an error if the Prince path attribute is not set correctly.Convert
takes two arguments:
xmlPath
is the full path of the xml filepdfPath
is optional, and is the full path of the output pdf file. If this argument is omitted, the output pdf file is placed in the same directory as the input xml file1
if conversion is successful, 0
if conversion fails.
ConvertMultiple
takes two arguments
xmlPaths
contains the full paths of the documents to be converted.pdfPath
is the full path of the output pdf file.1
if conversion is successful, 0
if conversion fails.
AddStyleSheet
takes a string argument: cssPath
CssPath
is the full path of the Cascading Style Sheet css file.
AddStyleSheet
can be called more than once to add multiple style sheets.
Style sheets will be accumulated and applied to the conversion.
This procedure can be called before calling a convert function.
ClearStyleSheets
AddScript
takes a string argument: jsPath
JsPath
is the full path of the JavaScript file.
AddScript
can be called more than once to add multiple scripts.
This procedure can be called before calling a convert function.
ClearScripts
AddScript
.
AddFileAttachment
takes a string argument: filePath
FilePath
is the full path of the file to be attached to the PDF file.
AddFileAttachment
can be called more than once to add multiple file attachments.
This procedure can be called before calling a convert function.
ClearFileAttachments
AddFileAttachment
.
SetLicenseFile
takes a string argument: file
file
is the full path of the license file.
SetLicenseKey
take a string argument: key
key
is the license key.
SetInputType
takes a string argument: inputType
inputType
can take a value of : "xml
", "html
" or "auto
".
SetJavaScript
takes a boolean argument: js
js
is true.
SetHTML
takes a boolean argument: html
SetLog
takes a string argument: logFile
logFile
is the full path of the log file.
Logging will be disabled if logFile
is the empty string.
SetBaseURL
takes a string argument: baseurl
baseurl
is the base URL or path of the input document, or the empty string.
SetXInclude
takes a boolean argument: xinclude
xinclude
is false.
SetHttpUser
takes a string argument: user
SetHttpPassword
takes a string argument: password
password
is the password to use for basic HTTP authentication.
SetHttpProxy
takes a string argument: proxy
proxy
is the URL for the HTTP proxy server.
SetInsecure
takes a boolean argument: insecure
insecure
is true, SSL verification will be disabled. (not recommended)
SetFileRoot
takes a string argument: fileRoot
/images/logo.jpg
can be rewritten to /usr/share/images/logo.jpg
by specifying "/usr/share
" as the root.
Argument fileRoot
is the path to prepend to absolute filenames.
SetEmbedFonts
takes a boolean argument: embed
embed
is false.
SetSubsetFonts
takes a boolean argument: subset
subset
is false.
SetCompress
takes a boolean argument: compress
compress
is false.
SetEncrypt
takes a boolean argument: encrypt
encrypt
is true.
SetEncryptInfo
takes seven arguments. They are related to encryption of the output PDF file.
This procedure can be called if encryption is required. It can be called before calling a convert function.
keyBits
can be either 40
or 128
.userPassword
sets the password the user will have to type in to open the PDF file
as a user.ownerPassword
sets the password the user will have to type in to open the PDF file
as the owner.
disallowPrint
, if set true, printing will be disallowed for the user.
disallowModify
, if set true, modifying will be disallowed for the user.
disallowCopy
, if set true, copying text will be disallowed for the user.
disallowAnnotate
, if set true, annotation will be disallowed for the user.
Public Event Message(msgType As String, msgLocation As String, msg As String)
It has three string arguments representing the message type, its location and the message.
msgType
:
Value | Meaning |
---|---|
inf |
information |
wrn |
warning |
err |
error |
msgLocation
: shows where the message came from or where the error occured (this can be empty).msg
: is the content of the messageVisual Basic Users wishing to write an event handler to process messages from Prince will need to declare a WithEvents variable, create a Prince class object then assign the the latter to the former.
Example:
Dim WithEvents pr As Prince
Dim WithEvents pr As Prince
...
Set pr = New Prince