{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":867,"path":"api-reference/server-api-reference/PDFGenerationAPIBothAPI.md","title":"PDFGenerationAPI - Scoped, Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# PDFGenerationAPI - Scoped, Global\n\nThe PDFGenerationAPI provides support for PDF conversion and handling PDF fields.\n\nThis API is part of the ServiceNow PDF Generation Utilities plugin \\(com.snc.apppdfgenerator\\) and is provided within the `sn_pdfgeneratorutils` namespace. The plugin is activated by default.\n\nUse the **glide.pdf.url.whitelist** property to add an extra layer of validation to ensure whether any external URL introduced should be included in the generated PDF. If the system property glide.pdf.url.whitelisting.enabled is set to true, the PDF does not process URL content unless it is listed in the Value field of the com.snc.pdf.whitelisted\\_urls system property. These properties are listed in the System Properties \\[sys\\_properties\\] table. For more information, see [Available system properties](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/r_AvailableSystemProperties.md).\n\n**Note:** The maximum PDF size is 50 MB.\n\nThe methods in this class enable the following tasks:\n\n-   Dynamically generate a PDF from an HTML string and attach it to a record\n    -   A4 size without headers or footers – [PDFGenerationAPI – convertToPDF\\(String html, String targetTable, String targetTableSysId, String pdfName, String fontFamilySysId, Object documentConfiguration\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n    -   Customizable page size with options for header and footer – [PDFGenerationAPI – convertToPDFWithHeaderFooter\\(String html, String targetTable, String targetTableSysId, String pdfName, Object headerFooterInfo, String fontFamilySysId, Object documentConfiguration\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   Queue a PDF to be generated from an HTML string and attached to a record\n    -   A4 size without headers or footers – [PDFGenerationAPI – convertToPDFAsync\\(String html, String targetTable, String targetTableSysId, String pdfName, String fontFamilySysId, Object documentConfiguration\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n    -   Customizable page size with options for header and footer – [PDFGenerationAPI – convertToPDFWithHeaderFooterAsync\\(String html, String targetTable, String targetTableSysId, String pdfName, Object headerFooterInfo, String fontFamilySysId, Object documentConfiguration\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   Fill fields in a PDF\n    -   [PDFGenerationAPI – fillDocumentFieldsAndFlatten\\(Object fieldsMap, String sysId, String tableName, String tableSysId, String pdfName, Object flatten\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n    -   [PDFGenerationAPI – fillDocumentFields\\(Object fieldsMap, String sysId, String tableName, String tableSysId, String pdfName\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n    -   [PDFGenerationAPI – isDocumentFillable\\(String sysId\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   Sign a PDF\n    -   [PDFGenerationAPI – fillFieldsAndMergeSignature\\(Object fieldsMap, String sysId, String tableName, String tableSysId, String pdfName, PdfMergeSignRequestor requestor, Object flatten\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n    -   [PDFGenerationAPI – getFilledDocumentWithSignatureAsBase64\\(Object fieldsMap, String sysId, PdfMergeSignRequestor requestor, Object flatten\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   Restrict editing filled fields as flattened or partially flattened – [PDFGenerationAPI – fillDocumentFieldsAndFlatten\\(Object fieldsMap, String sysId, String tableName, String tableSysId, String pdfName, Object flatten\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   Retrieve PDF page size and field data\n    -   [PDFGenerationAPI – getPdfPageSizes\\(String sysId\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n    -   [PDFGenerationAPI – getDocumentFieldsType\\(String sysId\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n    -   [PDFGenerationAPI – getDocumentFields\\(String sysId\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   Redact information in a PDF – [PDFGenerationAPI – redact\\(Object inputJson\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n\n**Note:** These methods can also be used for documents created by non-catalog items.\n\nRelated APIs:\n\n-   [PdfMergeSignRequestor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PdfMergeSignRequestorBothAPI.md)\n-   [SVGToPDFConversionAPI](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/SVGToPDFConversionAPBothAPI.md)\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## PDFGenerationAPI – PDFGenerationAPI\\(\\)\n\nInstantiates a new PDFGenerationAPI object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| ||\n\nThe following example shows how to create a PDFGenerationAPI object.\n\n```\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\n```\n\n## PDFGenerationAPI – convertToPDF\\(String html, String targetTable, String targetTableSysId, String pdfName, String fontFamilySysId, Object documentConfiguration\\)\n\nConverts an HTML string to a PDF document.\n\nThis method creates a PDF using the page size A4 – 595 × 842 points. Content will be truncated if it exceeds this size.\n\nTo generate a PDF with additional settings, such as page size, orientation, and page numbers, use [convertToPDFWithHeaderFooter\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md).\n\n<table id=\"table_sj4_p5j_34b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nhtml\n\n</td><td>\n\nString\n\n</td><td>\n\nHTML to convert to a PDF document.\n\n</td></tr><tr><td>\n\ntargetTable\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table on which to attach the converted PDF.\n\n</td></tr><tr><td>\n\ntargetTableSysId\n\n</td><td>\n\nString\n\n</td><td>\n\nSys\\_id of the record on which to attach the converted PDF.\n\n</td></tr><tr><td>\n\npdfName\n\n</td><td>\n\nString\n\n</td><td>\n\nName to give the PDF.Default: Sys\\_id of the PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\nfontFamilySysId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the font family to use for the PDF. This sys\\_id is from the PDF Generation Font Family \\[sys\\_pdf\\_generation\\_font\\_family\\] table.Default: none\n\n</td></tr><tr><td>\n\ndocumentConfiguration\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Object containing a table of contents configuration and a page number configuration.```\n{​\n   \"accessibilityEnabled\" : Boolean,\n   \"toc_config\" : \"String\",​\n   \"page_number_config\": \"String\"​\n}​\n```\n\n</td></tr><tr><td>\n\ndocumentConfiguration.accessibilityEnabled\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates whether to format the generated PDF to support accessibility. When this feature is enabled, accessibility tags will be available in the PDF tag tree to help users who rely on screen readers to navigate, understand, and interact with the generated PDF documents.Valid values:\n\n-   true: The generated PDF is formatted for accessibility.\n-   false: The generated PDF is not formatted for accessibility.\n\nDefault: False\n\n</td></tr><tr><td>\n\ndocumentConfiguration.toc\\_config\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the table of contents configuration to use for the PDF. This sys\\_id is from the Table of Contents Configuration \\[doc\\_toc\\_config\\] table.Default: none\n\n</td></tr><tr><td>\n\ndocumentConfiguration.page\\_number\\_config\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the page number configuration to use for the PDF. This sys\\_id is from the Page Number Configuration \\[doc\\_page\\_number\\_config\\] table.Default: none\n\n</td></tr></tbody>\n</table><table id=\"table_tj4_p5j_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nObject containing sys\\_id of the PDF attachment if conversion is successful, error message otherwise.```\n{\n  \"attachment_id\": \"String\",\n  \"message\": \"String\",\n  \"request_id\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.​attachment\\_id\n\n</td><td>\n\nIf HTML conversion is successful, sys\\_id of the converted and attached PDF. The file is listed in the Attachments \\[sys\\_attachment\\] table.Data type: String\n\n</td></tr><tr id=\"row_pdfgen_ret_msgCnv\"><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Possible values:\n\n-   Conversion failed. – No PDF created. Make sure the values provided are accurate.\n-   Conversion is successful. – The HTML successfully converted to PDF.\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Given target record \\[&lt;tableName&gt; - &lt;targetTableSysId&gt;\\] does not exist. – Target table sys\\_id is not in the table provided. Make sure you include the correct table name for the record.\n-   No Form associated with pdf to fill. attachmentSysId: &lt;sys\\_id&gt;\n-   No editable fields exist with specified names. Please check and try again. field names: &lt;field names&gt;\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n-   &lt;URL&gt; is not listed in whitelisted URL, please check URL whitelisting property : \"glide.pdf.url.whitelisting.enabled\" and \"com.snc.pdf.whitelisted\\_urls\" – If the system property glide.pdf.url.whitelisting.enabled is set to true, the PDF does not process URL content unless it is listed in the Value field of the com.snc.pdf.whitelisted\\_urls system property. These properties are listed in the System Properties \\[sys\\_properties\\] table.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.request\\_id\n\n</td><td>\n\nSys\\_id of the change producer request record.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to convert HTML to a PDF and attach it to a record in the Incident \\[incident\\] table.\n\n```\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\n\n//  (Option) get HTML from the description field of an incident record\nvar gr = new GlideRecord(\"incident\");\nvar html;\n\nif (gr.get(\"<tableSysId>\")) {\n html = gr.description.toString();\n}\n\nvar result = v.convertToPDF(html, \"incident\", \"<target_sys_id>\", \"myPDF\");\ngs.info(JSON.stringify(result));\n```\n\nOutput:\n\n```\n{\"attachment_id\":\"<sys_id>\",\"message\":\"Conversion is successful.\",\"request_id\":\"<change_sys_id>\",\"status\":\"success\"}\n```\n\n## PDFGenerationAPI – convertToPDFAsync\\(String html, String targetTable, String targetTableSysId, String pdfName, String fontFamilySysId, Object documentConfiguration\\)\n\nStages a job that converts an HTML string to a PDF document asynchronously. Asynchronous processing enables you to work in the instance while the PDF conversion is in progress. This is especially helpful for larger PDF exports.\n\nThis API creates a PDF using the page size A4 – 595 × 842 points. Content will be truncated if it exceeds this size.\n\nTo generate a PDF with additional settings, such as page size, orientation, and page numbers, use [convertToPDFWithHeaderFooterAsync\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md).\n\n<table id=\"table_sj4_p5j_34b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nhtml\n\n</td><td>\n\nString\n\n</td><td>\n\nHTML to convert to a PDF document.\n\n</td></tr><tr><td>\n\ntargetTable\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table on which to attach the converted PDF.\n\n</td></tr><tr><td>\n\ntargetTableSysId\n\n</td><td>\n\nString\n\n</td><td>\n\nSys\\_id of the record on which to attach the converted PDF.\n\n</td></tr><tr><td>\n\npdfName\n\n</td><td>\n\nString\n\n</td><td>\n\nName to give the PDF.Default: Sys\\_id of the PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\nfontFamilySysId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the font family to use for the PDF. This sys\\_id is from the PDF Generation Font Family \\[sys\\_pdf\\_generation\\_font\\_family\\] table.Default: none\n\n</td></tr><tr><td>\n\ndocumentConfiguration\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Object containing a table of contents configuration and a page number configuration.```\n{​\n   \"accessibilityEnabled\" : Boolean,\n   \"toc_config\" : \"String\",​\n   \"page_number_config\": \"String\"​\n}​\n```\n\n</td></tr><tr><td>\n\ndocumentConfiguration.accessibilityEnabled\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates whether to format the generated PDF to support accessibility. When this feature is enabled, accessibility tags will be available in the PDF tag tree to help users who rely on screen readers to navigate, understand, and interact with the generated PDF documents.Valid values:\n\n-   true: The generated PDF is formatted for accessibility.\n-   false: The generated PDF is not formatted for accessibility.\n\nDefault: False\n\n</td></tr><tr><td>\n\ndocumentConfiguration.toc\\_config\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the table of contents configuration to use for the PDF. This sys\\_id is from the Table of Contents Configuration \\[doc\\_toc\\_config\\] table.Default: none\n\n</td></tr><tr><td>\n\ndocumentConfiguration.page\\_number\\_config\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the page number configuration to use for the PDF. This sys\\_id is from the Page Number Configuration \\[doc\\_page\\_number\\_config\\] table.Default: none\n\n</td></tr></tbody>\n</table><table id=\"table_tj4_p5j_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nObject indicating whether the PDF conversion is in progress. You can review the conversion status in the PDF Generation Status \\[sys\\_pdf\\_generation\\_status\\] table.```\n{\n  \"message\": \"String\",\n  \"request_id\": \"String\"\n}\n```\n\n</td></tr><tr id=\"row_pdfgen_ret_msgCnv\"><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Possible values:\n\n-   HTML to PDF Conversion is in progress. – Request to convert HTML to a PDF document is successful.\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Given target record \\[&lt;tableName&gt; - &lt;targetTableSysId&gt;\\] does not exist. – Target table sys\\_id is not in the table provided. Make sure you include the correct table name for the record.\n-   No Form associated with pdf to fill. attachmentSysId: &lt;sys\\_id&gt;\n-   No editable fields exist with specified names. Please check and try again. field names: &lt;field names&gt;\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n-   &lt;URL&gt; is not listed in whitelisted URL, please check URL whitelisting property : \"glide.pdf.url.whitelisting.enabled\" and \"com.snc.pdf.whitelisted\\_urls\" – If the system property glide.pdf.url.whitelisting.enabled is set to true, the PDF does not process URL content unless it is listed in the Value field of the com.snc.pdf.whitelisted\\_urls system property. These properties are listed in the System Properties \\[sys\\_properties\\] table.\n\nData type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.request\\_id\n\n</td><td>\n\nSys\\_id of the change producer request record.Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to queue a task that converts HTML to a PDF. When the conversion is complete, the PDF named \"myPDF\" is attached to the target record in the Incident \\[incident\\] table.\n\n```\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\n\n//  (Option) get HTML from the description field of an incident record\nvar gr = new GlideRecord(\"incident\");\nvar html;\n\nif (gr.get(\"<tableSysId>\")) {\n html = gr.description.toString();\n}\n\nvar result = v.convertToPDFAsync(html, \"incident\", \"<target_sys_id>\", \"myPDF\");\ngs.info(JSON.stringify(result));\n```\n\nOutput:\n\n```\n{\"message\":\"HTML to PDF Conversion is in progress.\",\"request_id\":\"<sys_id>\"}\n```\n\n## PDFGenerationAPI – convertToPDFWithHeaderFooter\\(String html, String targetTable, String targetTableSysId, String pdfName, Object headerFooterInfo, String fontFamilySysId, Object documentConfiguration\\)\n\nConverts an HTML string into a PDF with header and footer content.\n\nUse this method to generate PDFs with page settings:\n\n-   Header and footer information\n-   Margin sizes\n-   Orientation\n-   Enumeration\n-   Page size\n\n<table id=\"table_hmj_q5j_34b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nhtml\n\n</td><td>\n\nString\n\n</td><td>\n\nHTML to convert to a PDF document.\n\n</td></tr><tr><td>\n\ntargetTable\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table on which to attach the converted PDF.\n\n</td></tr><tr><td>\n\ntargetTableSysId\n\n</td><td>\n\nString\n\n</td><td>\n\nSys\\_id of the record on which to attach the converted PDF.\n\n</td></tr><tr><td>\n\npdfName\n\n</td><td>\n\nString\n\n</td><td>\n\nName to give the PDF.Default: Sys\\_id of the PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\nheaderFooterInfo\n\n</td><td>\n\nObject\n\n</td><td>\n\nDefines PDF header and footer details.```\n{\n  \"FooterImageAlignment\": \"String\",\n  \"FooterImageAttachmentId\": \"String\",\n  \"FooterImageHeight\": \"String\",\n  \"FooterText\": \"String\",\n  \"FooterTextAlignment\": \"String\",\n  \"GeneratePageNumber\": \"String\",\n  \"HeaderImageAlignment\": \"String\",\n  \"HeaderImageAttachmentId\": \"String\",\n  \"HeaderImageHeight\": \"String\",\n  \"LeftOrRightMargin\": \"String\",\n  \"PageOrientation\": \"String\",\n  \"PageSize\": \"String\",\n  \"TopOrBottomMargin\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterImageAlignment\n\n</td><td>\n\nString\n\n</td><td>\n\nSets the image position in the footer.Valid values:\n\n-   BOTTOM\\_CENTER: Position the image in the bottom center of the footer.\n-   BOTTOM\\_LEFT: Position the image in the bottom left area of the footer.\n-   BOTTOM\\_RIGHT: Position the image in the bottom right area of the footer.\n-   TOP\\_CENTER: Position the image in the top center of the footer.\n-   TOP\\_LEFT: Position the image in the top left area of the footer.\n-   TOP\\_RIGHT: Position the image in the top right area of the footer.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterImageAttachmentId\n\n</td><td>\n\nString\n\n</td><td>\n\nSys\\_id of the footer image in the Attachments \\[sys\\_attachment\\] table.To determine if the file type is supported in your instance, Navigate to **System Properties**, **Security**, and check if it's listed in **List of file extensions \\(comma-separated\\) that can be attached** field.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterImageHeight\n\n</td><td>\n\nString\n\n</td><td>\n\nHeight of footer image.Default: 50 points\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterText\n\n</td><td>\n\nString\n\n</td><td>\n\nFooter text to place at the bottom of each PDF page.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterTextAlignment\n\n</td><td>\n\nString\n\n</td><td>\n\nSets the text position in the footer. Make sure this value does not match or conflict with the area provided in **headerFooterInfo.FooterImageAlignment**.Valid values:\n\n-   BOTTOM\\_CENTER: Position the text in the bottom center of the footer.\n-   BOTTOM\\_LEFT: Position the text in the bottom left area of the footer.\n-   BOTTOM\\_RIGHT: Position the text in the bottom right area of the footer.\n-   TOP\\_CENTER: Position the text in the top center of the footer.\n-   TOP\\_LEFT: Position the text in the top left area of the footer.\n-   TOP\\_RIGHT: Position the text in the top right area of the footer.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​GeneratePageNumber\n\n</td><td>\n\nString\n\n</td><td>\n\nFlag that indicates whether to generate a PDF page number.Valid values:\n\n-   true: Generate page numbers.\n-   false: Do not generate page numbers.\n\n Default: true\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​HeaderImageAlignment\n\n</td><td>\n\nString\n\n</td><td>\n\nSets the image position in the header.Valid values:\n\n-   center: Position the image in the center of the header.\n-   left: Position the image on the left side of the header.\n-   right: Position the image on the right side of the header.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​HeaderImageAttachmentId\n\n</td><td>\n\nString\n\n</td><td>\n\nSys\\_id of the header image in the Attachments \\[sys\\_attachment\\] table.To determine if the file type is supported in your instance, Navigate to **System Properties**, **Security**, and check if it's listed in **List of file extensions \\(comma-separated\\) that can be attached** field.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​HeaderImageHeight\n\n</td><td>\n\nString\n\n</td><td>\n\nHeight of the header image. Default: 50 points\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​LeftOrRightMargin\n\n</td><td>\n\nString\n\n</td><td>\n\nSize of the left and right margins. If positioned in the left or right side of the page, header/footer details are placed within in this area.Default: 36 points\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​PageOrientation\n\n</td><td>\n\nString\n\n</td><td>\n\nPage orientation.Valid values:\n\n-   PORTRAIT\n-   LANDSCAPE\n\nDefault: Portrait\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​PageSize\n\n</td><td>\n\nString\n\n</td><td>\n\nDocument page size.Valid values:\n\n-   A4 – 595 × 842 points\n-   LETTER – 612 × 792 points\n-   LEDGER – 792 x 1224 points\n\nContent will be truncated if it exceeds the page size.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​TopOrBottomMargin\n\n</td><td>\n\nString\n\n</td><td>\n\nSize of the top and bottom margins. Header and footer details are placed within in this area.Default: 72 points\n\n</td></tr><tr><td>\n\nfontFamilySysId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the font family to use for the PDF. This sys\\_id is from the PDF Generation Font Family \\[sys\\_pdf\\_generation\\_font\\_family\\] table.Default: none\n\n</td></tr><tr><td>\n\ndocumentConfiguration\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Object containing a table of contents configuration and a page number configuration.```\n{​\n   \"accessibilityEnabled\" : Boolean,\n   \"toc_config\" : \"String\",​\n   \"page_number_config\": \"String\"​\n}​\n```\n\n</td></tr><tr><td>\n\ndocumentConfiguration.accessibilityEnabled\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates whether to format the generated PDF to support accessibility. When this feature is enabled, accessibility tags will be available in the PDF tag tree to help users who rely on screen readers to navigate, understand, and interact with the generated PDF documents.Valid values:\n\n-   true: The generated PDF is formatted for accessibility.\n-   false: The generated PDF is not formatted for accessibility.\n\nDefault: False\n\n</td></tr><tr><td>\n\ndocumentConfiguration.toc\\_config\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the table of contents configuration to use for the PDF. This sys\\_id is from the Table of Contents Configuration \\[doc\\_toc\\_config\\] table.Default: none\n\n</td></tr><tr><td>\n\ndocumentConfiguration.page\\_number\\_config\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the page number configuration to use for the PDF. This sys\\_id is from the Page Number Configuration \\[doc\\_page\\_number\\_config\\] table.Default: none\n\n</td></tr></tbody>\n</table><table id=\"table_tj4_p5j_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nObject containing sys\\_id of the PDF attachment if conversion is successful, error message otherwise.```\n{\n  \"attachment_id\": \"String\",\n  \"message\": \"String\",\n  \"request_id\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.​attachment\\_id\n\n</td><td>\n\nIf HTML conversion is successful, sys\\_id of the converted and attached PDF. The file is listed in the Attachments \\[sys\\_attachment\\] table.Data type: String\n\n</td></tr><tr id=\"row_pdfgen_ret_msgCnv\"><td>\n\n&lt;Object&gt;.​message\n\n</td><td>\n\nMessage confirming success or error. Possible values:\n\n-   Conversion failed. – No PDF created. Make sure the values provided are accurate.\n-   Conversion is successful. – The HTML successfully converted to PDF.\n-   Footer Image alignment and text alignment cannot be in the same region with same alignment: &lt;footerImageAlignment value&gt; – Make sure that **headerFooterInfo.​FooterImageAlignment** and **headerFooterInfo.​FooterTextAlignment** values are not in the same area.\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Given target record \\[&lt;tableName&gt; - &lt;targetTableSysId&gt;\\] does not exist. – Target table sys\\_id is not in the table provided. Make sure you include the correct table name for the record.\n-   Invalid footer image alignment: &lt;invalid\\_option&gt; is provided. – Provide a valid option in the **headerFooterInfo.​FooterImageAlignment** property.\n-   Invalid footer text alignment: \" + &lt;invalid\\_option&gt; + \" is provided. – Provide a valid option in the **headerFooterInfo.​footerTextAlignment** property.\n-   No Form associated with pdf to fill. attachmentSysId: &lt;sys\\_id&gt;\n-   No editable fields exist with specified names. Please check and try again. field names: &lt;field names&gt;\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Unable to get the footer image. sysId: + &lt;value provided&gt; – Make sure the sys\\_id provided for **headerFooterInfo.​footerImageId** is accurate.\n-   Unable to get the header image. sysId: + &lt;value provided&gt; – Make sure the sys\\_id provided for **headerFooterInfo.​headerImageId** is accurate.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n-   &lt;URL&gt; is not listed in whitelisted URL, please check URL whitelisting property : \"glide.pdf.url.whitelisting.enabled\" and \"com.snc.pdf.whitelisted\\_urls\" – If the system property glide.pdf.url.whitelisting.enabled is set to true, the PDF does not process URL content unless it is listed in the Value field of the com.snc.pdf.whitelisted\\_urls system property. These properties are listed in the System Properties \\[sys\\_properties\\] table.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.request\\_id\n\n</td><td>\n\nSys\\_id of the change producer request record.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to convert HTML to a PDF named \"myPDF\" and add the PDF as an attachment to a record in the Incident \\[incident\\] table. The PDF contains header and footer provided via attachment.\n\n```\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\n\n//  (Option) get HTML from the description field of an incident record\nvar gr = new GlideRecord(\"incident\");\nvar html;\n\nif (gr.get(\"<tableSysId>\")) {\n html = gr.description.toString();\n}\n\nvar hfInfo = new Object();\nhfInfo[\"HeaderImageAttachmentId\"] = \"<hdrImgAttSysId>\";\nhfInfo[\"HeaderImageAlignment\"] = \"left\";\nhfInfo[\"FooterImageAttachmentId\"] = \"<ftrImgAttSysId>\";\nhfInfo[\"FooterImageAlignment\"] = \"TOP_CENTER\";\nhfInfo[\"FooterText\"] = \"Sample Footer Message\";\nhfInfo[\"PageSize\"] = \"A4\";\nhfInfo[\"GeneratePageNumber\"] = \"false\";\nhfInfo[\"TopOrBottomMargin\"] = \"36\";\nhfInfo[\"LeftOrRightMargin\"] = \"24\";\n\nvar result = v.convertToPDFWithHeaderFooter(html, \"incident\", \"<targetTbl_sys_id>\", \"myPDF\", hfInfo);\ngs.info(JSON.stringify(result));\n```\n\nOutput:\n\n```\n{\"attachment_id\":\"<sys_id>\",\"message\":\"Conversion is successful.\",\"request_id\":\"<change_sys_id>\",\"status\":\"success\"}\n```\n\n## PDFGenerationAPI – convertToPDFWithHeaderFooterAsync\\(String html, String targetTable, String targetTableSysId, String pdfName, Object headerFooterInfo, String fontFamilySysId, Object documentConfiguration\\)\n\nStages a job that converts an HTML string into a PDF with header and footer content asynchronously. Asynchronous processing enables you to work in the instance while the PDF conversion is in progress. This is especially helpful for larger PDF exports.\n\nUse this method to generate PDFs with page settings:\n\n-   Header and footer information\n-   Margin sizes\n-   Orientation\n-   Enumeration\n-   Page size\n\n<table id=\"table_hmj_q5j_34b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nhtml\n\n</td><td>\n\nString\n\n</td><td>\n\nHTML to convert to a PDF document.\n\n</td></tr><tr><td>\n\ntargetTable\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table on which to attach the converted PDF.\n\n</td></tr><tr><td>\n\ntargetTableSysId\n\n</td><td>\n\nString\n\n</td><td>\n\nSys\\_id of the record on which to attach the converted PDF.\n\n</td></tr><tr><td>\n\npdfName\n\n</td><td>\n\nString\n\n</td><td>\n\nName to give the PDF.Default: Sys\\_id of the PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\nheaderFooterInfo\n\n</td><td>\n\nObject\n\n</td><td>\n\nDefines PDF header and footer details.```\n{\n  \"FooterImageAlignment\": \"String\",\n  \"FooterImageAttachmentId\": \"String\",\n  \"FooterImageHeight\": \"String\",\n  \"FooterText\": \"String\",\n  \"FooterTextAlignment\": \"String\",\n  \"GeneratePageNumber\": \"String\",\n  \"HeaderImageAlignment\": \"String\",\n  \"HeaderImageAttachmentId\": \"String\",\n  \"HeaderImageHeight\": \"String\",\n  \"LeftOrRightMargin\": \"String\",\n  \"PageOrientation\": \"String\",\n  \"PageSize\": \"String\",\n  \"TopOrBottomMargin\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterImageAlignment\n\n</td><td>\n\nString\n\n</td><td>\n\nSets the image position in the footer.Valid values:\n\n-   BOTTOM\\_CENTER: Position the image in the bottom center of the footer.\n-   BOTTOM\\_LEFT: Position the image in the bottom left area of the footer.\n-   BOTTOM\\_RIGHT: Position the image in the bottom right area of the footer.\n-   TOP\\_CENTER: Position the image in the top center of the footer.\n-   TOP\\_LEFT: Position the image in the top left area of the footer.\n-   TOP\\_RIGHT: Position the image in the top right area of the footer.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterImageAttachmentId\n\n</td><td>\n\nString\n\n</td><td>\n\nSys\\_id of the footer image in the Attachments \\[sys\\_attachment\\] table.To determine if the file type is supported in your instance, Navigate to **System Properties**, **Security**, and check if it's listed in **List of file extensions \\(comma-separated\\) that can be attached** field.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterImageHeight\n\n</td><td>\n\nString\n\n</td><td>\n\nHeight of footer image.Default: 50 points\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterText\n\n</td><td>\n\nString\n\n</td><td>\n\nFooter text to place at the bottom of each PDF page.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​FooterTextAlignment\n\n</td><td>\n\nString\n\n</td><td>\n\nSets the text position in the footer. Make sure this value does not match or conflict with the area provided in **headerFooterInfo.FooterImageAlignment**.Valid values:\n\n-   BOTTOM\\_CENTER: Position the text in the bottom center of the footer.\n-   BOTTOM\\_LEFT: Position the text in the bottom left area of the footer.\n-   BOTTOM\\_RIGHT: Position the text in the bottom right area of the footer.\n-   TOP\\_CENTER: Position the text in the top center of the footer.\n-   TOP\\_LEFT: Position the text in the top left area of the footer.\n-   TOP\\_RIGHT: Position the text in the top right area of the footer.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​GeneratePageNumber\n\n</td><td>\n\nString\n\n</td><td>\n\nFlag that indicates whether to generate a PDF page number.Valid values:\n\n-   true: Generate page numbers.\n-   false: Do not generate page numbers.\n\n Default: true\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​HeaderImageAlignment\n\n</td><td>\n\nString\n\n</td><td>\n\nSets the image position in the header.Valid values:\n\n-   center: Position the image in the center of the header.\n-   left: Position the image on the left side of the header.\n-   right: Position the image on the right side of the header.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​HeaderImageAttachmentId\n\n</td><td>\n\nString\n\n</td><td>\n\nSys\\_id of the header image in the Attachments \\[sys\\_attachment\\] table.To determine if the file type is supported in your instance, Navigate to **System Properties**, **Security**, and check if it's listed in **List of file extensions \\(comma-separated\\) that can be attached** field.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​HeaderImageHeight\n\n</td><td>\n\nString\n\n</td><td>\n\nHeight of the header image. Default: 50 points\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​LeftOrRightMargin\n\n</td><td>\n\nString\n\n</td><td>\n\nSize of the left and right margins. If positioned in the left or right side of the page, header/footer details are placed within in this area.Default: 36 points\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​PageOrientation\n\n</td><td>\n\nString\n\n</td><td>\n\nPage orientation.Valid values:\n\n-   PORTRAIT\n-   LANDSCAPE\n\nDefault: Portrait\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​PageSize\n\n</td><td>\n\nString\n\n</td><td>\n\nDocument page size.Valid values:\n\n-   A4 – 595 × 842 points\n-   LETTER – 612 × 792 points\n-   LEDGER – 792 x 1224 points\n\nContent will be truncated if it exceeds the page size.\n\n</td></tr><tr><td>\n\nheaderFooterInfo.​TopOrBottomMargin\n\n</td><td>\n\nString\n\n</td><td>\n\nSize of the top and bottom margins. Header and footer details are placed within in this area.Default: 72 points\n\n</td></tr><tr><td>\n\nfontFamilySysId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the font family to use for the PDF. This sys\\_id is from the PDF Generation Font Family \\[sys\\_pdf\\_generation\\_font\\_family\\] table.Default: none\n\n</td></tr><tr><td>\n\ndocumentConfiguration\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Object containing a table of contents configuration and a page number configuration.```\n{​\n   \"accessibilityEnabled\" : Boolean,\n   \"toc_config\" : \"String\",​\n   \"page_number_config\": \"String\"​\n}​\n```\n\n</td></tr><tr><td>\n\ndocumentConfiguration.accessibilityEnabled\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates whether to format the generated PDF to support accessibility. When this feature is enabled, accessibility tags will be available in the PDF tag tree to help users who rely on screen readers to navigate, understand, and interact with the generated PDF documents.Valid values:\n\n-   true: The generated PDF is formatted for accessibility.\n-   false: The generated PDF is not formatted for accessibility.\n\nDefault: False\n\n</td></tr><tr><td>\n\ndocumentConfiguration.toc\\_config\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the table of contents configuration to use for the PDF. This sys\\_id is from the Table of Contents Configuration \\[doc\\_toc\\_config\\] table.Default: none\n\n</td></tr><tr><td>\n\ndocumentConfiguration.page\\_number\\_config\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the page number configuration to use for the PDF. This sys\\_id is from the Page Number Configuration \\[doc\\_page\\_number\\_config\\] table.Default: none\n\n</td></tr></tbody>\n</table><table id=\"table_tj4_p5j_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\n \n\n</td></tr><tr id=\"row_pdfgen_ret_msgCnv\"><td>\n\n&lt;Object&gt;.​message\n\n</td><td>\n\nMessage confirming success or error. Possible values:\n\n-   HTML to PDF Conversion is in progress. – Request to convert HTML to a PDF document is successful.\n-   Footer Image alignment and text alignment cannot be in the same region with same alignment: &lt;footerImageAlignment value&gt; – Make sure that **headerFooterInfo.​FooterImageAlignment** and **headerFooterInfo.​FooterTextAlignment** values are not in the same area.\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Given target record \\[&lt;tableName&gt; - &lt;targetTableSysId&gt;\\] does not exist. – Target table sys\\_id is not in the table provided. Make sure you include the correct table name for the record.\n-   Invalid footer image alignment: &lt;invalid\\_option&gt; is provided. – Provide a valid option in the **headerFooterInfo.​FooterImageAlignment** property.\n-   Invalid footer text alignment: \" + &lt;invalid\\_option&gt; + \" is provided. – Provide a valid option in the **headerFooterInfo.​footerTextAlignment** property.\n-   No Form associated with pdf to fill. attachmentSysId: &lt;sys\\_id&gt;\n-   No editable fields exist with specified names. Please check and try again. field names: &lt;field names&gt;\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Unable to get the footer image. sysId: + &lt;value provided&gt; – Make sure the sys\\_id provided for **headerFooterInfo.​footerImageId** is accurate.\n-   Unable to get the header image. sysId: + &lt;value provided&gt; – Make sure the sys\\_id provided for **headerFooterInfo.​headerImageId** is accurate.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n-   &lt;URL&gt; is not listed in whitelisted URL, please check URL whitelisting property : \"glide.pdf.url.whitelisting.enabled\" and \"com.snc.pdf.whitelisted\\_urls\" – If the system property glide.pdf.url.whitelisting.enabled is set to true, the PDF does not process URL content unless it is listed in the Value field of the com.snc.pdf.whitelisted\\_urls system property. These properties are listed in the System Properties \\[sys\\_properties\\] table.\n\nData type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.request\\_id\n\n</td><td>\n\nSys\\_id of the change producer request record.Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to queue a task that converts HTML to a PDF. The PDF contains header and footer provided via attachment. When the conversion is complete, the PDF named \"myPDF\" is attached to the target record in the Incident \\[incident\\] table.\n\n```\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\n\n//  (Option) get HTML from the description field of an incident record\nvar gr = new GlideRecord(\"incident\");\nvar html;\n\nif (gr.get(\"<tableSysId>\")) {\n html = gr.description.toString();\n}\n\nvar hfInfo = new Object();\nhfInfo[\"HeaderImageAttachmentId\"] = \"<hdrImgAttSysId>\";\nhfInfo[\"HeaderImageAlignment\"] = \"left\";\nhfInfo[\"FooterImageAttachmentId\"] = \"<ftrImgAttSysId>\";\nhfInfo[\"FooterImageAlignment\"] = \"TOP_CENTER\";\nhfInfo[\"FooterText\"] = \"Sample Footer Message\";\nhfInfo[\"PageSize\"] = \"A4\";\nhfInfo[\"GeneratePageNumber\"] = \"false\";\nhfInfo[\"TopOrBottomMargin\"] = \"36\";\nhfInfo[\"LeftOrRightMargin\"] = \"24\";\n\nvar result = v.convertToPDFWithHeaderFooterAsync(html, \"incident\", \"<targetTbl_sys_id>\", \"myPDF\", hfInfo);\ngs.info(JSON.stringify(result));\n```\n\nOutput:\n\n```\n{\"message\":\"HTML to PDF Conversion is in progress.\",\"request_id\":\"<sys_id>\"}\n```\n\n## PDFGenerationAPI – fillDocumentFields\\(Object fieldsMap, String sysId, String tableName, String tableSysId, String pdfName\\)\n\nFills fields in an editable PDF and attaches it to the provided record.\n\nUse the following methods to determine if the PDF is fillable and get field information:\n\n-   [isDocumentFillable\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   [getDocumentFields\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   [getDocumentFieldsType\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n\nPDFGenerationAPI provides additional fill methods with different options:\n\n-   [fillDocumentFieldsAndFlatten\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF, flattens the data fields, and attaches it to the provided record.\n-   [fillFieldsAndMergeSignature\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF, adds signature image, flattens the data fields, and attaches it to the provided record.\n-   [getFilledDocumentWithSignatureAsBase64\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF, creates an image, and converts it to a Base64-encoded PDF.\n\n<table id=\"table_ohl_lzj_34b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nfieldsMap\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Key value map by PDF field name and value to fill. Use the getDocumentFields\\(\\) method to get the list of available fields.\n\n</td></tr><tr><td>\n\nsysId\n\n</td><td>\n\nString\n\n</td><td id=\"ent_api_pdfgen_parm_attSysIDesc\">\n\nSys\\_id of a PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\ntableName\n\n</td><td>\n\nString\n\n</td><td id=\"entry-api-pdfgen-tblName\">\n\nName of the table containing the record to which the PDF is attached. You can find this value in the same row as the attachment listed in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\ntableSysId\n\n</td><td>\n\nString\n\n</td><td id=\"entry-api-pdfgen-tblID\">\n\nSys\\_id of the record to which the PDF is attached. You can find this value in the same row as the attachment listed in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\npdfName\n\n</td><td>\n\nString\n\n</td><td>\n\nName to give the PDF.Default: Sys\\_id of the PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr></tbody>\n</table><table id=\"table_phl_lzj_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td id=\"desc-fill-only\">\n\nObject containing sys\\_id of the updated PDF attachment if successful, error message otherwise.```\n{\n  \"attachment_id\": \"String\",\n  \"message\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.​attachment\\_id\n\n</td><td id=\"desc_pdfgen_ret_attID_Fill\">\n\nIf the operation is successful, sys\\_id of the filled PDF. The file is listed in the Attachments \\[sys\\_attachment\\] table.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Valid values:\n\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Given target record \\[&lt;tableName&gt; - &lt;targetTableSysId&gt;\\] does not exist. – Target table sys\\_id is not in the table provided. Make sure you include the correct table name for the record.\n-   No Form associated with pdf to fill. attachmentSysId: &lt;sys\\_id&gt;\n-   No editable fields exist with specified names. Please check and try again. field names: &lt;field names&gt;\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to fill fields in an editable PDF.\n\n```\nvar fieldMap = new Object();\nfieldMap[\"Address\"] = \"Address value here\";\nfieldMap[\"State\"] = \"State value here\";\n\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\nvar result = v.fillDocumentFields(fieldMap, \"<attachmentSysId>\", \"<tableName>\", \"<tableSysId>\", \"pdfName\");\ngs.info(JSON.stringify(result));\n```\n\nOutput:\n\n```\n{\"attachment_id\":\"<sys_id>\",\"message\":\"Request completed successfully.\",\"status\":\"success\"}\n```\n\n## PDFGenerationAPI – fillDocumentFieldsAndFlatten\\(Object fieldsMap, String sysId, String tableName, String tableSysId, String pdfName, Object flatten\\)\n\nFills fields in an editable PDF, flattens the data fields, and attaches it to the provided record.\n\nUse the following methods to determine if the PDF is fillable and get field information:\n\n-   [isDocumentFillable\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   [getDocumentFields\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   [getDocumentFieldsType\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n\nPDFGenerationAPI provides additional fill methods with different options:\n\n-   [fillDocumentFields\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF and attaches it to the provided record.\n-   [fillFieldsAndMergeSignature\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF, adds signature image, flattens the data fields, and attaches it to the provided record.\n-   [getFilledDocumentWithSignatureAsBase64\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF, creates an image, and converts it to a Base64-encoded PDF.\n\n<table id=\"table_xp4_thk_34b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nfieldsMap\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Key value map by PDF field name and value to fill. Use the getDocumentFields\\(\\) method to get the list of available fields.\n\n</td></tr><tr><td>\n\nsysId\n\n</td><td>\n\nString\n\n</td><td id=\"ent_api_pdfgen_parm_attSysIDesc\">\n\nSys\\_id of a PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\ntableName\n\n</td><td>\n\nString\n\n</td><td id=\"entry-api-pdfgen-tblName\">\n\nName of the table containing the record to which the PDF is attached. You can find this value in the same row as the attachment listed in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\ntableSysId\n\n</td><td>\n\nString\n\n</td><td id=\"entry-api-pdfgen-tblID\">\n\nSys\\_id of the record to which the PDF is attached. You can find this value in the same row as the attachment listed in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\npdfName\n\n</td><td>\n\nString\n\n</td><td>\n\nName to give the PDF.Default: Sys\\_id of the PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\nflatten\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Flattening fields enable locking the fields so that other users cannot change the information. Specify the key as \"FlattenType\" and provide a flattening option as a string.Valid values:\n\n-   donot\\_flatten - Do not flatten any fields.\n-   partially\\_flatten - Flatten only the fields which are modified.\n-   fully\\_flatten - Flattens all the fields.\n\nDefault: fully\\_flatten\n\n```\n{\n  \"FlattenType\": \"String\" \n}\n```\n\n</td></tr></tbody>\n</table><table id=\"table_phl_lzj_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td id=\"desc-fill-only\">\n\nObject containing sys\\_id of the updated PDF attachment if successful, error message otherwise.```\n{\n  \"attachment_id\": \"String\",\n  \"message\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.​attachment\\_id\n\n</td><td id=\"desc_pdfgen_ret_attID_Fill\">\n\nIf the operation is successful, sys\\_id of the filled PDF. The file is listed in the Attachments \\[sys\\_attachment\\] table.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Valid values:\n\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Given target record \\[&lt;tableName&gt; - &lt;targetTableSysId&gt;\\] does not exist. – Target table sys\\_id is not in the table provided. Make sure you include the correct table name for the record.\n-   No Form associated with pdf to fill. attachmentSysId: &lt;sys\\_id&gt;\n-   No editable fields exist with specified names. Please check and try again. field names: &lt;field names&gt;\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to fill fields and flatten an editable PDF.\n\n```\nvar fieldMap = new Object();\nfieldMap[\"Last Name First Name Middle Initial\"] = \"Tuter Abel E.\";\nfieldMap[\"Date of Birth\"] = \"08101952\";\nfieldMap[\"US SSN\"] = \"111-22-9999\";\nfieldMap[\"Address\"] = \"PO Box 344\";\nfieldMap[\"City\"] = \"Jerome\";\nfieldMap[\"State\"] = \"AZ\";\nfieldMap[\"Zip\"] = \"86331\";\n\nvar flatten = new Object();\nflatten[\"FlattenType\"] = \"partially_flatten\";\n\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\nvar result = v.fillDocumentFieldsAndFlatten(fieldMap, \"<attachmentSysId>\", \"<tableName>\", \"<tableSysId>\", \"pdfName\", flatten);\ngs.info(JSON.stringify(result));\n```\n\nOutput:\n\n```\n\"attachment_id\":\"<sys_id>\",\"message\":\"Request completed successfully.\",\"status\":\"success\"\n```\n\n## PDFGenerationAPI – fillFieldsAndMergeSignature\\(Object fieldsMap, String sysId, String tableName, String tableSysId, String pdfName, PdfMergeSignRequestor requestor, Object flatten\\)\n\nFills fields in an editable PDF, adds signature image, flattens the data fields, and attaches it to the provided record.\n\nUse the following methods to determine if the PDF is fillable and get field information:\n\n-   [isDocumentFillable\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   [getDocumentFields\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   [getDocumentFieldsType\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n\nPDFGenerationAPI provides additional fill methods with different options:\n\n-   [fillDocumentFields\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF and attaches it to the provided record.\n-   [fillDocumentFieldsAndFlatten\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF, flattens the data fields, and attaches it to the provided record.\n-   [getFilledDocumentWithSignatureAsBase64\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF, creates an image, and converts it to a Base64-encoded PDF.\n\n<table id=\"table_xp4_thk_34b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nfieldsMap\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Key value map by PDF field name and value to fill. Use the getDocumentFields\\(\\) method to get the list of available fields.\n\n</td></tr><tr><td>\n\nsysId\n\n</td><td>\n\nString\n\n</td><td id=\"ent_api_pdfgen_parm_attSysIDesc\">\n\nSys\\_id of a PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\ntableName\n\n</td><td>\n\nString\n\n</td><td id=\"entry-api-pdfgen-tblName\">\n\nName of the table containing the record to which the PDF is attached. You can find this value in the same row as the attachment listed in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\ntableSysId\n\n</td><td>\n\nString\n\n</td><td id=\"entry-api-pdfgen-tblID\">\n\nSys\\_id of the record to which the PDF is attached. You can find this value in the same row as the attachment listed in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\npdfName\n\n</td><td>\n\nString\n\n</td><td>\n\nName to give the PDF.Default: Sys\\_id of the PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\nrequestor\n\n</td><td>\n\n[PdfMergeSign​Requestor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PdfMergeSignRequestorBothAPI.md)\n\n</td><td>\n\nSignature input returned from pdfMergeSignRequestor.\n\n</td></tr><tr><td>\n\nflatten\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Flattening fields enable locking the fields so that other users cannot change the information. Specify the key as \"FlattenType\" and provide a flattening option as a string.Valid values:\n\n-   donot\\_flatten - Do not flatten any fields.\n-   partially\\_flatten - Flatten only the fields which are modified.\n-   fully\\_flatten - Flattens all the fields.\n\nDefault: fully\\_flatten\n\n```\n{\n  \"FlattenType\": \"String\" \n}\n```\n\n</td></tr></tbody>\n</table><table id=\"table_anm_5hk_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td id=\"desc-fill-only\">\n\nObject containing sys\\_id of the updated PDF attachment if successful, error message otherwise.```\n{\n  \"attachment_id\": \"String\",\n  \"message\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.​attachment\\_id\n\n</td><td id=\"desc_pdfgen_ret_attID_Fill\">\n\nIf the operation is successful, sys\\_id of the filled PDF. The file is listed in the Attachments \\[sys\\_attachment\\] table.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Valid values:\n\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Given target record \\[&lt;tableName&gt; - &lt;targetTableSysId&gt;\\] does not exist. – Target table sys\\_id is not in the table provided. Make sure you include the correct table name for the record.\n-   No Form associated with pdf to fill. attachmentSysId: &lt;sys\\_id&gt;\n-   No editable fields exist with specified names. Please check and try again. field names: &lt;field names&gt;\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to fill fields with signature with default settings to completely flatten the fields.\n\n```\nvar fieldMap = new Object();\nfieldMap[\"Address_Salutation\"] = \"Address value here\";\n\nvar paramMap = new Object();\nparamMap[\"FlattenType\"] = \"partially_flatten\";\n\nvar requestor = new sn_pdfgeneratorutils.PdfMergeSignRequestor;\nrequestor.createRequest(\"<attachmentSysId>\", \"incident\", \"<tableSysId>\", \"filledPdf\");\nrequestor.addSignatureMapping(6, 40, 50, 188, 44, \"<signatureSysId>\");\n\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\nvar result = v.fillFieldsAndMergeSignature(fieldMap, \"<attachmentSysId>\", \"incident\", \"<tableSysId>\", requestor, \"filledPdf\", paramMap);\ngs.info(JSON.stringify(result));\n```\n\nOutput:\n\n```\n{\"attachment_id\":\"5440d993dbed3010d66be1191396194e\",\"message\":\"Request completed successfully.\",\"status\":\"success\"}\n```\n\n## PDFGenerationAPI – getDocumentFields\\(String sysId\\)\n\nGets a list of editable fields in a PDF document. Enables listing editable PDF fields without manually opening the file to check.\n\n|Name|Type|Description|\n|----|----|-----------|\n|sysId|String|Sys\\_id of a PDF in the Attachments \\[sys\\_attachment\\] table.|\n\n<table id=\"table_v1y_g3k_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nObject containing ID of the signed PDF, error message otherwise. ```\n{\n  \"attachment_id\": \"String\",\n  \"message\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.fields\n\n</td><td>\n\nIf the request is successful, list containing the name of each field in the PDF.Data type: Array of strings\n\n ```\n\"fields\": [\"field_name\"]\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Possible values:\n\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to retrieve fields in a PDF attachment.\n\n```\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\nvar result = v.getDocumentFields(\"attachmentSysId\");\ngs.info(JSON.stringify(result));\n\n```\n\nOutput:\n\n```\n{\"message\":\"Request completed successfully.\",\"fields\":[\"NP_formFillable\",\"reset\",\"print\",\"1SSN\",\"Signature.1\",\"5sigDate\",\"Check Box21\"],\"status\":\"success\"}\n```\n\n## PDFGenerationAPI – getDocumentFieldsType\\(String sysId\\)\n\nGets the field type of set of editable fields from a PDF document.\n\n|Name|Type|Description|\n|----|----|-----------|\n|sysId|String|Sys\\_id of a PDF in the Attachments \\[sys\\_attachment\\] table.|\n\n<table id=\"table_jxx_whk_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nObject containing each PDF field type if successful, error message otherwise. ```\n{\n  \"fields_type\": {Object},\n  \"message\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.fields\\_type\n\n</td><td>\n\nObject listing each field in the specified PDF if successful, error message otherwise.Data type: Object\n\n ```\n\"fields_type\": {\n  \"<field type>\": {Object},\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.fields\\_type.​&lt;field&gt;\n\n</td><td>\n\nObject containing page number of each field. The &lt;field&gt; name represents the field label, for example, \"SSN\", or an automated label representing the type.Data type: Object\n\n ```\n\"<field>\": { \n  \"fieldsDetails\": [Array], // Check boxes, radio buttons, choice boxes only\n  \"pageNumber\": \"String\",\n  \"type\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.fields\\_type.​&lt;field&gt;.fieldsDetails\n\n</td><td>\n\nList of objects containing field name and corresponding value of each option for choice field types.Applicable types:\n\n-   Check box\n-   Choice box\n-   Combo box\n-   Multi select choice box\n\n Data type: Array\n\n ```\n\"fieldsDetails\": [ \n  \"fieldName\": \"String\",\n  \"value\": \"String\"\n]\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.fields\\_type.​&lt;field&gt;.fieldsDetails.fieldName\n\n</td><td>\n\nName of a choice field.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.fields\\_type.​&lt;field&gt;.fieldsDetails.value\n\n</td><td>\n\nValue of a choice field.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.fields\\_type.​&lt;field&gt;.pageNumber\n\n</td><td>\n\nPDF page number corresponding to this field.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.fields\\_type.​&lt;field&gt;.type\n\n</td><td>\n\nPDF field type.Possible values:\n\n-   check\\_box\n-   choice\\_box\n-   combo\\_box\n-   multi\\_select\\_choice\\_box\n-   push\\_button\n-   radio\\_button\n-   signature\n-   text\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Possible values:\n\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to retrieve field types in a PDF attachment. Results include manual returns for readability and are truncated for brevity.\n\n```\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\nvar result = v.getDocumentFieldsType(\"<attachmentSysId>\");\ngs.info(JSON.stringify(result));\n\n```\n\nOutput:\n\n```\n{\"fields_type\":{\"1ADDLINE2.25\":{\"pageNumber\":2,\"type\":\"text\"},\"1ADDLINE2.24\":{\"pageNumber\":2,\"type\":\"text\"},\n\"1ADDLINE2.23\":{\"pageNumber\":2,\"type\":\"text\"},\"1ADDLINE2.22\":{\"pageNumber\":2,\"type\":\"text\"},\n\"1ADDLINE2.11\":{\"pageNumber\":2,\"type\":\"text\"},\n\"Check Box1\":{\"fieldsDetails\":[{\"fieldName\":\"Yes\"}],\"pageNumber\":2,\"type\":\"check_box\"},\n\"4consentDate.6\":{\"pageNumber\":4,\"type\":\"text\"},\"4consentDate.7\":{\"pageNumber\":4,\"type\":\"text\"},\n\"3SSN.9\":{\"pageNumber\":3,\"type\":\"text\"},\"3SSN.8\":{\"pageNumber\":3,\"type\":\"text\"},\"3SSN.7\":{\"pageNumber\":3,\"type\":\"text\"},\n\"pageNumber\":2,\"type\":\"check_box\"},\"Check Box8\":{\"fieldsDetails\":[{\"fieldName\":\"Off\"},{\"fieldName\":\"yes\"}],\n\"4planAdminDate.8\":{\"pageNumber\":4,\"type\":\"text\"},\"4planAdminDate.7\":{\"pageNumber\":4,\"type\":\"text\"},\n\"1FirstName_ID.7\":{\"pageNumber\":2,\"type\":\"text\"},\n\"Check Box9\":{\"fieldsDetails\":[{\"fieldName\":\"Yes\"}],\"pageNumber\":3,\"type\":\"check_box\"},\n\"1LN.1\":{\"pageNumber\":2,\"type\":\"text\"},\"1LN.2\":{\"pageNumber\":2,\"type\":\"text\"},\n\"Check Box11\":{\"fieldsDetails\":[{\"fieldName\":\"Yes\"}],\"pageNumber\":3,\"type\":\"check_box\"},\n\"1LN.9\":{\"pageNumber\":2,\"type\":\"text\"},\n\"Check Box17\":{\"fieldsDetails\":[{\"fieldName\":\"Yes\"}],\"pageNumber\":3,\"type\":\"check_box\"},\n\"Check Box16\":{\"fieldsDetails\":[{\"fieldName\":\"Yes\"}],\"pageNumber\":3,\"type\":\"check_box\"},\n\"1LN.7\":{\"pageNumber\":2,\"type\":\"text\"},\"Check Box19\":{\"fieldsDetails\":[{\"fieldName\":\"Yes\"}],\n\"1LN.8\":{\"pageNumber\":2,\"type\":\"text\"},\"Check Box18\":{\"fieldsDetails\":[{\"fieldName\":\"Yes\"}],\n\"print\":{\"pageNumber\":2,\"type\":\"push_button\"},\"4planAdministrator.1\":{\"pageNumber\":4,\"type\":\"text\"},\n\"1TaxID.9\":{\"pageNumber\":2,\"type\":\"text\"},\"4SSN.1\":{\"pageNumber\":3,\"type\":\"text\"},\"4SSN.2\":{\"pageNumber\":3,\"type\":\"text\"},\n\"Signature.1\":{\"pageNumber\":4,\"type\":\"text\"},\"1ZIP.2\":{\"pageNumber\":2,\"type\":\"text\"},\"1ZIP.3\":{\"pageNumber\":2,\"type\":\"text\"},\n\"message\":\"Request completed successfully.\",\"status\":\"success\"}\n```\n\n## PDFGenerationAPI – getFilledDocumentWithSignatureAsBase64\\(Object fieldsMap, String sysId, PdfMergeSignRequestor requestor, Object flatten\\)\n\nFills fields in an editable PDF, creates an image, and converts it to a Base64-encoded PDF.\n\nBase64 encoding enables you to output a PDF as a string within a text document, such as HTML or JSON, without damaging the binary character syntax.\n\nUse the following methods to determine if the PDF is fillable and get field information:\n\n-   [isDocumentFillable\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   [getDocumentFields\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n-   [getDocumentFieldsType\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md)\n\nPDFGenerationAPI provides additional fill methods with different options:\n\n-   [fillDocumentFields\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF and attaches it to the provided record.\n-   [fillDocumentFieldsAndFlatten\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF, flattens the data fields, and attaches it to the provided record.\n-   [fillFieldsAndMergeSignature\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PDFGenerationAPIBothAPI.md) – Fills fields in an editable PDF, adds signature image, flattens the data fields, and attaches it to the provided record.\n\n<table id=\"table_w4w_xhk_34b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nfieldsMap\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Key value map by PDF field name and value to fill. Use the getDocumentFields\\(\\) method to get the list of available fields.\n\n</td></tr><tr><td>\n\nsysId\n\n</td><td>\n\nString\n\n</td><td id=\"ent_api_pdfgen_parm_attSysIDesc\">\n\nSys\\_id of a PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\nrequestor\n\n</td><td>\n\n[PdfMergeSign​Requestor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PdfMergeSignRequestorBothAPI.md)\n\n</td><td>\n\nSignature input returned from pdfMergeSignRequestor.\n\n</td></tr><tr><td>\n\nflatten\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Flattening fields enable locking the fields so that other users cannot change the information. Specify the key as \"FlattenType\" and provide a flattening option as a string.Valid values:\n\n-   donot\\_flatten - Do not flatten any fields.\n-   partially\\_flatten - Flatten only the fields which are modified.\n-   fully\\_flatten - Flattens all the fields.\n\nDefault: fully\\_flatten\n\n```\n{\n  \"FlattenType\": \"String\" \n}\n```\n\n</td></tr></tbody>\n</table><table id=\"table_x4w_xhk_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nIf successful, PDF converted to Base64 format is added to the Attachments table \\[sys\\_attachment\\]. Contents reflect the PDF attachment provided with fields and signature filled. The fields are not editable unless an alternative flattening option was provided with the **flatten** parameter.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Valid values:\n\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Given target record \\[&lt;tableName&gt; - &lt;targetTableSysId&gt;\\] does not exist. – Target table sys\\_id is not in the table provided. Make sure you include the correct table name for the record.\n-   No Form associated with pdf to fill. attachmentSysId: &lt;sys\\_id&gt;\n-   No editable fields exist with specified names. Please check and try again. field names: &lt;field names&gt;\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to load two fields in a PDF attachment, flatten the fields, and convert the PDF to Base64 format.\n\n```\nvar mymap = new Object();\nmymap[\"City\"] = \"City value here\";\nmymap[\"State\"] = \"XX\";\n\n// create a requestor\nvar requestor = new sn_pdfgeneratorutils.PdfMergeSignRequestor;\nrequestor.createRequest(\"<sys_id>\", \"tableName\", \"<tableSysId>\", \"pdfName\");\nrequestor.addSignatureMapping(6, 40, 50, 188, 44, \"<signImgSysId>\");\nvar processedRequestObj = requestor.processRequest();\n\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\n\nvar result = v.getFilledDocumentWithSignatureAsBase64(mymap, \"<attachmentSysId>\", processedRequestObj);\ngs.info (JSON.stringify(result));\n```\n\n## PDFGenerationAPI – getPdfPageSizes\\(String sysId\\)\n\nGets the page size of a PDF document.\n\n|Name|Type|Description|\n|----|----|-----------|\n|sysId|String|Sys\\_id of a PDF in the Attachments \\[sys\\_attachment\\] table.|\n\n<table id=\"table_v1y_g3k_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nObject containing the size of each page if successful, error message otherwise. ```\n{\n  \"pages_size\": {Object},\n  \"message\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.pages\\_size\n\n</td><td>\n\nIf the operation is successful, width and height of each PDF page in points. The page number is returned as a string and the measurement values are returned as number data types.Data type: Object\n\n ```\n\"pages_size\": {\"<page number>\":[<width>,<height>]}\n```\n\n</td></tr><tr id=\"row_pdfgen_ret_msg\"><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Possible values:\n\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to display the width and height of each page in a PDF attachment.\n\n```\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\nvar result = v.getPdfPageSizes (\"<attachmentSysId>\");\ngs.info(JSON.stringify(result));\n\n```\n\nOutput:\n\n```\n{\"pages_size\":{\"1\":[612,792],\"2\":[612,792],\"3\":[612,792],\"4\":[612,792],\"5\":[612,792]},\"message\":\"Request completed successfully.\",\"status\":\"success\"}\n\n```\n\n## PDFGenerationAPI – isDocumentFillable\\(String sysId\\)\n\nChecks if the PDF document contains editable fields.\n\n|Name|Type|Description|\n|----|----|-----------|\n|sysId|String|Sys\\_id of a PDF in the Attachments \\[sys\\_attachment\\] table.|\n\n<table id=\"table_erx_h3k_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nObject containing the size of each page if successful, error message otherwise. ```\n{\n  \"document_editable\": \"String\",\n  \"message\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.​document\\_editable\n\n</td><td>\n\nIf the operation is successful, flag indicating whether the document is editable.Valid values:\n\n-   true: PDF document has editable fields.\n-   false: PDF document does not have editable fields.\n\n Data type: Boolean value provided as a string\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Possible values:\n\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to determine if PDF document fields are editable.\n\n```\nvar v = new sn_pdfgeneratorutils.PDFGenerationAPI;\nvar result = v.isDocumentFillable(\"<attachmentSysId>\");\ngs.info(JSON.stringify(result));\n\n```\n\nOutput:\n\n```\n{\"message\":\"Request completed successfully.\",\"document_editable\":\"true\",\"status\":\"success\"}\n```\n\n## PDFGenerationAPI – redact\\(Object inputJson\\)\n\nApplies redaction to a PDF document based on the given rectangle coordinates, search keywords, or both. A redacted copy of the original PDF is generated in the Attachments \\[sys\\_attachment\\] table.\n\n**Note:**\n\n-   Redaction results might include an unexpected white redacted text block that overwrites text not intended to be redacted. If this event occurs, you can manually select the content for redaction using the **highlightedSections** property or the PDF Generation Utilities plugin. For more information, see [Redact data from documents](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/servicenow-platform/redact-sensitive-data.md).\n-   This method doesn’t support redaction in PDFs containing JBIG2 images.\n\n<table id=\"table_drx_h3k_34b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\ninputJson\n\n</td><td>\n\nObject\n\n</td><td>\n\nIdentifies the PDF and its content to be redacted.```\n{\n  \"sysId\": \"String\",\n  \"highlightedSections\": [Array],\n  \"searchedKeywords\": [Array]\n}\n```\n\n</td></tr><tr><td>\n\ninputJson.sysId\n\n</td><td>\n\nString\n\n</td><td id=\"ent_api_pdfgen_parm_attSysIDesc\">\n\nSys\\_id of a PDF in the Attachments \\[sys\\_attachment\\] table.\n\n</td></tr><tr><td>\n\ninputJson. highlightedSections\n\n</td><td>\n\nArray of Objects\n\n</td><td>\n\nList of rectangles coordinates provided as an object. Each coordinate represents the location of the content to be redacted on each page.Optional if including the **searchedKeywords** property.\n\n```\n[\n   {\n     \"pageNumber\": Number,\n     \"x\": Number,\n     \"y\": Number,\n     \"width\": Number,\n     \"height\": Number\n   }\n]\n```\n\n</td></tr><tr><td>\n\ninputJson. highlightedSections. pageNumber\n\n</td><td>\n\nNumber\n\n</td><td>\n\nPDF page number containing the content to select for redaction.\n\n</td></tr><tr><td>\n\ninputJson. highlightedSections. x\n\n</td><td>\n\nNumber\n\n</td><td>\n\nThe X-axis \\(horizontal position\\) of the redaction rectangle on the PDF in points. The value at the bottom-left corner of the PDF page is 0. For example, a value of `306` places the rectangle approximately in the horizontal center of a letter-size PDF page.\n\n</td></tr><tr><td>\n\ninputJson. highlightedSections. y\n\n</td><td>\n\nNumber\n\n</td><td>\n\nThe Y-axis \\(vertical position\\) of the redaction rectangle on the PDF in points. The value at the bottom-left corner of the PDF page is 0. For example, a value of `396` places the rectangle approximately in the vertical center of a letter-size PDF page.\n\n</td></tr><tr><td>\n\ninputJson. highlightedSections. width\n\n</td><td>\n\nNumber\n\n</td><td>\n\nWidth of the redaction rectangle is in points. This value increases the size of the rectangle horizontally from the lower left point at which the x an y axes intersect.\n\n</td></tr><tr><td>\n\ninputJson. highlightedSections. height\n\n</td><td>\n\nNumber\n\n</td><td>\n\nHeight of the redaction rectangle in points. This value increases the size of the rectangle vertically from the lower left point at which the x an y axes intersect.\n\n</td></tr><tr><td>\n\ninputJson. searchedKeywords\n\n</td><td>\n\nArray\n\n</td><td>\n\nList of one or more strings used to find text for redaction. The redaction rectangle size matches the height and width of the text that is blocked out as a result.Optional if including the **highlightedSections** property.\n\n**Note:** In some cases, text strings containing special characters or punctuation such as `\"items:\"` and `\"PDF.\"` aren't redacted. You can alternatively remove the character from the string or highlight the area to remove the text.\n\n</td></tr></tbody>\n</table><table id=\"table_phl_lzj_34b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td id=\"desc-fill-only\">\n\nObject containing sys\\_id of the updated PDF attachment if successful, error message otherwise.```\n{\n  \"attachment_id\": \"String\",\n  \"message\": \"String\",\n  \"status\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.​attachment\\_id\n\n</td><td id=\"desc_pdfgen_ret_attID_Fill\">\n\nIf the operation is successful, sys\\_id of the filled PDF. The file is listed in the Attachments \\[sys\\_attachment\\] table.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.message\n\n</td><td>\n\nMessage confirming success or error. Possible values:\n\n-   Can't parse this format – Unable to process an image embedded in the PDF. The PDF contains one or more images in an unsupported format, such as a JBIG2 image.\n-   Exception while reading Source document contents. PDF header not found. – Input attachment provided is not a valid PDF. Provide the correct attachment sys\\_id.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] did not pass security scan – The PDF did not pass the antivirus scan.\n-   Request cannot proceed as the attachment with sys\\_id \\[\\{0\\}\\] is pending security scan – The PDF requires an antivirus scan.\n-   Request completed successfully – Operation is successful.\n-   Undefined – Sys\\_id provided does not exist or is not a PDF attachment.\n\nData type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.status\n\n</td><td>\n\nStatus indicating whether the operation is successful.Possible values:\n\n-   success - Operation was successful.\n-   failure – Operation was not successful. The **message** provides details.\n\n Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to redact by rectangle and key word. On the redacted PDF, the areas selected on page 2 are blocked out. The string '23' is redacted on any page that it's found on.\n\n```\nvar pdfRequest = {\n  sysId: 'e4b3ae35fc128210f877789781ea59f3',\n  highlightedSections: [\n    {\n      \"pageNumber\": 2,\n      \"x\": 261.75,\n      \"y\": 480,\n      \"width\": 21,\n      \"height\": 14.25\n    },\n    {\n      \"pageNumber\": 2,\n      \"x\": 249,\n      \"y\": 390.75,\n      \"width\": 63.75,\n      \"height\": 15.75\n    }\n    // Add more coordinates as needed\n  ],\n  searchedKeywords: ['23']\n};\n\n// Convert the JSON object to a string\nvar jsonRequest = JSON.stringify(pdfRequest);\ngs.info('JSON Request: ' + jsonRequest + '\\n');\n\nvar PDFRedaction = new sn_pdfgeneratorutils.PDFGenerationAPI;\nvar result = PDFRedaction.redact(jsonRequest);\ngs.info(JSON.stringify(result));\n```\n\nOutput:\n\n```\nJSON Request: {\"sysId\":\"e4b3ae35fc128210f877789781ea59f3\",\"highlightedSections\":[{\"pageNumber\":2,\"x\":261.75,\"y\":480,\"width\":21,\"height\":14.25},{\"pageNumber\":2,\"x\":249,\"y\":390.75,\"width\":63.75,\"height\":15.75}],\"searchedKeywords\":[23]}\n\n{\"attachment_id\":\"1744ae35fc128210f877789781ea59fc\",\"message\":\"Request completed successfully.\",\"status\":\"success\"}\n```\n\n"}}