[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: PDFLib
- From: Gavin Wraith <gavin@...>
- Date: Sat, 6 Jul 2002 14:54:08 +0100 (BST)
Dear Luiz Henrique
Thanks for bringing PDFLib to my attention
and for the Lua binding for it. Had you
considered asking PDFLib to add your binding
to their distribution? It would help to
publicize Lua.
I have succeeded in compiling PDFLib and
your binding to make an application, Scribble
(http://www.wraith.u-net.com/scribble/)
so that we poor benighted Risc OS users can
now at last construct PDF files. There is no
Acrobat for us, of course.
You will be able to see the form that Scribble
scripts take from my modification of your file,
as below:
-- Scribble v.0.1
-- G.C.Wraith 03/07/02
do
local PDF = {}
settag(PDF,newtag())
local END = function (x)
x:end_page()
x:close()
x:delete()
execute("settype "..x.file.." pdf") -- Risc OS specific
end -- function
settagmethod(tag(PDF),"gettable",function (a,i)
local f = getglobal("PDF_"..i)
if f == nil then return rawgettable(a,i)
else
return function (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
return %f(a1.p,a2,a3,a4,a5,a6,a7,a8,a9,a10)
end -- function
end -- if
end)
BEGIN = function (file)
local p = PDF_new()
assert(PDF_open_file(p,file))
local x = { p = p, file = file, END = %END}
settag(x,tag(%PDF))
return x
end -- function
end -- do
A0 = { width = 2380, height = 3368 }
A1 = { width = 1684, height = 2380 }
A2 = { width = 1190, height = 1684 }
A3 = { width = 842, height = 1190 }
A4 = { width = 595, height = 842 }
A5 = { width = 421, height = 595 }
A6 = { width = 297, height = 421 }
B5 = { width = 501, height = 709 }
Letter = { width = 612, height = 792 }
Legal = { width = 612, height = 1008 }
Ledger = { width = 1224, height = 792 }
dofile(arg[1])
----------------------------
--
Gavin Wraith (gavin@wraith.u-net.com)
Home page: http://www.wraith.u-net.com/