Estimated time: 10 min.
In this tutorial you will learn:
Prerequisites for this tutorial:
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
In this tutorial you will learn, how you could put text stamps on PDF files. With this you can for example put incoming date stamps or watermarks on PDFs.
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
:
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
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 new name invoice-received.pdf
using the command drive.save
.
Click SAVE
and then RUN
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!
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
to drive.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 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.
Replace you@domain.tld
by your real email address.
Click SAVE
and RUN
.
After a while you should receive an email with the stamped PDF as attachment.
Done.