PdfStart(NewFileName As String) As Integer

 

Creates an empty PDF file in application data temporary folder and appends a first page.

 

 

Parameters:

 

Name

Type

Description

NewFileName

String

Name of pdf file.

 

The name can be given with or without .pdf extension.

If the extension is lacking, it will be added.

 

If a pdf file of the same name already exists within the temporary folder, then a counter value will be added to the main name of the file, for example: testfile.pdf becomes testfile1.pdf

 

Returns:

 

Type

Value

Description

Integer

1

OK, the pdf file exists.

Integer

0

Not OK, the pdf file does not exist.

Integer

-2

An unknown exception occurred.

 

Used in:

 

XojoScript Name

GUID

Create Seminar Invoice With Slip As PDF

739DA58E-17EE-41CE-BB54-E7362CFE17D4

Create Seminar Invoice As PDF

2C3F7F29-A29A-4338-ACF5-51894B709DA5

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

Hint: You can find references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%PdfStart%'

 

Example XojoScript:

 

If PdfStart("testfile.pdf") > 0 Then

 

// Set top top-left as 0,0 coordinates

PdfSetPageCoordsTopDown

Dim x,y As Double = 30.0

 

// Set output font and color

PdfSetFont("Arial","Regular",10.0)

Call PdfSetFillColor("&c00000000") // black textcolor

 

// write a location and current date

Call PdfWriteText(x,y,"Page 1")

 

// Finalize PDF

Call PdfcloseFile

 

// Open PDF in default viewer

Call Pdflaunch

 

End If