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

NameDescription
ComponentClassNameComponentClassName is the name of the component's class. Inherited from Object (PRIM_OBJT)
ComponentMembersComponentMembers provides access to all the member components of this component Inherited from Object (PRIM_OBJT)
ComponentPatternNameComponentPatternName is used to qualify the class of the component. Inherited from Object (PRIM_OBJT)
ComponentTagGeneric space allowing a value to be stored for the instance Inherited from Object (PRIM_OBJT)
ComponentTypeComponentType gives you access to the type information about the component Inherited from Object (PRIM_OBJT)
ComponentTypeNameComponentTypeName is the fully qualified name of the component's class. Inherited from Object (PRIM_OBJT)
NameName identifies the component Inherited from Object (PRIM_OBJT)
OwnerOwner owns this component Inherited from Object (PRIM_OBJT)
PageFormatThe format of the page
PageOrientationOrientation of the page
ParentThe 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)
UnitMMeasurement unit to be used when coordinates are specified

Events

NameDescription
CreateInstanceCreateInstance is signalled when an instance of a component is created Inherited from PRIM_PDF (PRIM_PDF)
DestroyInstanceDestroyInstance is signalled when an instance of a component is about to be destroyed Inherited from PRIM_PDF (PRIM_PDF)

Methods

NameDescription
addImageAdds an image to the PDF document
Bitmap, ImageFileFormat, Left, Top, Width, Height, ImageCompression, Rotation
addPageAdds and transfers focus to new page in PDF document
circleAdds a circle to the PDF document
CenterX, CenterY, Radius, FillStyle
CreateAutoTableCreates an instance of a PDF AutoTable
Result
lineDraws a line on the current page
Left, Top, Right, Bottom
rectAdds a rectangle to the PDF document
Left, Top, Width, Height, FillStyle
roundedRectAdds a rectangle with rounded corners to the PDF document
Left, Top, Width, Height, RadiusX, RadiusY, FillStyle
saveSaves the PDF document
Filename
setCreationDateSets the PDF document's creation date
Datetime
setDisplayModeSets the display mode options
Zoom, Layout
setDocumentPropertiesSets properties of the PDF document
Title, Author, Creator, Keywords
setDrawColorSets the stroke color for upcoming elements
Color
setFillColorSets the fill color for upcoming elements
Color
setFontSets text font face, variant for upcoming text elements
Font, Style
setFontSizeSets font size for upcoming text elements
Size
setLineDashSets the dash pattern for upcoming lines
Pattern, Phase
setLineWidthSets the line width for upcoming lines
Width
setTextColorSets the text color for upcoming elements
Color
startStarts the PDF document
textAdds text to the page
text, Left, Top

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020