Changing+the+document+name

//by Richard Russell, April 2010//

When you output to a printer from a BBC BASIC program the 'document name' is set to **BBC BASIC output**. The principal purpose of this name is to identify the print job in the Print Manager's list of queued documents. For example if you need to delete the document from the queue you can identify it using this name.

Normally the users of your program will never be aware of the document name and there should be no need to change it. However when printing to a PDF file (see Creating PDF files) the name may be used as the default file name; in that case it might be desirable to set it to something different.

To change the document name call the procedure **PROCstartdoc** before you output the first character to the printer. The required document name should be supplied as the parameter of the procedure, for example: code format="bb4w" *PRINTER DoPDF v7      *MARGINS 10,10,10,10 VDU 2 PROCstartdoc("New document name") PRINT "The quick brown fox jumps over the lazy dog." VDU 1,12,3 END code The **startdoc** procedure itself is as follows: code format="bb4w" DEF PROCstartdoc(docname$) LOCAL docinfo{} DIM docinfo{cbSize%, lpszDocName%, lpszOutput%, lpszDatatype%, fwType%} docname$ += CHR$0 docinfo.cbSize% = DIM(docinfo{}) docinfo.lpszDocName% = !^docname$

SYS "StartDoc", @prthdc%, docinfo{} TO @vdu%!-4 SYS "StartPage", @prthdc% IF @vdu%!-16 SYS "SelectObject", @prthdc%, @vdu%!-16 SYS "SetBkMode", @prthdc%, 1 ENDPROC code