PRIM_PDF (PRIM_PDF)

PDF Generator

Ancestors - Object (PRIM_OBJT)

Details

A PDF generator component is used to create PDF reports.
 
Includes an Autotable subcomponent to facilitate creating preformatted tables.

Example

Creating a simple PDF report.
Define_Com Class(#PRIM_PDF) Name(#pdf) UnitM(mm) PageFormat(A4) PageOrientation(Portrait)
Define Field(#CreationDate) Type(*DATETIME)
 
#pdf.start
 
#pdf.setDocumentProperties Title('My PDF report') Author('John Smith') Creator('My Company, Inc') Keywords('Weekly report')
#CreationDate := #CreationDate.Now
#pdf.setCreationDate Datetime(#CreationDate)
 
#pdf.setFont Font('Times') Style(Italic)
#pdf.setFontSize Size(14)
#pdf.text Text('Hello world!') Left(10) Top(10)
#pdf.addPage
#pdf.text Text('This line is on the second page') Left(10) Top(10)
 
#pdf.save Filename('MyReport.pdf')

Properties

Name Description
ComponentClassName ComponentClassName is the name of the component's class. Inherited from Object (PRIM_OBJT)
ComponentMembers ComponentMembers provides access to all the member components of this component Inherited from Object (PRIM_OBJT)
ComponentPatternName ComponentPatternName is used to qualify the class of the component. Inherited from Object (PRIM_OBJT)
ComponentTag Generic space allowing a value to be stored for the instance Inherited from Object (PRIM_OBJT)
ComponentType ComponentType gives you access to the type information about the component Inherited from Object (PRIM_OBJT)
ComponentTypeName ComponentTypeName is the fully qualified name of the component's class. Inherited from Object (PRIM_OBJT)
Name Name identifies the component Inherited from Object (PRIM_OBJT)
Owner Owner owns this component Inherited from Object (PRIM_OBJT)
PageFormat The format of the page
PageOrientation Orientation of the page
Parent The component instance to which this instance is attached. The visual container for a control or the collector of a set of child instances Inherited from Object (PRIM_OBJT)
UnitM Measurement unit to be used when coordinates are specified

Events

Name Description
CreateInstance CreateInstance is signalled when an instance of a component is created Inherited from PRIM_PDF (PRIM_PDF)
DestroyInstance DestroyInstance is signalled when an instance of a component is about to be destroyed Inherited from PRIM_PDF (PRIM_PDF)

Methods

Name Description
addImage Adds an image to the PDF document
Bitmap, ImageFileFormat, Left, Top, Width, Height, ImageCompression, Rotation
addPage Adds and transfers focus to new page in PDF document
circle Adds a circle to the PDF document
CenterX, CenterY, Radius, FillStyle
CreateAutoTable Creates an instance of a PDF AutoTable
Result
line Draws a line on the current page
Left, Top, Right, Bottom
rect Adds a rectangle to the PDF document
Left, Top, Width, Height, FillStyle
roundedRect Adds a rectangle with rounded corners to the PDF document
Left, Top, Width, Height, RadiusX, RadiusY, FillStyle
save Saves the PDF document
Filename
setCreationDate Sets the PDF document's creation date
Datetime
setDisplayMode Sets the display mode options
Zoom, Layout
setDocumentProperties Sets properties of the PDF document
Title, Author, Creator, Keywords
setDrawColor Sets the stroke color for upcoming elements
Color
setFillColor Sets the fill color for upcoming elements
Color
setFont Sets text font face, variant for upcoming text elements
Font, Style
setFontSize Sets font size for upcoming text elements
Size
setLineDash Sets the dash pattern for upcoming lines
Pattern, Phase
setLineWidth Sets the line width for upcoming lines
Width
setTextColor Sets the text color for upcoming elements
Color
start Starts the PDF document
text Adds text to the page
text, Left, Top

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020