Download raw (1.3 KB)
---Generic Booklet (A4)
---
---It is said generic as it will try to determine
---automatically how to fit the booklet onto A4
---paper sheets, scaling pages if necessary.
---it is well suited for office documents for
---which you do not care too much about resulting
---imposition artefacts since it manages to save
---paper!
---
-- print("Booklet")
-- We output an A4 booklet
PageWidth = 841.88976
PageHeight = 595.27559
print("PageCount",PageCount)
-- We assume that H > W
-- Argh, we now can do better since we have "if" ;-)
-- Scale = PageHeight / (2*SourceWidth)
rot = 0
leftxof = (PageWidth / 2) - SourceWidth
yof = (PageHeight - SourceHeight) / 2
rightxof = (PageWidth / 2)
do
rest = PageCount % 4
totp = PageCount
if rest ~= 0
then
totp = totp + ( 4 - rest)
end
inc = 0
count = 0
imax = totp/4
while count < imax
do
-- We assume that podofoimpose will discard invalid records
-- such as those with source page greater than PageCount
-- print(totp, inc, rot, xof,yofRA, yofRA, yofVA, yofVB)
-- Recto
PushRecord(totp - inc , inc + 1 , rot, leftxof , yof)
PushRecord(inc + 1 , inc + 1 , rot, rightxof , yof)
-- Verso
PushRecord(inc + 2 , inc + 2 , rot, leftxof , yof)
PushRecord(totp-(inc + 1) , inc + 2 , rot, rightxof, yof)
count = count + 1
inc = inc + 2
end
end