Navigation:  DominoPDF > Helper Functions >

Function: DomPDFAddText

Previous pageReturn to chapter overviewNext page

The DomPDFAddText function is used to add text to an existing PDF file.

Note: The function does not support processing an already encrypted PDF file. If processing of an already encrypted PDF file is required please contact Primeapple for details.

LOTUSSCRIPT

Declarations

Declare Function DomPDFAddText Lib "DOMINOPDF.DLL" (Byval szInput As String, Byval szText As String,_

Byval szPages As String, Byval iLeft As Double, Byval iTop As Double,_

Byval iWidth As Double, Byval iAngle As Double, Byval iFontSize As Double) As Long

Return Value

Returns 0 if successful or -1 if unsuccessful.

Syntax

szInput - The file name and path of the PDF file to be opened.

For example;

c:\contacts.pdf

c:\my documents\contacts.pdf

szText - Specify the text to add to the PDF document.

If the angle parameter is set to 0 (zero) then the szText parameter can contain a small subset of HTML commands to affect the formatting output to PDF. If an angle is specified the text is output as-is.

The following HTML tags are supported: <br>, <b>, <i>, <strong>, <em>, <u>, <p align=left>, <p align=right>, <p align=center>, <font size=x> and <font color=c>. For the color attribute of the font tag you can use an RGB color specified in hexadecimal. For example <font color="#3A498C">. You can also specify a CMYK color by using eight hexadecimal digits and omitting the #. For example <font color="5C238F02">.

szPages - Specify the pages in the PDF on which to add text.

The szPages parameter has been defined as a string variable so a range of pages can be specified.

If szPages are left blank (for example "") all pages in the PDF document will be affected.

If szPages denotes a single page (for example "1") the specified page will be affected.

If szPages denoted a range of pages (for example "1, 3-4, 7") the specified range of pages will be affected.

iLeft - The left position to begin text output.

iTop - The top position to begin text output.

iWidth - The width of the text output.

iAngle - The angle of the text output. Must be between 0 and 360.

iFontSize - The font size for the output text.

Examples

Sub Initialize

'Declare variables...

Dim sInput As String

 

'Set values...

sInput = |c:\test.PDF|

 

'Error handler...

On Error Goto Error_Handler

 

'Add Text...

Call DomPDFAddText(sInput, "DominoPDF is great!", "1", 10, 10, 50, 0, 9)

 

The_End:

Exit Sub

 

Error_Handler:

Print Error$

Resume The_End

End Sub