PdfOptimze(flags As Integer) As Boolean

 

Optimizes PDF file.

 

One can use the optimize function to actually change the PDF and make it being PDF/A conform.

Use this function when you import pdf files created with third party tools.

 

Pdf files generated by Seminar Pro are already optimized, calling PdfOptimize is not needed then.

 

 

Parameters:

 

Name

Type

Description

flags

Integer

0

 

Returns:

 

Type

Value

Description

Boolean

True or False

Returns True if the pdf file has been optimized.

Returns False upon failure

 

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 '%PdfOptimze%'

 

Example XojoScript:

 

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

 

PdfSetPageCoordsTopDown

Dim x,y As Double = 30.0

 

// Set output font and color

PdfSetFont("Arial","Regular",18.0)

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

 

// write a location and current date

Call PdfWriteText(x,y,"INVOICE")

Call PdfEndpage

 

// Add a new page

Call PdfAppend

 

//Define font for new page and write text

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

Call PdfWriteText(x,y,"Page 2 with slip")

 

// Import pdf file from templates folder

Call PdfImportAsTemplate("SEPA-A4.pdf")

 

// Finalize PDF

Call PdfcloseFile

 

// Reduce sice and conform to PDF/A

Call PdfOptimize(0)

 

// Show it to the user

Call PdfLaunch

 

End If