How to : print a A4 stack to an A4 pdf ??

FlexibleLearning admin at
Tue Feb 1 16:57:38 EST 2011

Hi Robert,

> Question users! Has anybody achieved printing a standard A4 "portrait"
> (595 x 842 pixels) with the "open printing to pdf" command??? If yes..
> please share! I can't make it work over here.

Try this...

on print2pdf
  --| Requires v4.5 and revpdfprinter.dll in the same directory as the
  put "[Title of document]" into optionArray["Title"]
  put "[Your Name]" into optionArray["Author"]
  put "[Subject of document]" into optionArray["Subject"]
  put "Created by [MyAppName]" into optionArray["Creator"]
  put "LiveCode 4.5 pdf engine" into optionArray["Producer"]
  put "[List of key words]" into optionArray["Keywords"]
  set the itemDel to "/"
  put item 1 to -2 of the effective filename of this
stack&"/pdfprintfile.pdf" into tFilePath
  ask file "Save as..." with tFilePath
  if it="" then exit to top
  put it into tFilePath
  if char -4 to -1 of tFilePath <>".pdf" then put ".pdf" after tFilePath
  reset printing
  set the formatforprinting of this stack to "false"
  set the printPaperSize to the width of this stack,the height of this stack
# e.g. for A4: 595,842
  set the printMargins to 0,0,0,0
  open printing to pdf tFilePath with options optionArray
  print this card
  close printing
  reset printing
end print2pdf

Ensure you leave sufficient unused space on the card for your printer's
minimum margins.

Hugh Senior

More information about the Use-livecode mailing list