Form.printToPDF

Method of Form

New in package 166

Syntax

Form.printToPDF();
Form.printToPDF( {
control: FormElement
[, dpi: Number ]
[, pageSize: { width: Number, height: Number }]
[, pageMargins: { left: Number, top: Number, right: Number, bottom: Number }]
[, pattern: \"file_name*.pdf"]

[, folderPath: String]
[, fileName: String]
[, fileComment: String]
} );

Parameters

Parameter Description
control A form control to print.
dpi The DPI value that determines how the specified page size is mapped to points in PDF. Defaults to DPI (Target Resoultion) of the form.
pageSize The height and width dimensions of the page size used when the form is printed, in inches. Defaults to Page Size of the form.
pageMargins The distance, in inches, that the form will be offset from the corresponding edges of the page when printed. Defaults to Page Margins of the form.
pattern The string that represents a pattern used to generate file name for the resulting file, "*" symbol in the pattern will replaced with a generated number to produce a unique file name. Defaults to "*.pdf". For example, specifying "report*.pdf" pattern will result in the file name that looks like "report12345678901234567890.pdf"
folderPath The folder path on the file service where to upload resulting file. If specified then the resulting file is uploaded to file service instead of being returned as the result of the function call. New in package 167 (ASN-9271,VTW-9085)
fileName The resulting file will be uploaded to file service with the name.
fileComment The resulting file will be uploaded to file service with the comment.

Description

Prints the form or a form control to PDF file.
If folderPath is not specified then the function downloads the file and returns path to the file.
If folderPath is specified then the resulting file is uploaded to file service and the function returns the id of the folder where it has been uploaded to.

This functionality requires SQL Server Report Services installed and Virtual Ticket configured to access the Report Services.

Examples

The following example uses printToPDF to print the form to PDF file and open the file in a default PDF viewer:

Next example uses printToPDF to print a form control found by id to PDF file and open the file in a default PDF viewer:

See also

PrintObject

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.