LuaHPDF

libHaru is a free, cross platform, open source library for generating PDF files, and LuaHPDF is a module that lets you programmatically create PDF files via Lua using this library.

LuaHPDF was developed by Kurt Jung as an interface to the Haru PDF Library. I have built libHaru 2.2.0.0, with zlib 1.2.8 and libpng 1.6.2, and finally compiled the LuaHPDF 1.3.0 module.

Using with AutoPlay Media Studio 8

Add the common.lua, hpdf.dll and libhpdf.dll files to your project, placing it into the Scripts folder. It then can be used on any page or dialog when needed.

Using with Setup Factory 9

Add the common.lua, hpdf.dll and libhpdf.dll files to the Primer Files of your project, so it will be decompressed into the runtime folder when the setup is executed. Then, where needed, load it.

Sample code for loading and using the module

require "hpdf"
require "common"

local pdf = hpdf.New()
if pdf then
	local page = hpdf.AddPage(pdf)
	local height = hpdf.Page_GetHeight(page)
	local width = hpdf.Page_GetWidth(page)
	local font = hpdf.GetFont(pdf, "Times-Roman")
	hpdf.Page_SetFontAndSize(page, font, 24)
	hpdf.Page_BeginText(page)
	hpdf.Page_TextOut(page, 60, height - 60, "Hello from Haru version " .. hpdf.VERSION_TEXT);
	hpdf.Page_EndText(page)

	local res = hpdf.SaveToFile(pdf, _TempFolder.."\\Hello.pdf");
	hpdf.Free(pdf)
	if (res == 0) then
		File.Open(_TempFolder.."\\Hello.pdf", _TempFolder, SW_SHOWNORMAL);
	else
		Dialog.Message("Error", "Could not save PDF document.", MB_OK, MB_ICONSTOP);	
	end
else
	Dialog.Message("Error", "Error creating PDF object.", MB_OK, MB_ICONSTOP);
end

Download

To receive a download link for this software, please click the button below. After the payment is confirmed, you will receive a download link per email automatically and may install this software, use it for commercial and personal projects.

In the past, I offered my work for free, in the hope that individuals and companies would contribute with a minimum payment. Unfortunately, that didn't happen, and the result was so meager, that I didn't even pay half the cost of hosting this site, and I had to change the policy.

Support Policy

All software products were tested and found to work, but they are provided without any explicit guarantee that they will work in every possible environment without further customization. If you need support or consulting, please contact me.