Inserting Watermarks into PDFs

In this digital world, people create and share their documents (PDFs) every day. Whether it involves sharing information or sharing templates to fill in, documents are shared on big and small scales.

These shared documents need to protect confidential information and should provide information about the owner.

To achieve this, people use to add watermark on their shared document. Watermark can be added either as text-based pages or image-based or both, embedded on every or a few pages of the document. It helps them to protect PDF files containing highly confidential, sensitive, or proprietary information.

Let me quickly show, how we can simply add any kind of watermark to any number of documents.

Add Watermark through PDFFiddler Playground in simple steps

  • Upload PDF by either drag-drop or browsing the file.

  • Upload image if any, which you want to apply as a watermark image.

  • Now, Preview Uploaded PDF by clicking eye icon. Then, through mouse, draw a region, where you wanted to place the watermark

  • Write or Copy Paste below script.

//load input document, which has to be watermarked
doc = load($input[0])

//create blank watermark page
watermarkPage = Page()

//Add any text as watermark to page. Just Replace PDFFiddler with anything
watermarkPage.addText("PDFFiddler", $watermark, GState().font(HELVETICA, 48).rotate(45).color(RED).opacity(0.1).align(CENTER))

//Add uploaded image to watermark page
//We can access any resource file through $resource
watermarkPage.addImage($resource[0], $watermark, 48, 48, false, GState(fillOpacity: 0.1).align(CENTER))

//apply watermark to each page of document
//if you want, you can also, provide Page Number, where watermark to be applied.
doc.addWatermarkToPages(watermarkPage, BACKGROUND)

//output document
  • Now, Click on Run button, on top right of the Page.

  • Watermarked PDF is ready to downloaded and preview. :)

We can also customize the script to cater to some advanced requirement such as

  • Adding watermark to specifics pages

  • Add watermark to large quantities of PDF files in one go

  • Add different watermark on different PDF based upon some conditions.

and many many more

Using the PDFFiddler Playground saves you time when dealing with large quantities of PDF files while ensuring a consistent look across them—and a consistent “seal of approval” of your choosing.

#pdffiddler #pdfplayground #pdfautomation #pdfwatermark