PDF writer
DotHRB can easily create PDF files. While not intended as full-featured module, it offers an efficient way to quickly generate pdf files without any additional dependency.
Important
These are lightweight, high-speed exporting functions, not full-scale document manipulation engines. They are optimized strictly for streaming clean tabular data directly into PDF format without complex external dependencies.
#include "dothrb.ch"
class DemoController from ApiController
method init constructor
method get
method getfile
end class
method init(cName) class DemoController
::super:init(cName)
::authorize()
return Self
method getfile() class DemoController
local hParams := ::getRequestParams(ALLOW_METHOD_GET)
local db
local res
local cFile
local cName := "demo.pdf"
db := getDbConn(::hClaims)
res := db:useModelRead(new DemoModel(), hParams)
db:close()
cFile := res2file(res, cName) // create cName file with res values as rows/cols
return ::sendAttachment(cFile, cName)
or
#include "dothrb.ch"
function main()
local oPdf := new PdfFile("Test.pdf")
oPdf:textat(1, 10, "test")
oPdf:textat(2, 10, "10")
oPdf:textat(3, 10, dtoc(date()))
oPdf:end()
return nil