print Procedure

You can use the print procedure to implement scenarios when users can print text, text files, or images of pdf files from their devices using the installed Oracle Field Service applications. When you call this procedure, the Plugin API validates the parameters and calls the native (device or browser) print functionality with the provided parameters. The Plugin API doesn't return information about or respond to problems such as no printer or cancellation.

Example of the callProcedure message:
{
    "apiVersion": 1,
    "method": "callProcedure",
    "procedure": "print",
    "callId": "123abc",
    "params": {
       "documentType": "pdf",
       "fileObject": "fileObject",
       "text": "Some text string"
    }
}

You can see the resultData message in response to the print message, only if there are no validation errors.

Here is an example of the resultData message:
{
    "apiVersion": 1,
    "method": "callProcedureResult",
    "callId": "123abc",
    "resultData": {
        "status": "ok"
    }
} 

Print procedure params

Param Value is Required Description
documentType string yes Document type of the file to be printed (text, image, html, pdf)
fileObject fileObject

required

Not required only if documentType param is text

Value from the input file with maximum size 10MB (10240kb) for image, HTML, and PDF.
text string required only if documentType param is text Text string to be printed

If the documentType is text and the fileObject and text parameters are not empty, the text param is printed.

Supported Document Types

documentType Dependent Field
text text or fileObject
image fileObject is required
html fileObject is required
pdf fileObject is required

If the HTML file contains JavaScript code, then the code is not processed based on the web security policy. Only the static content is printed.

Supported File Types

File Type Example of the file name
image/jpeg *.jpg
image/png *.png
image/gif *.gif
text/html *.html
text/plain *.txt
application/pdf *.pdf

For image/gif file type that contains animation, only the first frame is printed. For application/pdf file type, the browser’s built-in PDF Viewer is required.

Note: If you want to use the browser for printing, you must make sure that the version of the browser supports printing these types of documents.

Validation

If an error appears, it means that no actions are applied.

Example of an error message:
[
    {
        "type": "TYPE_PROCEDURE_PARAM",
        "code": "CODE_PROCEDURE_MANDATORY_PARAM_EMPTY",
        "procedure": "print",
        "paramName": "fileObject"
    }
]