Skip to main content
Skip table of contents

Create a PDF File from Input HTML

Convert HTML Text to PDF

Implementation

System

Command Category

System Utility

Tags

FILE

Inputs

Parameter Name

Required/Optional

Description

Sample Data

HTML Text

Required

The HTML text to be rendered and subsequently converted into a PDF file

CODE
<!DOCTYPE html>
<html>
<head>
<title>HTML to PDF Conversion</title>
</head>
<body>
<h1>Hello, this is a test HTML document</h1>
<p>This HTML text will be converted to a PDF file.</p>
</body>
</html>

File Name

Optional

The file name of the output PDF file. If it is not filled, a name with the date will be automatically generated.

testPDF.pdf

Output

Return Data

The returned result of this command. If some required parameters are not defined, this returned data could be empty. The returned result can be passed down directly to a subsequent command in playbooks.

SAMPLE DATA

JSON
{
    "Status": "Successful",
    "fileId": "136",
    "fileName": "testPDF.pdf",
    "md5": "452e8116c30b345284bb7669bd0fe886",
    "sha1": "029603b0dc784b0c0b3c86d989a043b1e7cd636b",
    "sha256": "fff299d9b36c1b4bee32eddefee6e3bd0b3f5b036dab0e5ae39c9cb2ecb01f6f"
}

Remote Command API

The D3 command API allows you to send requests to D3 SOAR to execute this utility command via REST API.

Request

POST

CODE
https:/{base_url}/{api_namespace}/api/Command/convertHTMLtoPDF

Headers

Please refer to the page Webhook Configuration Guide - Authentication Method: API Keys for more details.

Request Body

JSON
{
  "Username": <Username here>,
  "Site": <Site here>,
  "CommandParams": {
    "HTML Text": <HTML Text here>,
    "File Name": <File Name here>
   }
}

Body Parameters

Parameter Name

Type

Required/Optional

Description

Username

Text

Required

The username of your D3 SOAR account.

Site

Text

Required

The D3 SOAR site to run the remote command.

HTML Text

Text

Required

The HTML text to be rendered and subsequently converted into a PDF file

File Name

Text

Optional

The file name of the output PDF file. If it is not filled, a name with the date will be automatically generated.

Sample Request

SAMPLE DATA

JSON
{
  "Username": "Admin",
  "Site": "Security Operations",
  "CommandParams": {
        "HTML Text": "\r\n\r\n\r\n\r\n\r\n\r\n
    Hello, this is a test HTML document
    \r\n
    This HTML text will be converted to a PDF file.
    
    \r\n\r\n",
        "File Name": "testPDF.pdf"
  }
}

Response

Response Fields

Field Name

Type

Description

error

Text

The error message if the API request has failed.

returnData

JSON Object

The return data from the API request.

Sample Response

JSON
{
    "error": "",
    "returnData": {
      "Status": "Successful",
      "fileId": "136",
      "fileName": "testPDF.pdf",
      "md5": "452e8116c30b345284bb7669bd0fe886",
      "sha1": "029603b0dc784b0c0b3c86d989a043b1e7cd636b",
      "sha256": "fff299d9b36c1b4bee32eddefee6e3bd0b3f5b036dab0e5ae39c9cb2ecb01f6f"
  }
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.