Saves a report as a .pdf file.
[Ok :=] Report.SAVEASPDF(Number, FileName[, Record])
[Ok :=] Report.SAVEASPDF(FileName)
Parameters
-
Number
-
Type: Integer
The ID of the report that you want to run. On the View menu, click C/AL Symbol Menu to select the report from a list.
-
FileName
-
Type: Text
The path and name of the file that you want to save the report as.
-
Record
-
Type: Record
Specifies which record to use in the report. Any filters that have been applied to the record that you specify will be used.
Property Value/Return Value
Type: Boolean
If you omit this optional return value, a run-time error occurs if the record cannot be found. If you include a return value, it is assumed that you will handle any errors.
true if the report was saved; otherwise, false.
The SaveAsPDF function can be used on the Report type and on Report variables.
When SaveAsPDF is called, the report is generated and saved to "FileName." A Saving to PDF window is displayed and shows the status of the process. If you click Cancel, the report will not be generated or saved as a PDF file. Note that the Request Form will not be shown.
The location that is specified by the FileName parameter is a location on the computer running Microsoft Dynamics NAV Server. If you call this function from the RoleTailored client, such as from an action on a page, then use the DOWNLOAD Function (FILE) to download the .pdf file from the computer running Microsoft Dynamics NAV Server to the computer running the RoleTailored client.
The return value indicates whether the report has been saved successfully. If you use this value and an error occurs, false is returned. If you do not use the return value, the occurrence of an error results in an error message such as "Out of hard disk space," "The file parameter is not open," and so on. The object is then closed.
Reference
Report Data Type