Tutorial 11: Create a PDF stamp
Estimated time: 10 min.
Prerequisites
- PIPEFORCE Enterprise 7.0 or higher + DMS module
- You have a valid PIPEFORCE Developer account
- You have completed tutorial: Tutorial: Create a new app
- You have completed tutorial: Tutorial: Create and execute a pipeline
PDF stamp - Intro
In this tutorial, you will learn how you can put text stamps on PDF files. With this, you can put incoming date stamps or watermarks on PDFs.
1 - Provide the invoice PDF
In the first step, you need to upload a sample PDF which can be used for this tutorial.
If you don’t have a sample invoice PDF at hand, you can use this one:
Login to the portal https://NAMESPACE.pipeforce.net
Click on Files / Drive. The Drive WebUI opens.
Upload the sample invoice PDF in the root folder of your drive. Keep the name
invoice.pdf
:
2 - Create the stamp pipeline
In the next step, you will create a pipeline which loads the PDF, puts a stamp on it, and saves the stamped PDF back to drive:
Login to the portal https://NAMESPACE.pipeforce.net
Navigate to LOW CODE → Workbench
Select the node of your app or create a new one.
Click the plus icon at the top of the tree.
The new property view opens:
- As property key, use:
global/app/YOUR_APP/pipeline/pdf-stamp
- As mime type, use:
application/yaml; type=pipeline
- As property key, use:
Click
SAVE
The new property has been created, and the content editor was opened for you.
Now copy and paste this content into the editor, and overwrite any existing data there by this:
pipeline:
- drive.read:
path: "invoice.pdf"
- pdf.stamp:
text: "RECEIVED #{@date.timestamp()}"
- drive.save:
path: "invoice-received.pdf"Your pipeline now consists of three commands:
- Load the PDF document from drive using the command
drive.read
. - Put a PDF stamp on this loaded invoice using the
pdf.stamp
command. Additionally, we use the@date
PEL util here to return the current date and time. - Store the stamped PDF document back to drive under a new name
invoice-received.pdf
using the commanddrive.save
.
- Load the PDF document from drive using the command
Click
SAVE
and thenRUN
to execute the pipeline.After a refresh of the drive page, you should see a new PDF invoice-received.pdf:
Open the
invoice-received.pdf
. You should see the generated stamp at the top right corner:Done. Congratulations!
3 - Extra: Send PDF inline via email
A very often use case is, to put a stamp to a PDF, and then send it via email to one or more recipients. Because of this, we will show you here how to do so with the stamped PDF in the same pipeline:
Open your pipeline
pdf-stamp
and change it to this:pipeline:
- drive.read:
path: "invoice.pdf"
- pdf.stamp:
text: "RECEIVED #{@date.timestamp()}"
- drive.save:
path: "invoice-received.pdf"
cleanupBody: false
- mail.send:
to: "you@domain.tld"
subject: "Invoice received"
message: "Hello, we received your invoice. Thanks!"
attachments: "#{body}"As you can see, we did several adjustments to this pipeline:
- We added the parameter
cleanupBody: false
todrive.save
. This keeps the final PDF in the body for use of the next command. - We added
mail.send
as next command, which will take the PDF from the body as an attachment and send it via email to the given recipient. Note the#{body}
expression in the attachment parameter, which points to the body of the pipeline where the PDF resides temporarily.
- We added the parameter
Replace
you@domain.tld
by your real email address.Click
SAVE
and thenRUN
.After a while, you should receive an email with the stamped PDF as an attachment.
Done.
Report an Issue
In case you're missing something on this page, you found an error or you have an idea for improvement, please click here to create a new issue. Another way to contribute is, to click Edit this page below and directly add your changes in GitHub. Many thanks for your contribution in order to improve PIPEFORCE!