Overlay PDF

Audience: Low-code Engineers
Skill Prerequisites: HTML CSS

Overlays two PDFs.

Typical Use Cases

  • Insert a watermark

Don't use it to

Related Actions

Action NameDescription
Generate PDFUses wkhtmltopdf open source to generate PDF from HTML template.

Input Parameter Reference

ParameterDescriptionSupports TokensDefaultRequired
File PathPath to first file, that can have multiple pages and can be: RelativeUrl, AbsoluteUrl, LinkClickUrl or PhysicalPath.Yesempty stringYes
Overlay PDF File PathOverlay PDF File Path, that can have multiple pages and can be: RelativeUrl, AbsoluteUrl, LinkClickUrl or PhysicalPath.Yesempty stringYes
Overlay Starting PageIndex of the page where to start the overlay (first page index is 0).Yesempty stringYes
Overlay RecursivelyCheck if you want to go back to the first page of the overlay pdf after the last page has been reached.Yesempty stringNo
FolderFolder path where you want to store the new pdf.Yesnone selectedNo
File NameFile Name for the newly generated file.Yesempty stringNo
Overlay Starting X PositionSet the starting X position of the overlay. Default is 0.Yesempty stringNo
Overlay Starting Y PositionSet the starting Y position of the overlay. Default is 0.Yesempty stringNo

Output Parameters Reference

ParameterDescription
Absolute URLOptionally, provide a token name where the absolute URL will be saved.
Relative URLOptionally, provide a token name where the relative URL will be saved.
Physical Path TokenNameOptionally, provide a token name where the physical path will be saved.
Link Click TokenNameOptionally, provide a token name where the LinkClick URL will be saved.
DNN FileId TokenNameOptionally, provide a token name where the FileId from DNN will be saved.

Possible Issue

If one of the PDFs is password protected or doesn't have read permissions, merging them will not work.

Examples

1. Overlaying 2 newly generated PDFs

​ The action below generates two PDFs, with different content, and then overlays them. Import it into your application to see it in action. ​

{
"Title": "Execute Actions",
"ActionType": "ExecuteActions",
"Description": "overlaying two generated pdfs",
"Condition": null,
"Parameters": {
"ActionList": [
{
"Title": "Generate PDF",
"ActionType": "GeneratePDF",
"Description": null,
"Condition": null,
"Parameters": {
"HtmlInputType": {
"Expression": "",
"Value": "codemirror",
"IsExpression": false,
"Parameters": {}
},
"HTMLCode": "<head>\n\t<style>\n h1 {\n color: red;\n text-align: center;\n }\n\t</style>\n</head>\n\n<body>\n\t<h1> \n Picture - PDF 1 \n \t</h1>\n</body>",
"PDFName": "PDF-1",
"PathDestination": {
"Expression": "",
"Value": "/",
"IsExpression": false,
"Parameters": {}
},
"OrientationLandscape": "",
"PaperSize": {
"Expression": "",
"Value": "A4",
"IsExpression": false,
"Parameters": {}
},
"Grayscale": "",
"OtherOptions": "--javascript-delay 1000",
"StoreFileId": "",
"StoreAbsoluteURL": "PDF1",
"StoreRelativeURL": "",
"StorePhysicalPath": "",
"StoreLinkClick": "",
"ForceDownload": true
},
"$_uid": "action15952568490254593",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true
},
{
"Title": "Generate PDF",
"ActionType": "GeneratePDF",
"Description": null,
"Condition": null,
"Parameters": {
"HtmlInputType": {
"Expression": "",
"Value": "codemirror",
"IsExpression": false,
"Parameters": {}
},
"HTMLCode": "<head>\n\t<style>\n img {\n display: block;\n margin-left: auto;\n margin-right: auto;\n width: 50%;\n }\n\t</style>\n</head>\n\n<body>\n \t<h2 style=\"text-align:center\">\n PDF 2\n \t</h2>\n\t<img src=\"https://learn.plantanapp.com/img/pap-logo.png\" alt=\"Plant An App Logo\">\n</body>",
"PDFName": "PDF-2",
"PathDestination": {
"Expression": "",
"Value": "/",
"IsExpression": false,
"Parameters": {}
},
"OrientationLandscape": "",
"PaperSize": {
"Expression": "",
"Value": "A4",
"IsExpression": false,
"Parameters": {}
},
"Grayscale": "",
"OtherOptions": "--javascript-delay 1000",
"StoreFileId": "",
"StoreAbsoluteURL": "PDF2",
"StoreRelativeURL": "",
"StorePhysicalPath": "",
"StoreLinkClick": "",
"ForceDownload": true
},
"$_uid": "action15952568490256933",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true,
"Id": -1
},
{
"Id": -1,
"$_uid": "action15952568490257538",
"Parameters": {
"FilePath": "[PDF1]",
"OverlayFilePath": "[PDF2]",
"OverlayStartigPage": "0",
"OverlayRecursively": true,
"Folder": {
"Expression": "",
"Value": "/",
"IsExpression": false,
"Parameters": {}
},
"FileName": "Overlayed-PDF",
"OverlayStartingXPosition": "",
"OverlayStartingYPosition": "20",
"AbsoluteUrlTokenName": "link",
"RelativeUrlTokenName": "",
"PhysicalPathTokenName": "",
"LinkClickTokenName": "",
"FileIdTokenName": ""
},
"ActionType": "OverlayPdf",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true,
"Definition": {
"IsClientAction": false,
"Settings": {
"Group": "Documents"
}
}
},
{
"Title": "Redirect to URL",
"ActionType": "RedirectToUrl",
"Description": null,
"Condition": null,
"Parameters": {
"Url": "[link]",
"EscapeUrl": "",
"OpenInPopup": "",
"PopupTitle": "",
"OpenInNewTab": "",
"ForceDownload": true
},
"$_uid": "action15952568490259309",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true
}
]
}
}
Last updated on by Patrick Anderson