SAVEASPDF Function (Report)

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.

Type: Boolean

If you omit this optional return value, then run-time errors can occur. 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. This function is supported only on client report definition (RDLC) layouts. If you delete the RDLC layout and then run the SaveAsPDF function, then you get the following error:

The layout of this report has not been transformed to be viewed in the RoleTailored client. You can run this report from the Classic client.

When you call SaveAsPDF, the report is generated and saved to "FileName." A Saving to PDF window shows the status of the process. Note that the Request Form will not be shown.

The FileName parameter specifies 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.

Community Additions

ADD
Show: