Navigation:  DominoPDF >

Function: DoPDF

Previous pageReturn to chapter overviewNext page

The DoPDF function is the core function of DominoPDF used for converting content to PDF output.

LOTUSSCRIPT

Declarations

Declare Function DoPDF Lib "DOMINOPDF.DLL" (Byval szInput As String, Byval szOutput As String, Byval szOptions as String) As Long

Return Value

Returns -1 if failure and 0 for success.

SYNTAX

Input source(s) to DominoPDF

DominoPDF accepts selection formulas, file formats and URL's as an input source.

If file formats or URL's are used multiple sources can be specified by separating values with a semi-colon (;) or specifying an external file list of values (see end).

Selection Formula Input

To convert all Memo documents in a database to a PDF file simply pass in the appropriate selection formula.

Select Form = "Memo"

DominoPDF accepts any valid selection formula as per the Notes guidelines.

URL Input

To convert a Notes document URL to a PDF file simply pass the URL of the Notes document.

http://localhost/names.nsf/2022DB1FD398438D80256AAE0058C5D5/56D6957AE7808A1E80256A380041F84E?OpenDocument

Any Notes URL element can be passed in the same manner.

http://localhost/names.nsf/Home?OpenForm

http://localhost:81/names.nsf/Gene?atePDF?OpenAgent

http://localhost/names.nsf/contacts?OpenView

The URL does not have to be a Notes URL. As long as the URL is available and returns HTML DominoPDF will convert it.

http://www.primeapple.co.uk

Output PDF

The file name and path of the PDF file to be generated.

For example;

contacts.pdf

c:\contacts.pdf

c:\my documents\contacts.pdf

Options

The options passed to the function are a semi-colon (;) delimited list of name=value pairs.

For example;

Call DoPDF(|Select Form = "Memo"|, "c:\memo.pdf", "Database=mail.nsf;PageSize=A4;AutoLaunch=True")

A list of all available options are provided below.

Global Options (Applies to both Selection Formulas and URL input)

AutoLaunch=True/False - Specify whether the PDF should be automatically opened after creation.

PageSize=<value> - Specify the page size for the PDF output. The supported values are Letter, A4, A3, Legal, B5, C5, B4, A5, Folio, Executive, EnvB4, EnvB5, EnvC6, EnvDL, EnMonarch, Env9, Env10 and Env11.

Orientation=<value> - Specify the orientation of pages in the PDF output. The support values are Portrait and Landscape.

LeftMargin=<value> - The left margin size in MM (unless UseInches is True) used when converting a non-RTF file format.

RightMargin=<value> - The right margin size in MM (unless UseInches is True) used when converting a non-RTF file format.

TopMargin=<value> - The top margin size in MM (unless UseInches is True) used when converting a non-RTF file format.

BottomMargin=<value> - The bottom margin size in MM (unless UseInches is True) used when converting a non-RTF file format.

UseInches=True/False - Indicates that the measurements ?or LeftMargin, RightMargin, TopMargin and BottomMargin and specified in inches instead of the default MM.

Compressed=True/False - Indicates whether compression is used for PDF file creation. Compresses content, images and fonts.

Author=<value> - Indicates the author name to be displayed in the PDF document properties dialog.

Title=<value> - Indicates the title to be displayed in the PDF document properties dialog.

Subject=<value> - Indicates the subject to be displayed in the PDF document properties dialog.

Keywords=<value> - Indicates the keywords to be displayed in the PDF document properties dialog.

CustomInformation=<value> - Indicate whether custom document properties are created. Multiple properties are separated with an asterisk (*). For example; CustomerInformation=Invoice=A12343*InvoiceDate=12/01/2010

PDFVersion=<value> - Indicate the PDF version created. The supported values are 1.3, 1.4, 1.5 and 1.6.

PageMode=<value> - Indicates the default display mode when a PDF document is opened in a reader. The supported values are None, Outlines, Thumbnails and FullScreen.

ConvertURL=True/False - Indicates whether any http or mailto texts are converted to links in the PDF file.

Outlines=True/False - Indicates whether outlines are created in the PDF document.

HTMLHeader=<value> - Specify header content as formatted HTML. Can be either a URL or direct HTML content. Note: For single string entries, such as HTMLHeader=Primeapple be sure to add the <BR> tag which will ensure the header sizes correctly. For example, HTMLHeader=Primeapple<BR>. Note: Be sure to size the TopMargin setting to size the header accordingly.

HTMLHeaderFirst=<value> - Specify header content as formatted HTML for FIRST page only. Can be either a URL or direct HTML content. Note: For single string entries, such as HTMLHeaderFirst=Primeapple be sure to add the <BR> tag which will ensure the header sizes correctly. For example, HTMLHeaderFirst=Primeapple<BR>. Note: Be sure to size the TopMargin setting to size the header accordingly.

HTMLHeaderLast=<value> - Specify header content as formatted HTML for LAST page only. Can be either a URL or direct HTML content. Note: For single string entries, such as HTMLHeaderLast=Primeapple be sure to add the <BR> tag which will ensure the header sizes correctly. For example, HTMLHeaderLast=Primeapple<BR>. Note: Be sure to size the TopMargin setting to size the header accordingly.

HTMLFooter=<value> - Specify footer content as formatted HTML. Can be either a URL or direct HTML content. Note: For single string entries, such as HTMLFooter=Primeapple be sure to add the <BR> tag which will ensure the footer sizes correctly. For example, HTMLFooter=Primeapple<BR>. Note: Be sure to size the BottomMargin setting to size the header accordingly.

HTMLFooterFirst=<value> - Specify footer content as formatted HTML for FIRST page only. Can be either a URL or direct HTML content. Note: For single string entries, such as HTMLFooterFirst=Primeapple be sure to add the <BR> tag which will ensure the footer sizes correctly. For example, HTMLFooterFirst=Primeapple<BR>. Note: Be sure to size the BottomMargin setting to size the header accordingly.

HTMLFooterLast=<value> - Specify footer content as formatted HTML for LAST page only. Can be either a URL or direct HTML content. Note: For single string entries, such as HTMLFooterLast=Primeapple be sure to add the <BR> tag which will ensure the footer sizes correctly. For example, HTMLFooterLast=Primeapple<BR>. Note: Be sure to size the BottomMargin setting to size the header accordingly.

Encryption=True/False - Denotes whether encryption is applied to the PDF file.

UserPassword=<value> - Applies the specified user password to the PDF file.

OwnerPassword=<value> - Applies the specified owner password to the PDF file.

EncryptStrength=40/128 - Applies the appropriate encryption strength to the PDF file. The default is standard 40-bit and advanced 128-bit is supported.

EnablePrinting=True/False - Set this to True to allow the user to print the PDF document.

EnableCopying=True/False - Set this to True to allow the user to copy text and graphics from the PDF document.

EnableEditing=True/False - Set this to True to allow the user to edit the PDF document

EnableAnnotations=True/False - Set this to True to allow the user to add annotations to the PDF document.

EnableFields=True/False - Set this to True to allow the user to fill in form fields. Only works with 128-bit encryption.

EnableCopyAccess=True/False - Set this to True to enable copying for use with accessibility features. Only works with 128-bit encryption.

EnableAssemble=True/False - Set this to True to allow the user to assemble the PDF document. Only works with 128-bit encryption.

EnablePrintFull=True/False - Set this to False to force low-resolution printing of the PDF document only. This prevents the document from being distilled into a new PDF document. Only works with 128-bit encryption.

NoEmbedFonts=<value> - By default when creating PDF files DominoPDF embeds any used fonts into the PDF. For some fonts (such as barcodes) the process may fail or you may want to reduce the size of the PDF. NoEmbedFonts allows a list of font names to be specified which will not be embedded in the PDF. The fonts will still display correctly when the PDF is viewed, however the font must exis? on the appropriate machine. Multiple font names are separated with an asterisk (*). For example; NoEmbedFonts=Arial*Times New Roman

EmbedFiles=<value> - File path and name of file(s) to embed in the PDF. Multiple file names are separated with an asterisk (*). For example; EmbedFiles=c:\orgchart.gif*c:\temp\minutes.doc

XMPMetaData=<value> or True/False - Specify whether XMP Metadata is included in the PDF file. If True is specified then DominoPDF will automatically generate the metadata, otherwise you can specify your own or custom metadata value.

ShortDateFormat=<value> - Specify custom display format for short dates. For example; dd/mm/yyyy.

Selection Formula Options (Applies to Selection Formula input)

Server=<value> - Specify the server to use when evaluating a selection formula as input. If left blank or not specified then the Local server will be assumed.

Database=<value> - Specify the database to use when evaluating a selection formula as input. Note that this value is required when using selection formulas. The database path is relative to the Notes \data directory, for example, mail.nsf or project\marketing.nsf. The fully qualified path of the database should be used if the database is outside the Notes \data directory. For example, c:\data\mail.nsf.

ForceSectionExpand=True/False - Specify whether sections on a form should be expanded when evaluating a selection formula as input.

ForceOutlineExpand=True/False - Specify whether outlines on a form should be expanded when evaluating a selection formula as input.

RowAtATimeTableAlt=True/False - Specify whether tabbed tables on a form should be expanded when evaluating a selection formula as input.

HTTP and HTML Options (Applies to URL input)

WebUsername=<value> - If the URL connection requires authorisation the HTTP username can be specified. (Note this is the username for web access not Notes access).

WebPassword=<value> - If the URL connection requires authorisation the HTTP password can be specified. (Note this is the password for web access not Notes access).

WebProxyUsername=<value> - If the URL connection requires proxy authorisation the HTTP proxy username can be specified. (Note this is the username for web access not Notes access).

WebProxyPassword=<value> - If the URL connection requires authorisation the HTTP proxy password can be specified. (Note this is the password for web access not Notes access).

WebProxyServer=<value> - If the URL conn?ction requires proxy connection the proxy server can be specified.

WebProxyPort=<value> - If the URL connection requires proxy connection the proxy port can be specified.

NTLM=True/False - Set this to True to specify NTLM authentication.

AcceptLanguage=<value> - Specifies the HTTP user agent (for example, en-gb or en-us etc.). If left blank or not specified DominoPDF will base the language on the default locale.

UserAgent=<value> - Specifies the HTTP user agent (for example, Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152)). Note, that as DominoPDF uses a semi-colon (;) as a separator you should use a * in its place. DominoPDF will then modify accordingly. For example; Call DoPDF(sInput, sOutput, "UserAgent=Mozilla/4.0 (compatible* MSIE 7.0* Windows NT 5.1* .NET CLR 2.0.50727* .NET CLR 3.0.4506.2152)")

UseIE=True/False - The DominoPDF HTML render does not support JavaScript by default. If you have JavaScript enabled content DominoPDF can use Microsoft Internet Explorer to "build" the JavaScript and return the resulting HTML to DominoPDF for processing.

UseCache=True/False - DominoPDF will cache resources for re-use to speed up load times and server connections.

If you need to process a large number of separate URLs or files then the LotusScript method may truncate your input. It is possible to call the DoPDF method in a loop to create separate PDF files for each input. Then merge the resulting PDF files into a single PDF with the DomPDFMerge method.

However another way of handling a long list of input values is provided by DominoPDF. The list of input values can be written to a file with an extension of *.domp and when this is passed to DominoPDF each item is processed in turn and output to a single PDF.

LotusScript can be used to write the values out to the file as in the example below.

Sub Initialize

Dim fileNum As Integer

Dim fileName As String

 

fileNum% = Freefile()

fileName$ = "c:\data.domp"

 

Open fileName$ For Output As fileNum%

Print #fileNum%, |http://www.google.com|

Print #fileNum%, |http://www.primeapple.co.uk|

 

Close fileNum%

Call DoPDF(|c:\data.domp|, |c:\test.pdf|, ||)

End Sub

The *.domp file can be mixed with other input values as appropriate. For example;

Call DoPDF(|ht?p://localhost/names.nsf/Home?OpenForm;c:\data.domp|, |c:\test.pdf|, ||)