At the beginning, the PDFL object has to be created:
loDocument=evaluate([XFRX("PDFL#INIT")])
When using PDFL together with XFRX to mix VFP reports with pages generated from
code, use AttachToPDFDocument() method of the XFRXSession object to attach to the existing document. Send the XFRXSession object as a parameter:
loDocument.attachToPDFDocument(loXFRXSession)
When using PDFL independently, call createDocument method with a file name as a parameter to create a new PDF file:
loDocument.createDocument("output.pdf")
Call newPage() at the beginning and endPage() at the end of each page. NewPage() has to be called before any objects (text, lines) are added
to the document.
When using PDFL independently, call finishDocument() method to close the document:
loDocument.finishDocument()
Never call finishDocument() when running PDFL together with XFRX.
Draws a line from [tnXPos1, tnYPos1] to [tnXPos2, tnYPos2]. inLineWidth is a
line width in pixels, 0 is a hairline width.
lnPattern controls the line dash pattern:
1 ... dotted
2 ... dashed
3 ... dash-dot
4 ... dash-dot-dot
draws a rectangle at tnXPos, tyYpos, tnWidth wide, tnHeight high.
tnFill:
0 ... not filled
1 ... filled
tnPenPattern:
0 ... no border
1 ... dotted
2 ... dashed
3 ... dash-dot
4 ... dash-dot-dot
tnRoundFactor:
0 ... no rouding. The higher value is sended the more rounded the corners are. 99 prints an ellipse.
Using drawing paths
startPath(tnXPos, tnYpos)
Begins a new path at [tnXpos, tnYpos]
appendLine(tnXpos, tnYpos)
Appends a straight line from the current point to [tnXpos, tnYpos]
Appends a cubic Bezier curve from the current point to [tnXpos3, tnYpos3], using [tnXpos1, tnYpos1] and [tnXpos2, tnYpos2] as the Bézier control points.
closePath()
Closes the path by appending a straight line from the current point to the starting point of the path.
Paints a picture located in a file. Only BMP and JPG files are supported.
tnAdjType:
1 ... stretch picture, retain shape
2 ... stretch picture, fill frame
You can use PDF Library to add any custom graphics (e.g. watermarks) and/or text to the pages generated by XFRX. You can also add new pages between the report pages. To do this, you need to create procedures with PDFL commands (PDFL scripts) and tell XFRX when to invoke these procedures:
Create PDFL object
loDocument=evaluate([XFRX("PDFL#INIT")])
And attach it to the existing XFRX session:
loDocument.attachToPDFDocument(loXFRXSession)
Create an instance of PDFLScripts class. Use the PDFL object as a parameter of the init method. The rest of the class methods
are the PDFL Scripts.
loScr = createobject("PDFLScripts",loDocument)
The class definition with one simple script can look like this:
define class PDFLScripts as custom
oPDFLDocument = null
procedure init
lpara toPDFLDocument
this.oPDFLDocument = toPDFLDocument
procedure script1
this.oPDFLDocument.addPicture("xfrx.jpg",10,673,300,500,2)
endproc
enddef
Now we need to tell XFRX when (on which pages) to invoke the script(s). For each script, call loXFRXSession.registerPDFLScript() method:
0 ... print below (before) the report page, 1 ... print above (after) the report page
tcScope
Defines which pages to invoke the scripts on. Can contain "ALL", "ODD", "EVEN" and numbers delimited with commas. Hyphens can be used to define the from-to scope. Examples: "ODD", "1,5-19", "ODD,4,8"
tnPageNumberingType
Defines how XFRX determines the page number:
0 ... absolute - the page number in the document,
1 ... relative - the page number in the current report,
2 ... the value of _PAGENO