PNG JPG BMP TIFF PDF
Aspose.PDF  for PHP

Add Watermark to PDF in PHP SDK

Add Watermarks to PDF files in PHP Cloud API without the use of any software like Adobe PDF.

Get Started

Why do I need to Add Watermarks to PDF Files Using PHP Cloud API

Adding watermarks to a PDF enhances security, branding, and providing context. Watermarks help discourage unauthorized sharing by clearly marking a document as “Confidential”. They can also convey the status of the document, such as “Draft”, “Approved”, or “For Review”, helping readers understand the context or stage of the document. Also, watermarks can indicate copyright or ownership, reducing the likelihood of intellectual property theft and providing a legal standing in case of unauthorized reproduction. For many companies, watermarked documents can add a layer of professionalism and control over how documents are perceived and shared externally.

Package Manager Console Command

     
    composer install

Steps for Adding Watermarks using PHP

A basic adding watermarks pdfs programmatically with Aspose.PDF Cloud PHP SDK APIs can be done with just few lines of code.

  1. Install PHP SDK.
  2. Go to the Aspose Cloud Dashboard.
  3. Create a new Account to access all applications and services or Sign In to your account.
  4. Click on Applications in the left menu to get Client Id and Client Secret.
  5. Check out the Developer Guide to add watermarks into PDF in PHP.
  6. Check out our GitHub repository for a complete API list along with working examples.
  7. Check out the API Reference page for the description of APIs parameters.
 

Add the watermarks into PDF - PHP


	$name = 'PageNumberStamp.pdf';
	$this->uploadFile($name);

	$image = 'test.jpg';
	$this->uploadFile($image);

	$stamp = new Aspose\PDF\Model\ImageStamp();
	$stamp->setBackground(true);
	$stamp->setLeftMargin(1);
	$stamp->setRightMargin(2);
	$stamp->setTopMargin(3);
	$stamp->setBottomMargin(4);
	$stamp->setHorizontalAlignment(Aspose\PDF\Model\HorizontalAlignment::CENTER);
	$stamp->setVerticalAlignment(Aspose\PDF\Model\VerticalAlignment::CENTER);
	$stamp->setOpacity(1);
	$stamp->setRotate(Aspose\PDF\Model\Rotation::NONE);
	$stamp->setRotateAngle(0);
	$stamp->setXIndent(0);
	$stamp->setYIndent(0);
	$stamp->setZoom(1);
	$stamp->setFileName($this->tempFolder . '/' . $image);
 

Watermarks in PDF

Watermarks can deter unauthorized use or distribution by clearly marking the document with ownership or copyright information, protecting original content from being misused or redistributed without permission. In some cases, watermarks are added as a subtle design feature to enhance the look and feel of a document, providing a professional, polished appearance that reflects the brand identity.

With our PHP library you can:

  • Add PDF document’s header & footer in text or image format.
  • Add tables & stamps (text or image) to PDF documents.
  • Append multiple PDF documents to an existing file.
  • Work with PDF attachments, annotations, & form fields.
  • Apply encryption or decryption to PDF documents & set a password.
  • Delete all stamps & tables from a page or entire PDF document.
  • Delete a specific stamp or table from the PDF document by its ID.
  • Replace single or multiple instances of text on a PDF page or from the entire document.
  • Extensive support for converting PDF documents to various other file formats.
  • Extract various elements of PDF files & make PDF documents optimized.
  • You can try out our free App to Add watermarks to PDF files online and test the functionality.