by Richard Russell, October 2007
A popular method for creating a PDF (Portable Document Format) file from a Windows application is to use a 'PDF Printer Driver' (or 'Virtual Printer'). This installs like an ordinary printer but rather than outputting to paper it creates a PDF file. There are many such products including:
The approximate prices are given in US$ and are believed to be correct at the time of writing. In some cases more expensive enhanced or 'professional' versions are also available. I have received recommendations from users for CutePDF and doPDF (make sure you download the latest version of the latter).
If you use such a program to create a PDF file from your BBC BASIC program there is one small problem - each individual page will come out as a separate document! This happens because traditional BBC BASIC programs (e.g. as written for the BBC Micro or Acorn Archimedes) have no way of indicating the end of the document, only the end of a page. Therefore BBC BASIC for Windows closes the current 'document' at the end of each page and opens a new 'document' at the start of the next page. This isn't apparent when outputting to a real printer, but is when creating a PDF.
This is easily solved by replacing the code which you would normally use to indicate the end of a printed page (typically VDU 2,1,12,3) with the following code:
SYS "EndPage", @prthdc% SYS "StartPage", @prthdc% VDU 2,1,30,3
To close the document, after all the pages have been output, send a VDU 2,1,12,3 as usual.