The printtopdf statement prints the current database to a PDF file.
This statement has three parameters:
path – path and filename of the desired PDF file. If only a filename is supplied, the file will be placed in the same folder as the database. If an empty filename is supplied, the PDF file will be given the same name as the database, but with an extension of
option – The name of an option that modifies the printing operation. See below for descriptions of each available option. The option can be specified in either upper or lower case.
value – The option value.
This statement prints the current database directly to a PDF file. (Alternately, it can also immediately print to any printer connected to the computer, see the Printers option below.) In its simplest form, all that is needed is the name of the file.
In fact, you can even leave off the name of the PDF file, in which case Panorama will automatically create a PDF file with the name of the database followed by the PDF extension.
The operation of this statement can be customized by adding one or more pairs of option/value parameters to the printtopdf statement, like this:
Each of the available options is described below.
The printtopdf statement normally prints all selected records to the PDF file, but if the onerecord option is true, only the current record is printed.
Note: You can use
"currentrecord" instead of
The printtopdf statement normally prints the current window (data sheet, form or procedure window). This option allows a different form to be printed, instead of the currently active form. The specified form does not have be open. This example will print using the Invoice Template form even if some other form window is currently the active window.
printtopdf "Invoices.pdf","Form","Invoice Template"
Note: This option will only work if the current window is a form window. If the current window is a data sheet or procedure window, that window will be printed even if an alternate form has been specified.
Note: You can use
"usingform" instead of
This option is designed to be used with the Form option described above. It allows the form used for printing to be a form in a different database (however, the specified database must be open). This usually only makes sense if the two databases have the same fields.
printtopdf "Labels.pdf","Database","Label Templates","Form","Avery 5252"
Note: You can use
"usingdatabase" instead of
If this option is included, the printtopdf statement will immediately print instead of generating a PDF file (the path option is ignored, and can be left blank). If the printer is blank, the current default printer will be used.
printtopdf "","Printer","","Database","Label Templates","Form","Avery 5252"
Or, you can specify the printer to be used:
printtopdf "","Printer","Canon MP620 series","Form","Avery 5252"
Use the info(“printers”) function to find out what printers are available.
This option can only be used if the Printer option is being used for immediate printing. It specifies the number of copies to be printed (the default is 1). This example prints three copies of an invoice.
If a PDF file is being generated, the Copies option is ignored.
The printtopdf statement normally displays a small pop-up alert that shows the progress of the PDF being generated. The progress option disables this pop-up alert.
The printtopdf statement normally prints all selected records to the PDF file, but it can be restricted to only a limited set of pages. Here are some examples.
printtopdf "Report.pdf","last",1 // prints only the first page printtopdf "Report.pdf","first",2 // skips the first page printtopdf "Report.pdf","first",2,"last",2 // prints only the second page
Unfortunately, there isn’t any way to know in advance how many pages there are in the document, so there is no reliable way to print only the last page, or to skip only the last page.
Use the Reverse option if you want to print the pages back to front.
The PDF is normally generated in portrait orientation, but it can be switched to landscape.
Use the Height and Width options to specify a custom paper size. This report will be printed on US Legal paper. You must specify both the height and width, or the custom size will be ignored.
The dimensions are normally specified in inches, but if the values are larger than 72, they are interpreted as points (72 points per inch).
The Scale option modifies the scale factor. A factor of 1.0 generates the PDF at 100%, smaller numbers reduce the size while larger numbers increase it. This example prints the database at 1/2 normal size (50%).
|10.0||New||New in this version.|